Fossil SCM
Add test cases for fossil json. Improve the test suite to support a way to treat expected non-zero status exits from fossil as success when warrented. Made minor bug fixes to the test framework, and to several test cases unrelated to JSON support.
Commit
62627615e7fd4375e0430546a5a42e01077bb888
Parent
4c163cd71560883…
6 files changed
+4
-4
+3
-3
+43
+2
-2
+7
-1
+28
-30
+4
-4
| --- test/amend.test | ||
| +++ test/amend.test | ||
| @@ -221,11 +221,11 @@ | ||
| 221 | 221 | } |
| 222 | 222 | set sc 0 |
| 223 | 223 | foreach badformat $badformats { |
| 224 | 224 | incr sc |
| 225 | 225 | set datetime [clock format $timestamp -format $badformat -gmt 1] |
| 226 | - fossil amend $UUIDINIT -date $datetime | |
| 226 | + fossil amend $UUIDINIT -date $datetime -expectError | |
| 227 | 227 | test amend-date-2.$sc {[string first "YYYY-MM-DD HH:MM:SS" $RESULT] != -1} |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | ######################################## |
| 231 | 231 | # Test: -hide # |
| @@ -261,11 +261,11 @@ | ||
| 261 | 261 | fossil tag ls --raw $UUIDC |
| 262 | 262 | test amend-close-1.2 {[string first "closed" $RESULT] != -1} |
| 263 | 263 | fossil timeline -n 1 |
| 264 | 264 | test amend-close-1.3 {[string match {*Marked*"Closed".*} $RESULT]} |
| 265 | 265 | write_file datafile "cllf" |
| 266 | -fossil commit -m "should fail" | |
| 266 | +fossil commit -m "should fail" -expectError | |
| 267 | 267 | test amend-close-2 {[string first "closed leaf" $RESULT] != -1} |
| 268 | 268 | |
| 269 | 269 | set UUID3 UUID3 |
| 270 | 270 | fossil revert |
| 271 | 271 | fossil update trunk |
| @@ -285,11 +285,11 @@ | ||
| 285 | 285 | fossil timeline -n 1 |
| 286 | 286 | test amend-close-3.3 { |
| 287 | 287 | [string match "*Add*propagating*\"closed\".*" $RESULT] |
| 288 | 288 | } |
| 289 | 289 | write_file datafile "changed" |
| 290 | -fossil commit -m "should fail" | |
| 290 | +fossil commit -m "should fail" -expectError | |
| 291 | 291 | test amend-close-3.4 {[string first "closed leaf" $RESULT] != -1} |
| 292 | 292 | |
| 293 | 293 | ######################################## |
| 294 | 294 | # Test: -tag/-cancel # |
| 295 | 295 | ######################################## |
| @@ -399,7 +399,7 @@ | ||
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | ######################################## |
| 402 | 402 | # Test: NULL UUID # |
| 403 | 403 | ######################################## |
| 404 | -fossil amend {} -close | |
| 404 | +fossil amend {} -close -expectError | |
| 405 | 405 | test amend-null-uuid {$CODE && [string first "no such check-in" $RESULT] != -1} |
| 406 | 406 |
| --- test/amend.test | |
| +++ test/amend.test | |
| @@ -221,11 +221,11 @@ | |
| 221 | } |
| 222 | set sc 0 |
| 223 | foreach badformat $badformats { |
| 224 | incr sc |
| 225 | set datetime [clock format $timestamp -format $badformat -gmt 1] |
| 226 | fossil amend $UUIDINIT -date $datetime |
| 227 | test amend-date-2.$sc {[string first "YYYY-MM-DD HH:MM:SS" $RESULT] != -1} |
| 228 | } |
| 229 | |
| 230 | ######################################## |
| 231 | # Test: -hide # |
| @@ -261,11 +261,11 @@ | |
| 261 | fossil tag ls --raw $UUIDC |
| 262 | test amend-close-1.2 {[string first "closed" $RESULT] != -1} |
| 263 | fossil timeline -n 1 |
| 264 | test amend-close-1.3 {[string match {*Marked*"Closed".*} $RESULT]} |
| 265 | write_file datafile "cllf" |
| 266 | fossil commit -m "should fail" |
| 267 | test amend-close-2 {[string first "closed leaf" $RESULT] != -1} |
| 268 | |
| 269 | set UUID3 UUID3 |
| 270 | fossil revert |
| 271 | fossil update trunk |
| @@ -285,11 +285,11 @@ | |
| 285 | fossil timeline -n 1 |
| 286 | test amend-close-3.3 { |
| 287 | [string match "*Add*propagating*\"closed\".*" $RESULT] |
| 288 | } |
| 289 | write_file datafile "changed" |
| 290 | fossil commit -m "should fail" |
| 291 | test amend-close-3.4 {[string first "closed leaf" $RESULT] != -1} |
| 292 | |
| 293 | ######################################## |
| 294 | # Test: -tag/-cancel # |
| 295 | ######################################## |
| @@ -399,7 +399,7 @@ | |
| 399 | } |
| 400 | |
| 401 | ######################################## |
| 402 | # Test: NULL UUID # |
| 403 | ######################################## |
| 404 | fossil amend {} -close |
| 405 | test amend-null-uuid {$CODE && [string first "no such check-in" $RESULT] != -1} |
| 406 |
| --- test/amend.test | |
| +++ test/amend.test | |
| @@ -221,11 +221,11 @@ | |
| 221 | } |
| 222 | set sc 0 |
| 223 | foreach badformat $badformats { |
| 224 | incr sc |
| 225 | set datetime [clock format $timestamp -format $badformat -gmt 1] |
| 226 | fossil amend $UUIDINIT -date $datetime -expectError |
| 227 | test amend-date-2.$sc {[string first "YYYY-MM-DD HH:MM:SS" $RESULT] != -1} |
| 228 | } |
| 229 | |
| 230 | ######################################## |
| 231 | # Test: -hide # |
| @@ -261,11 +261,11 @@ | |
| 261 | fossil tag ls --raw $UUIDC |
| 262 | test amend-close-1.2 {[string first "closed" $RESULT] != -1} |
| 263 | fossil timeline -n 1 |
| 264 | test amend-close-1.3 {[string match {*Marked*"Closed".*} $RESULT]} |
| 265 | write_file datafile "cllf" |
| 266 | fossil commit -m "should fail" -expectError |
| 267 | test amend-close-2 {[string first "closed leaf" $RESULT] != -1} |
| 268 | |
| 269 | set UUID3 UUID3 |
| 270 | fossil revert |
| 271 | fossil update trunk |
| @@ -285,11 +285,11 @@ | |
| 285 | fossil timeline -n 1 |
| 286 | test amend-close-3.3 { |
| 287 | [string match "*Add*propagating*\"closed\".*" $RESULT] |
| 288 | } |
| 289 | write_file datafile "changed" |
| 290 | fossil commit -m "should fail" -expectError |
| 291 | test amend-close-3.4 {[string first "closed leaf" $RESULT] != -1} |
| 292 | |
| 293 | ######################################## |
| 294 | # Test: -tag/-cancel # |
| 295 | ######################################## |
| @@ -399,7 +399,7 @@ | |
| 399 | } |
| 400 | |
| 401 | ######################################## |
| 402 | # Test: NULL UUID # |
| 403 | ######################################## |
| 404 | fossil amend {} -close -expectError |
| 405 | test amend-null-uuid {$CODE && [string first "no such check-in" $RESULT] != -1} |
| 406 |
+3
-3
| --- test/clean.test | ||
| +++ test/clean.test | ||
| @@ -136,11 +136,11 @@ | ||
| 136 | 136 | test clean-22 {[normalize_result] eq {f2 |
| 137 | 137 | f4}} |
| 138 | 138 | |
| 139 | 139 | ############################################################################### |
| 140 | 140 | |
| 141 | -fossil undo | |
| 141 | +fossil undo -expectError | |
| 142 | 142 | test clean-23 {[normalize_result] eq {nothing to undo}} |
| 143 | 143 | |
| 144 | 144 | ############################################################################### |
| 145 | 145 | |
| 146 | 146 | # clean w/undo disabled, force, 1 file < 10MiB, 1 file > 10MiB |
| @@ -152,11 +152,11 @@ | ||
| 152 | 152 | fossil extra |
| 153 | 153 | test clean-25 {[normalize_result] eq {}} |
| 154 | 154 | |
| 155 | 155 | ############################################################################### |
| 156 | 156 | |
| 157 | -fossil undo | |
| 157 | +fossil undo -expectError | |
| 158 | 158 | test clean-26 {[normalize_result] eq {nothing to undo}} |
| 159 | 159 | |
| 160 | 160 | ############################################################################### |
| 161 | 161 | |
| 162 | 162 | write_file f5 "f5 line" |
| @@ -178,12 +178,12 @@ | ||
| 178 | 178 | fossil extra |
| 179 | 179 | test clean-29 {[normalize_result] eq {}} |
| 180 | 180 | |
| 181 | 181 | ############################################################################### |
| 182 | 182 | |
| 183 | -fossil undo | |
| 183 | +fossil undo -expectError | |
| 184 | 184 | test clean-30 {[normalize_result] eq {nothing to undo}} |
| 185 | 185 | |
| 186 | 186 | ############################################################################### |
| 187 | 187 | |
| 188 | 188 | fossil extra |
| 189 | 189 | test clean-31 {[normalize_result] eq {}} |
| 190 | 190 | |
| 191 | 191 | ADDED test/json.test |
| --- test/clean.test | |
| +++ test/clean.test | |
| @@ -136,11 +136,11 @@ | |
| 136 | test clean-22 {[normalize_result] eq {f2 |
| 137 | f4}} |
| 138 | |
| 139 | ############################################################################### |
| 140 | |
| 141 | fossil undo |
| 142 | test clean-23 {[normalize_result] eq {nothing to undo}} |
| 143 | |
| 144 | ############################################################################### |
| 145 | |
| 146 | # clean w/undo disabled, force, 1 file < 10MiB, 1 file > 10MiB |
| @@ -152,11 +152,11 @@ | |
| 152 | fossil extra |
| 153 | test clean-25 {[normalize_result] eq {}} |
| 154 | |
| 155 | ############################################################################### |
| 156 | |
| 157 | fossil undo |
| 158 | test clean-26 {[normalize_result] eq {nothing to undo}} |
| 159 | |
| 160 | ############################################################################### |
| 161 | |
| 162 | write_file f5 "f5 line" |
| @@ -178,12 +178,12 @@ | |
| 178 | fossil extra |
| 179 | test clean-29 {[normalize_result] eq {}} |
| 180 | |
| 181 | ############################################################################### |
| 182 | |
| 183 | fossil undo |
| 184 | test clean-30 {[normalize_result] eq {nothing to undo}} |
| 185 | |
| 186 | ############################################################################### |
| 187 | |
| 188 | fossil extra |
| 189 | test clean-31 {[normalize_result] eq {}} |
| 190 | |
| 191 | DDED test/json.test |
| --- test/clean.test | |
| +++ test/clean.test | |
| @@ -136,11 +136,11 @@ | |
| 136 | test clean-22 {[normalize_result] eq {f2 |
| 137 | f4}} |
| 138 | |
| 139 | ############################################################################### |
| 140 | |
| 141 | fossil undo -expectError |
| 142 | test clean-23 {[normalize_result] eq {nothing to undo}} |
| 143 | |
| 144 | ############################################################################### |
| 145 | |
| 146 | # clean w/undo disabled, force, 1 file < 10MiB, 1 file > 10MiB |
| @@ -152,11 +152,11 @@ | |
| 152 | fossil extra |
| 153 | test clean-25 {[normalize_result] eq {}} |
| 154 | |
| 155 | ############################################################################### |
| 156 | |
| 157 | fossil undo -expectError |
| 158 | test clean-26 {[normalize_result] eq {nothing to undo}} |
| 159 | |
| 160 | ############################################################################### |
| 161 | |
| 162 | write_file f5 "f5 line" |
| @@ -178,12 +178,12 @@ | |
| 178 | fossil extra |
| 179 | test clean-29 {[normalize_result] eq {}} |
| 180 | |
| 181 | ############################################################################### |
| 182 | |
| 183 | fossil undo -expectError |
| 184 | test clean-30 {[normalize_result] eq {nothing to undo}} |
| 185 | |
| 186 | ############################################################################### |
| 187 | |
| 188 | fossil extra |
| 189 | test clean-31 {[normalize_result] eq {}} |
| 190 | |
| 191 | DDED test/json.test |
+43
| --- a/test/json.test | ||
| +++ b/test/json.test | ||
| @@ -0,0 +1,43 @@ | ||
| 1 | +# | |
| 2 | +env-RC-1102env#write_file bad.sql { | |
| 3 | +##} | |
| 4 | +##1102# | |
| 5 | +# Co#. What about Win?timeline/checkin $U1Cookie1 {$CODE =11http-timeline# | |
| 6 | +# Cotimeline/checkin $U1Cookie knownBughttp-timeline2 | |
| 7 | +# | |
| 8 | +# Co | |
| 9 | +env-RC-1102env#write_file bad.sql { | |
| 10 | +##} | |
| 11 | +##1102# | |
| 12 | +# Co#. What about Win?timeline/checkin $U1Cookie1 {$CODE =11http-timeline# | |
| 13 | +# Cotimeline/checkin $U1Cookie knownBughttp-timeline2 | |
| 14 | +# | |
| 15 | +# CoC} | |
| 16 | +$::RESULT; ; repo_initrepo_initsqlite3 bad.fossil <bad.sql | |
| 17 | +#. What about Win?help -a | |
| 18 | +if {[stri (fossil help -a) | |
| 19 | + v-RC-1102env#write_file bad.e_file bad.sql { | |
| 20 | +##} | |
| 21 | +##1102# | |
| 22 | +# Co#. What about Win?timeline/checkin $U1Cookie1 {$CODE =11http-timeline# | |
| 23 | +# Cotimeline/checkin $U1Cookie knownBughttp-timeline2 | |
| 24 | +# | |
| 25 | +# Co | |
| 26 | +env-RC-1102env#write_file bad.sql { | |
| 27 | +##} | |
| 28 | +##1102# | |
| 29 | +# Co#. What about Win?timeline/checkin $U1Cookie1 {$CODE =11http-timeline# | |
| 30 | +# Cotimeline/checkin $U1Cookie knownBughttp-timeline2 | |
| 31 | +# | |
| 32 | +."; return | |
| 33 | +}if {$RESULTset JR [::json::RC-1102env#write_file bad.sql e bad.sql { | |
| 34 | +##} | |
| 35 | +##1102# | |
| 36 | +# Co#. What about Win?timeline/checkin $U1Cookie1 {$CODE =11http-timeline# | |
| 37 | +# Cotimeline/checkin $U1Cookie knownBughttp-timeline2 | |
| 38 | +# | |
| 39 | +# Co | |
| 40 | +env-RC-1102env#write_file bad.sql { | |
| 41 | +##} | |
| 42 | +##1102# | |
| 43 | +# Co#. What about Win?timeline/checkin $U1Cookie1 {$CODE =11h::json::::json::::json:: knownBug |
| --- a/test/json.test | |
| +++ b/test/json.test | |
| @@ -0,0 +1,43 @@ | |
| --- a/test/json.test | |
| +++ b/test/json.test | |
| @@ -0,0 +1,43 @@ | |
| 1 | # |
| 2 | env-RC-1102env#write_file bad.sql { |
| 3 | ##} |
| 4 | ##1102# |
| 5 | # Co#. What about Win?timeline/checkin $U1Cookie1 {$CODE =11http-timeline# |
| 6 | # Cotimeline/checkin $U1Cookie knownBughttp-timeline2 |
| 7 | # |
| 8 | # Co |
| 9 | env-RC-1102env#write_file bad.sql { |
| 10 | ##} |
| 11 | ##1102# |
| 12 | # Co#. What about Win?timeline/checkin $U1Cookie1 {$CODE =11http-timeline# |
| 13 | # Cotimeline/checkin $U1Cookie knownBughttp-timeline2 |
| 14 | # |
| 15 | # CoC} |
| 16 | $::RESULT; ; repo_initrepo_initsqlite3 bad.fossil <bad.sql |
| 17 | #. What about Win?help -a |
| 18 | if {[stri (fossil help -a) |
| 19 | v-RC-1102env#write_file bad.e_file bad.sql { |
| 20 | ##} |
| 21 | ##1102# |
| 22 | # Co#. What about Win?timeline/checkin $U1Cookie1 {$CODE =11http-timeline# |
| 23 | # Cotimeline/checkin $U1Cookie knownBughttp-timeline2 |
| 24 | # |
| 25 | # Co |
| 26 | env-RC-1102env#write_file bad.sql { |
| 27 | ##} |
| 28 | ##1102# |
| 29 | # Co#. What about Win?timeline/checkin $U1Cookie1 {$CODE =11http-timeline# |
| 30 | # Cotimeline/checkin $U1Cookie knownBughttp-timeline2 |
| 31 | # |
| 32 | ."; return |
| 33 | }if {$RESULTset JR [::json::RC-1102env#write_file bad.sql e bad.sql { |
| 34 | ##} |
| 35 | ##1102# |
| 36 | # Co#. What about Win?timeline/checkin $U1Cookie1 {$CODE =11http-timeline# |
| 37 | # Cotimeline/checkin $U1Cookie knownBughttp-timeline2 |
| 38 | # |
| 39 | # Co |
| 40 | env-RC-1102env#write_file bad.sql { |
| 41 | ##} |
| 42 | ##1102# |
| 43 | # Co#. What about Win?timeline/checkin $U1Cookie1 {$CODE =11h::json::::json::::json:: knownBug |
+2
-2
| --- test/merge5.test | ||
| +++ test/merge5.test | ||
| @@ -222,11 +222,11 @@ | ||
| 222 | 222 | 35815cf5804e8933eab64ae34e00bbb381be72c5 four.txt |
| 223 | 223 | da5c8346496f3421cb58f84b6e59e9531d9d424d one.txt |
| 224 | 224 | ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt |
| 225 | 225 | 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt |
| 226 | 226 | } |
| 227 | -fossil merge br4 | |
| 227 | +fossil merge br4 -expectError | |
| 228 | 228 | checkout-test 121 { |
| 229 | 229 | 35815cf5804e8933eab64ae34e00bbb381be72c5 four.txt |
| 230 | 230 | ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt |
| 231 | 231 | 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt |
| 232 | 232 | } |
| @@ -235,11 +235,11 @@ | ||
| 235 | 235 | checkout-test 122 { |
| 236 | 236 | 6e167b139c294bed560e2e30b352361b101e1f39 four.txt |
| 237 | 237 | ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt |
| 238 | 238 | 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt |
| 239 | 239 | } |
| 240 | -fossil merge br1 | |
| 240 | +fossil merge br1 -expectError | |
| 241 | 241 | checkout-test 123 { |
| 242 | 242 | 6e167b139c294bed560e2e30b352361b101e1f39 four.txt |
| 243 | 243 | ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt |
| 244 | 244 | 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt |
| 245 | 245 | } |
| 246 | 246 |
| --- test/merge5.test | |
| +++ test/merge5.test | |
| @@ -222,11 +222,11 @@ | |
| 222 | 35815cf5804e8933eab64ae34e00bbb381be72c5 four.txt |
| 223 | da5c8346496f3421cb58f84b6e59e9531d9d424d one.txt |
| 224 | ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt |
| 225 | 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt |
| 226 | } |
| 227 | fossil merge br4 |
| 228 | checkout-test 121 { |
| 229 | 35815cf5804e8933eab64ae34e00bbb381be72c5 four.txt |
| 230 | ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt |
| 231 | 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt |
| 232 | } |
| @@ -235,11 +235,11 @@ | |
| 235 | checkout-test 122 { |
| 236 | 6e167b139c294bed560e2e30b352361b101e1f39 four.txt |
| 237 | ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt |
| 238 | 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt |
| 239 | } |
| 240 | fossil merge br1 |
| 241 | checkout-test 123 { |
| 242 | 6e167b139c294bed560e2e30b352361b101e1f39 four.txt |
| 243 | ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt |
| 244 | 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt |
| 245 | } |
| 246 |
| --- test/merge5.test | |
| +++ test/merge5.test | |
| @@ -222,11 +222,11 @@ | |
| 222 | 35815cf5804e8933eab64ae34e00bbb381be72c5 four.txt |
| 223 | da5c8346496f3421cb58f84b6e59e9531d9d424d one.txt |
| 224 | ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt |
| 225 | 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt |
| 226 | } |
| 227 | fossil merge br4 -expectError |
| 228 | checkout-test 121 { |
| 229 | 35815cf5804e8933eab64ae34e00bbb381be72c5 four.txt |
| 230 | ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt |
| 231 | 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt |
| 232 | } |
| @@ -235,11 +235,11 @@ | |
| 235 | checkout-test 122 { |
| 236 | 6e167b139c294bed560e2e30b352361b101e1f39 four.txt |
| 237 | ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt |
| 238 | 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt |
| 239 | } |
| 240 | fossil merge br1 -expectError |
| 241 | checkout-test 123 { |
| 242 | 6e167b139c294bed560e2e30b352361b101e1f39 four.txt |
| 243 | ed24d19d726d173f18dbf4a9a0f8514daa3e3ca4 three.txt |
| 244 | 278a402316510f6ae4a77186796a6bde78c7dbc1 two.txt |
| 245 | } |
| 246 |
+7
-1
| --- test/tester.tcl | ||
| +++ test/tester.tcl | ||
| @@ -127,27 +127,33 @@ | ||
| 127 | 127 | # test expressions. |
| 128 | 128 | # |
| 129 | 129 | proc fossil_maybe_answer {answer args} { |
| 130 | 130 | global fossilexe |
| 131 | 131 | set cmd $fossilexe |
| 132 | + set expectError 0 | |
| 133 | + if {[lindex $args end] eq "-expectError"} { | |
| 134 | + set expectError 1 | |
| 135 | + set args [lrange $args 0 end-1] | |
| 136 | + } | |
| 132 | 137 | foreach a $args { |
| 133 | 138 | lappend cmd $a |
| 134 | 139 | } |
| 135 | 140 | protOut $cmd |
| 136 | 141 | |
| 137 | 142 | flush stdout |
| 138 | 143 | if {[string length $answer] > 0} { |
| 144 | + protOut $answer | |
| 139 | 145 | set prompt_file [file join $::tempPath fossil_prompt_answer] |
| 140 | 146 | write_file $prompt_file $answer\n |
| 141 | 147 | set rc [catch {eval exec $cmd <$prompt_file} result] |
| 142 | 148 | file delete $prompt_file |
| 143 | 149 | } else { |
| 144 | 150 | set rc [catch {eval exec $cmd} result] |
| 145 | 151 | } |
| 146 | 152 | global RESULT CODE |
| 147 | 153 | set CODE $rc |
| 148 | - if {$rc} { | |
| 154 | + if {($rc && !$expectError) || (!$rc && $expectError)} { | |
| 149 | 155 | protOut "ERROR: $result" 1 |
| 150 | 156 | } elseif {$::VERBOSE} { |
| 151 | 157 | protOut "RESULT: $result" |
| 152 | 158 | } |
| 153 | 159 | set RESULT $result |
| 154 | 160 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -127,27 +127,33 @@ | |
| 127 | # test expressions. |
| 128 | # |
| 129 | proc fossil_maybe_answer {answer args} { |
| 130 | global fossilexe |
| 131 | set cmd $fossilexe |
| 132 | foreach a $args { |
| 133 | lappend cmd $a |
| 134 | } |
| 135 | protOut $cmd |
| 136 | |
| 137 | flush stdout |
| 138 | if {[string length $answer] > 0} { |
| 139 | set prompt_file [file join $::tempPath fossil_prompt_answer] |
| 140 | write_file $prompt_file $answer\n |
| 141 | set rc [catch {eval exec $cmd <$prompt_file} result] |
| 142 | file delete $prompt_file |
| 143 | } else { |
| 144 | set rc [catch {eval exec $cmd} result] |
| 145 | } |
| 146 | global RESULT CODE |
| 147 | set CODE $rc |
| 148 | if {$rc} { |
| 149 | protOut "ERROR: $result" 1 |
| 150 | } elseif {$::VERBOSE} { |
| 151 | protOut "RESULT: $result" |
| 152 | } |
| 153 | set RESULT $result |
| 154 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -127,27 +127,33 @@ | |
| 127 | # test expressions. |
| 128 | # |
| 129 | proc fossil_maybe_answer {answer args} { |
| 130 | global fossilexe |
| 131 | set cmd $fossilexe |
| 132 | set expectError 0 |
| 133 | if {[lindex $args end] eq "-expectError"} { |
| 134 | set expectError 1 |
| 135 | set args [lrange $args 0 end-1] |
| 136 | } |
| 137 | foreach a $args { |
| 138 | lappend cmd $a |
| 139 | } |
| 140 | protOut $cmd |
| 141 | |
| 142 | flush stdout |
| 143 | if {[string length $answer] > 0} { |
| 144 | protOut $answer |
| 145 | set prompt_file [file join $::tempPath fossil_prompt_answer] |
| 146 | write_file $prompt_file $answer\n |
| 147 | set rc [catch {eval exec $cmd <$prompt_file} result] |
| 148 | file delete $prompt_file |
| 149 | } else { |
| 150 | set rc [catch {eval exec $cmd} result] |
| 151 | } |
| 152 | global RESULT CODE |
| 153 | set CODE $rc |
| 154 | if {($rc && !$expectError) || (!$rc && $expectError)} { |
| 155 | protOut "ERROR: $result" 1 |
| 156 | } elseif {$::VERBOSE} { |
| 157 | protOut "RESULT: $result" |
| 158 | } |
| 159 | set RESULT $result |
| 160 |
+28
-30
| --- test/th1.test | ||
| +++ test/th1.test | ||
| @@ -913,64 +913,62 @@ | ||
| 913 | 913 | test th1-reinitialize-2 {$RESULT ne ""} |
| 914 | 914 | |
| 915 | 915 | ############################################################################### |
| 916 | 916 | |
| 917 | 917 | # |
| 918 | -# NOTE: This test may fail if the command names do not always come out in a | |
| 919 | -# deterministic order from TH1. | |
| 918 | +# NOTE: This test will fail if the command names are added to TH1, or | |
| 919 | +# moved from Tcl builds to plain or the reverse. Sorting the | |
| 920 | +# command lists eliminates a dependence on order. | |
| 920 | 921 | # |
| 921 | 922 | fossil test-th-eval "info commands" |
| 922 | - | |
| 923 | +set sorted_result [lsort $RESULT] | |
| 924 | +protOut "Sorted: $sorted_result" | |
| 925 | +set base_commands {anoncap anycap array artifact break breakpoint catch\ | |
| 926 | + checkout combobox continue date decorate dir enable_output encode64\ | |
| 927 | + error expr for getParameter glob_match globalState hascap hasfeature\ | |
| 928 | + html htmlize http httpize if info insertCsrf lindex linecount list\ | |
| 929 | + llength lsearch markdown proc puts query randhex redirect regexp\ | |
| 930 | + reinitialize rename render repository return searchable set\ | |
| 931 | + setParameter setting stime string styleFooter styleHeader tclReady\ | |
| 932 | + trace unset uplevel upvar utime verifyCsrf wiki} | |
| 933 | +set tcl_commands {tclEval tclExpr tclInvoke tclIsSafe tclMakeSafe} | |
| 923 | 934 | if {$th1Tcl} { |
| 924 | - test th1-info-commands-1 {$RESULT eq {linecount htmlize date stime\ | |
| 925 | - enable_output uplevel dir http expr glob_match utime styleFooter encode64\ | |
| 926 | - catch if tclReady searchable reinitialize combobox lindex tclIsSafe query\ | |
| 927 | - html anoncap randhex llength for set break regexp markdown styleHeader\ | |
| 928 | - puts return checkout decorate artifact trace wiki proc tclInvoke hascap\ | |
| 929 | - globalState continue getParameter hasfeature setting lsearch breakpoint\ | |
| 930 | - upvar render repository string unset setParameter list error info rename\ | |
| 931 | - tclExpr array anycap tclEval httpize tclMakeSafe}} | |
| 935 | + test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands $tcl_commands"]} | |
| 932 | 936 | } else { |
| 933 | - test th1-info-commands-1 {$RESULT eq {linecount htmlize date stime\ | |
| 934 | - enable_output uplevel dir http expr glob_match utime styleFooter encode64\ | |
| 935 | - catch if tclReady searchable reinitialize combobox lindex query html\ | |
| 936 | - anoncap randhex llength for set break regexp markdown styleHeader puts\ | |
| 937 | - return checkout decorate artifact trace wiki proc hascap globalState\ | |
| 938 | - continue getParameter hasfeature setting lsearch breakpoint upvar render\ | |
| 939 | - repository string unset setParameter list error info rename array anycap\ | |
| 940 | - httpize}} | |
| 941 | -} | |
| 937 | + test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands"]} | |
| 938 | +} | |
| 939 | + | |
| 942 | 940 | |
| 943 | 941 | ############################################################################### |
| 944 | 942 | |
| 945 | 943 | fossil test-th-eval "info vars" |
| 946 | 944 | |
| 947 | 945 | if {$th1Hooks} { |
| 948 | - test th1-info-vars-1 {$RESULT eq \ | |
| 949 | - "th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"} | |
| 946 | + test th1-info-vars-1 {[lsort $RESULT] eq \ | |
| 947 | + [lsort "th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"]} | |
| 950 | 948 | } else { |
| 951 | 949 | test th1-info-vars-1 {$RESULT eq "tcl_platform"} |
| 952 | 950 | } |
| 953 | 951 | |
| 954 | 952 | ############################################################################### |
| 955 | 953 | |
| 956 | 954 | fossil test-th-eval "set x 1; info vars" |
| 957 | 955 | |
| 958 | 956 | if {$th1Hooks} { |
| 959 | - test th1-info-vars-2 {$RESULT eq \ | |
| 960 | - "x th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"} | |
| 957 | + test th1-info-vars-2 {[lsort $RESULT] eq \ | |
| 958 | + [lsort "x th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"]} | |
| 961 | 959 | } else { |
| 962 | - test th1-info-vars-2 {$RESULT eq "x tcl_platform"} | |
| 960 | + test th1-info-vars-2 {[lsort $RESULT] eq [lsort "x tcl_platform"]} | |
| 963 | 961 | } |
| 964 | 962 | |
| 965 | 963 | ############################################################################### |
| 966 | 964 | |
| 967 | 965 | fossil test-th-eval "set x 1; unset x; info vars" |
| 968 | 966 | |
| 969 | 967 | if {$th1Hooks} { |
| 970 | - test th1-info-vars-3 {$RESULT eq \ | |
| 971 | - "th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"} | |
| 968 | + test th1-info-vars-3 {[lsort $RESULT] eq \ | |
| 969 | + [lsort "th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"]} | |
| 972 | 970 | } else { |
| 973 | 971 | test th1-info-vars-3 {$RESULT eq "tcl_platform"} |
| 974 | 972 | } |
| 975 | 973 | |
| 976 | 974 | ############################################################################### |
| @@ -981,14 +979,14 @@ | ||
| 981 | 979 | ############################################################################### |
| 982 | 980 | |
| 983 | 981 | fossil test-th-eval "set y 1; proc foo {} {set x 1; uplevel 1 {info vars}}; foo" |
| 984 | 982 | |
| 985 | 983 | if {$th1Hooks} { |
| 986 | - test th1-info-vars-5 {$RESULT eq \ | |
| 987 | - "th_stack_trace y cmd_flags tcl_platform cmd_name cmd_args"} | |
| 984 | + test th1-info-vars-5 {[lsort $RESULT] eq \ | |
| 985 | + [lsort "th_stack_trace y cmd_flags tcl_platform cmd_name cmd_args"]} | |
| 988 | 986 | } else { |
| 989 | - test th1-info-vars-5 {$RESULT eq "y tcl_platform"} | |
| 987 | + test th1-info-vars-5 {[lsort $RESULT] eq [lsort "y tcl_platform"]} | |
| 990 | 988 | } |
| 991 | 989 | |
| 992 | 990 | ############################################################################### |
| 993 | 991 | |
| 994 | 992 | fossil test-th-eval "array exists foo" |
| 995 | 993 |
| --- test/th1.test | |
| +++ test/th1.test | |
| @@ -913,64 +913,62 @@ | |
| 913 | test th1-reinitialize-2 {$RESULT ne ""} |
| 914 | |
| 915 | ############################################################################### |
| 916 | |
| 917 | # |
| 918 | # NOTE: This test may fail if the command names do not always come out in a |
| 919 | # deterministic order from TH1. |
| 920 | # |
| 921 | fossil test-th-eval "info commands" |
| 922 | |
| 923 | if {$th1Tcl} { |
| 924 | test th1-info-commands-1 {$RESULT eq {linecount htmlize date stime\ |
| 925 | enable_output uplevel dir http expr glob_match utime styleFooter encode64\ |
| 926 | catch if tclReady searchable reinitialize combobox lindex tclIsSafe query\ |
| 927 | html anoncap randhex llength for set break regexp markdown styleHeader\ |
| 928 | puts return checkout decorate artifact trace wiki proc tclInvoke hascap\ |
| 929 | globalState continue getParameter hasfeature setting lsearch breakpoint\ |
| 930 | upvar render repository string unset setParameter list error info rename\ |
| 931 | tclExpr array anycap tclEval httpize tclMakeSafe}} |
| 932 | } else { |
| 933 | test th1-info-commands-1 {$RESULT eq {linecount htmlize date stime\ |
| 934 | enable_output uplevel dir http expr glob_match utime styleFooter encode64\ |
| 935 | catch if tclReady searchable reinitialize combobox lindex query html\ |
| 936 | anoncap randhex llength for set break regexp markdown styleHeader puts\ |
| 937 | return checkout decorate artifact trace wiki proc hascap globalState\ |
| 938 | continue getParameter hasfeature setting lsearch breakpoint upvar render\ |
| 939 | repository string unset setParameter list error info rename array anycap\ |
| 940 | httpize}} |
| 941 | } |
| 942 | |
| 943 | ############################################################################### |
| 944 | |
| 945 | fossil test-th-eval "info vars" |
| 946 | |
| 947 | if {$th1Hooks} { |
| 948 | test th1-info-vars-1 {$RESULT eq \ |
| 949 | "th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"} |
| 950 | } else { |
| 951 | test th1-info-vars-1 {$RESULT eq "tcl_platform"} |
| 952 | } |
| 953 | |
| 954 | ############################################################################### |
| 955 | |
| 956 | fossil test-th-eval "set x 1; info vars" |
| 957 | |
| 958 | if {$th1Hooks} { |
| 959 | test th1-info-vars-2 {$RESULT eq \ |
| 960 | "x th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"} |
| 961 | } else { |
| 962 | test th1-info-vars-2 {$RESULT eq "x tcl_platform"} |
| 963 | } |
| 964 | |
| 965 | ############################################################################### |
| 966 | |
| 967 | fossil test-th-eval "set x 1; unset x; info vars" |
| 968 | |
| 969 | if {$th1Hooks} { |
| 970 | test th1-info-vars-3 {$RESULT eq \ |
| 971 | "th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"} |
| 972 | } else { |
| 973 | test th1-info-vars-3 {$RESULT eq "tcl_platform"} |
| 974 | } |
| 975 | |
| 976 | ############################################################################### |
| @@ -981,14 +979,14 @@ | |
| 981 | ############################################################################### |
| 982 | |
| 983 | fossil test-th-eval "set y 1; proc foo {} {set x 1; uplevel 1 {info vars}}; foo" |
| 984 | |
| 985 | if {$th1Hooks} { |
| 986 | test th1-info-vars-5 {$RESULT eq \ |
| 987 | "th_stack_trace y cmd_flags tcl_platform cmd_name cmd_args"} |
| 988 | } else { |
| 989 | test th1-info-vars-5 {$RESULT eq "y tcl_platform"} |
| 990 | } |
| 991 | |
| 992 | ############################################################################### |
| 993 | |
| 994 | fossil test-th-eval "array exists foo" |
| 995 |
| --- test/th1.test | |
| +++ test/th1.test | |
| @@ -913,64 +913,62 @@ | |
| 913 | test th1-reinitialize-2 {$RESULT ne ""} |
| 914 | |
| 915 | ############################################################################### |
| 916 | |
| 917 | # |
| 918 | # NOTE: This test will fail if the command names are added to TH1, or |
| 919 | # moved from Tcl builds to plain or the reverse. Sorting the |
| 920 | # command lists eliminates a dependence on order. |
| 921 | # |
| 922 | fossil test-th-eval "info commands" |
| 923 | set sorted_result [lsort $RESULT] |
| 924 | protOut "Sorted: $sorted_result" |
| 925 | set base_commands {anoncap anycap array artifact break breakpoint catch\ |
| 926 | checkout combobox continue date decorate dir enable_output encode64\ |
| 927 | error expr for getParameter glob_match globalState hascap hasfeature\ |
| 928 | html htmlize http httpize if info insertCsrf lindex linecount list\ |
| 929 | llength lsearch markdown proc puts query randhex redirect regexp\ |
| 930 | reinitialize rename render repository return searchable set\ |
| 931 | setParameter setting stime string styleFooter styleHeader tclReady\ |
| 932 | trace unset uplevel upvar utime verifyCsrf wiki} |
| 933 | set tcl_commands {tclEval tclExpr tclInvoke tclIsSafe tclMakeSafe} |
| 934 | if {$th1Tcl} { |
| 935 | test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands $tcl_commands"]} |
| 936 | } else { |
| 937 | test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands"]} |
| 938 | } |
| 939 | |
| 940 | |
| 941 | ############################################################################### |
| 942 | |
| 943 | fossil test-th-eval "info vars" |
| 944 | |
| 945 | if {$th1Hooks} { |
| 946 | test th1-info-vars-1 {[lsort $RESULT] eq \ |
| 947 | [lsort "th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"]} |
| 948 | } else { |
| 949 | test th1-info-vars-1 {$RESULT eq "tcl_platform"} |
| 950 | } |
| 951 | |
| 952 | ############################################################################### |
| 953 | |
| 954 | fossil test-th-eval "set x 1; info vars" |
| 955 | |
| 956 | if {$th1Hooks} { |
| 957 | test th1-info-vars-2 {[lsort $RESULT] eq \ |
| 958 | [lsort "x th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"]} |
| 959 | } else { |
| 960 | test th1-info-vars-2 {[lsort $RESULT] eq [lsort "x tcl_platform"]} |
| 961 | } |
| 962 | |
| 963 | ############################################################################### |
| 964 | |
| 965 | fossil test-th-eval "set x 1; unset x; info vars" |
| 966 | |
| 967 | if {$th1Hooks} { |
| 968 | test th1-info-vars-3 {[lsort $RESULT] eq \ |
| 969 | [lsort "th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"]} |
| 970 | } else { |
| 971 | test th1-info-vars-3 {$RESULT eq "tcl_platform"} |
| 972 | } |
| 973 | |
| 974 | ############################################################################### |
| @@ -981,14 +979,14 @@ | |
| 979 | ############################################################################### |
| 980 | |
| 981 | fossil test-th-eval "set y 1; proc foo {} {set x 1; uplevel 1 {info vars}}; foo" |
| 982 | |
| 983 | if {$th1Hooks} { |
| 984 | test th1-info-vars-5 {[lsort $RESULT] eq \ |
| 985 | [lsort "th_stack_trace y cmd_flags tcl_platform cmd_name cmd_args"]} |
| 986 | } else { |
| 987 | test th1-info-vars-5 {[lsort $RESULT] eq [lsort "y tcl_platform"]} |
| 988 | } |
| 989 | |
| 990 | ############################################################################### |
| 991 | |
| 992 | fossil test-th-eval "array exists foo" |
| 993 |