Fossil SCM
The changes in [b045d0774ed48936] are too far reaching. Instead, add a -keepNewline option and use it where appropriate.
Commit
561402f2e08045d8e47cdd02ef5bb569dd41356b
Parent
3604802d553e502…
6 files changed
+1
-1
+19
-4
+2
-2
+1
-1
+1
-1
+1
-1
+1
-1
| --- test/json.test | ||
| +++ test/json.test | ||
| @@ -23,11 +23,11 @@ | ||
| 23 | 23 | # practice of eliminating all trace of the fossil json command when |
| 24 | 24 | # not configured. If that changes, these conditions might not prevent |
| 25 | 25 | # the rest of this file from running. |
| 26 | 26 | fossil test-th-eval "hasfeature json" |
| 27 | 27 | |
| 28 | -if {$::RESULT ne "1"} then { | |
| 28 | +if {[normalize_result] ne "1"} then { | |
| 29 | 29 | puts "Fossil was not compiled with JSON support." |
| 30 | 30 | test_cleanup_then_return |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | # We need a JSON parser to effectively test the JSON produced by |
| 34 | 34 |
| --- test/json.test | |
| +++ test/json.test | |
| @@ -23,11 +23,11 @@ | |
| 23 | # practice of eliminating all trace of the fossil json command when |
| 24 | # not configured. If that changes, these conditions might not prevent |
| 25 | # the rest of this file from running. |
| 26 | fossil test-th-eval "hasfeature json" |
| 27 | |
| 28 | if {$::RESULT ne "1"} then { |
| 29 | puts "Fossil was not compiled with JSON support." |
| 30 | test_cleanup_then_return |
| 31 | } |
| 32 | |
| 33 | # We need a JSON parser to effectively test the JSON produced by |
| 34 |
| --- test/json.test | |
| +++ test/json.test | |
| @@ -23,11 +23,11 @@ | |
| 23 | # practice of eliminating all trace of the fossil json command when |
| 24 | # not configured. If that changes, these conditions might not prevent |
| 25 | # the rest of this file from running. |
| 26 | fossil test-th-eval "hasfeature json" |
| 27 | |
| 28 | if {[normalize_result] ne "1"} then { |
| 29 | puts "Fossil was not compiled with JSON support." |
| 30 | test_cleanup_then_return |
| 31 | } |
| 32 | |
| 33 | # We need a JSON parser to effectively test the JSON produced by |
| 34 |
+19
-4
| --- test/tester.tcl | ||
| +++ test/tester.tcl | ||
| @@ -136,13 +136,20 @@ | ||
| 136 | 136 | # |
| 137 | 137 | proc fossil_maybe_answer {answer args} { |
| 138 | 138 | global fossilexe |
| 139 | 139 | set cmd $fossilexe |
| 140 | 140 | set expectError 0 |
| 141 | - if {[lindex $args end] eq "-expectError"} { | |
| 141 | + set index [lsearch -exact $args -expectError] | |
| 142 | + if {$index != -1} { | |
| 142 | 143 | set expectError 1 |
| 143 | - set args [lrange $args 0 end-1] | |
| 144 | + set args [lreplace $args $index $index] | |
| 145 | + } | |
| 146 | + set keepNewline 0 | |
| 147 | + set index [lsearch -exact $args -keepNewline] | |
| 148 | + if {$index != -1} { | |
| 149 | + set keepNewline 1 | |
| 150 | + set args [lreplace $args $index $index] | |
| 144 | 151 | } |
| 145 | 152 | foreach a $args { |
| 146 | 153 | lappend cmd $a |
| 147 | 154 | } |
| 148 | 155 | protOut $cmd |
| @@ -150,14 +157,22 @@ | ||
| 150 | 157 | flush stdout |
| 151 | 158 | if {[string length $answer] > 0} { |
| 152 | 159 | protOut $answer |
| 153 | 160 | set prompt_file [file join $::tempPath fossil_prompt_answer] |
| 154 | 161 | write_file $prompt_file $answer\n |
| 155 | - set rc [catch {eval exec -keepnewline $cmd <$prompt_file} result] | |
| 162 | + if {$keepNewline} { | |
| 163 | + set rc [catch {eval exec -keepnewline $cmd <$prompt_file} result] | |
| 164 | + } else { | |
| 165 | + set rc [catch {eval exec $cmd <$prompt_file} result] | |
| 166 | + } | |
| 156 | 167 | file delete $prompt_file |
| 157 | 168 | } else { |
| 158 | - set rc [catch {eval exec -keepnewline $cmd} result] | |
| 169 | + if {$keepNewline} { | |
| 170 | + set rc [catch {eval exec -keepnewline $cmd} result] | |
| 171 | + } else { | |
| 172 | + set rc [catch {eval exec $cmd} result] | |
| 173 | + } | |
| 159 | 174 | } |
| 160 | 175 | global RESULT CODE |
| 161 | 176 | set CODE $rc |
| 162 | 177 | if {($rc && !$expectError) || (!$rc && $expectError)} { |
| 163 | 178 | protOut "ERROR: $result" 1 |
| 164 | 179 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -136,13 +136,20 @@ | |
| 136 | # |
| 137 | proc fossil_maybe_answer {answer args} { |
| 138 | global fossilexe |
| 139 | set cmd $fossilexe |
| 140 | set expectError 0 |
| 141 | if {[lindex $args end] eq "-expectError"} { |
| 142 | set expectError 1 |
| 143 | set args [lrange $args 0 end-1] |
| 144 | } |
| 145 | foreach a $args { |
| 146 | lappend cmd $a |
| 147 | } |
| 148 | protOut $cmd |
| @@ -150,14 +157,22 @@ | |
| 150 | flush stdout |
| 151 | if {[string length $answer] > 0} { |
| 152 | protOut $answer |
| 153 | set prompt_file [file join $::tempPath fossil_prompt_answer] |
| 154 | write_file $prompt_file $answer\n |
| 155 | set rc [catch {eval exec -keepnewline $cmd <$prompt_file} result] |
| 156 | file delete $prompt_file |
| 157 | } else { |
| 158 | set rc [catch {eval exec -keepnewline $cmd} result] |
| 159 | } |
| 160 | global RESULT CODE |
| 161 | set CODE $rc |
| 162 | if {($rc && !$expectError) || (!$rc && $expectError)} { |
| 163 | protOut "ERROR: $result" 1 |
| 164 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -136,13 +136,20 @@ | |
| 136 | # |
| 137 | proc fossil_maybe_answer {answer args} { |
| 138 | global fossilexe |
| 139 | set cmd $fossilexe |
| 140 | set expectError 0 |
| 141 | set index [lsearch -exact $args -expectError] |
| 142 | if {$index != -1} { |
| 143 | set expectError 1 |
| 144 | set args [lreplace $args $index $index] |
| 145 | } |
| 146 | set keepNewline 0 |
| 147 | set index [lsearch -exact $args -keepNewline] |
| 148 | if {$index != -1} { |
| 149 | set keepNewline 1 |
| 150 | set args [lreplace $args $index $index] |
| 151 | } |
| 152 | foreach a $args { |
| 153 | lappend cmd $a |
| 154 | } |
| 155 | protOut $cmd |
| @@ -150,14 +157,22 @@ | |
| 157 | flush stdout |
| 158 | if {[string length $answer] > 0} { |
| 159 | protOut $answer |
| 160 | set prompt_file [file join $::tempPath fossil_prompt_answer] |
| 161 | write_file $prompt_file $answer\n |
| 162 | if {$keepNewline} { |
| 163 | set rc [catch {eval exec -keepnewline $cmd <$prompt_file} result] |
| 164 | } else { |
| 165 | set rc [catch {eval exec $cmd <$prompt_file} result] |
| 166 | } |
| 167 | file delete $prompt_file |
| 168 | } else { |
| 169 | if {$keepNewline} { |
| 170 | set rc [catch {eval exec -keepnewline $cmd} result] |
| 171 | } else { |
| 172 | set rc [catch {eval exec $cmd} result] |
| 173 | } |
| 174 | } |
| 175 | global RESULT CODE |
| 176 | set CODE $rc |
| 177 | if {($rc && !$expectError) || (!$rc && $expectError)} { |
| 178 | protOut "ERROR: $result" 1 |
| 179 |
+2
-2
| --- test/th1-docs.test | ||
| +++ test/th1-docs.test | ||
| @@ -18,18 +18,18 @@ | ||
| 18 | 18 | # TH1 Docs |
| 19 | 19 | # |
| 20 | 20 | |
| 21 | 21 | fossil test-th-eval "hasfeature th1Docs" |
| 22 | 22 | |
| 23 | -if {$::RESULT ne "1"} { | |
| 23 | +if {[normalize_result] ne "1"} { | |
| 24 | 24 | puts "Fossil was not compiled with TH1 docs support." |
| 25 | 25 | test_cleanup_then_return |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | fossil test-th-eval "hasfeature tcl" |
| 29 | 29 | |
| 30 | -if {$::RESULT ne "1"} { | |
| 30 | +if {[normalize_result] ne "1"} { | |
| 31 | 31 | puts "Fossil was not compiled with Tcl support." |
| 32 | 32 | test_cleanup_then_return |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | ############################################################################### |
| 36 | 36 |
| --- test/th1-docs.test | |
| +++ test/th1-docs.test | |
| @@ -18,18 +18,18 @@ | |
| 18 | # TH1 Docs |
| 19 | # |
| 20 | |
| 21 | fossil test-th-eval "hasfeature th1Docs" |
| 22 | |
| 23 | if {$::RESULT ne "1"} { |
| 24 | puts "Fossil was not compiled with TH1 docs support." |
| 25 | test_cleanup_then_return |
| 26 | } |
| 27 | |
| 28 | fossil test-th-eval "hasfeature tcl" |
| 29 | |
| 30 | if {$::RESULT ne "1"} { |
| 31 | puts "Fossil was not compiled with Tcl support." |
| 32 | test_cleanup_then_return |
| 33 | } |
| 34 | |
| 35 | ############################################################################### |
| 36 |
| --- test/th1-docs.test | |
| +++ test/th1-docs.test | |
| @@ -18,18 +18,18 @@ | |
| 18 | # TH1 Docs |
| 19 | # |
| 20 | |
| 21 | fossil test-th-eval "hasfeature th1Docs" |
| 22 | |
| 23 | if {[normalize_result] ne "1"} { |
| 24 | puts "Fossil was not compiled with TH1 docs support." |
| 25 | test_cleanup_then_return |
| 26 | } |
| 27 | |
| 28 | fossil test-th-eval "hasfeature tcl" |
| 29 | |
| 30 | if {[normalize_result] ne "1"} { |
| 31 | puts "Fossil was not compiled with Tcl support." |
| 32 | test_cleanup_then_return |
| 33 | } |
| 34 | |
| 35 | ############################################################################### |
| 36 |
+1
-1
| --- test/th1-hooks.test | ||
| +++ test/th1-hooks.test | ||
| @@ -18,11 +18,11 @@ | ||
| 18 | 18 | # TH1 Hooks |
| 19 | 19 | # |
| 20 | 20 | |
| 21 | 21 | fossil test-th-eval "hasfeature th1Hooks" |
| 22 | 22 | |
| 23 | -if {$::RESULT ne "1"} { | |
| 23 | +if {[normalize_result] ne "1"} { | |
| 24 | 24 | puts "Fossil was not compiled with TH1 hooks support." |
| 25 | 25 | test_cleanup_then_return |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | ############################################################################### |
| 29 | 29 |
| --- test/th1-hooks.test | |
| +++ test/th1-hooks.test | |
| @@ -18,11 +18,11 @@ | |
| 18 | # TH1 Hooks |
| 19 | # |
| 20 | |
| 21 | fossil test-th-eval "hasfeature th1Hooks" |
| 22 | |
| 23 | if {$::RESULT ne "1"} { |
| 24 | puts "Fossil was not compiled with TH1 hooks support." |
| 25 | test_cleanup_then_return |
| 26 | } |
| 27 | |
| 28 | ############################################################################### |
| 29 |
| --- test/th1-hooks.test | |
| +++ test/th1-hooks.test | |
| @@ -18,11 +18,11 @@ | |
| 18 | # TH1 Hooks |
| 19 | # |
| 20 | |
| 21 | fossil test-th-eval "hasfeature th1Hooks" |
| 22 | |
| 23 | if {[normalize_result] ne "1"} { |
| 24 | puts "Fossil was not compiled with TH1 hooks support." |
| 25 | test_cleanup_then_return |
| 26 | } |
| 27 | |
| 28 | ############################################################################### |
| 29 |
+1
-1
| --- test/th1-tcl.test | ||
| +++ test/th1-tcl.test | ||
| @@ -22,11 +22,11 @@ | ||
| 22 | 22 | |
| 23 | 23 | ############################################################################### |
| 24 | 24 | |
| 25 | 25 | fossil test-th-eval "hasfeature tcl" |
| 26 | 26 | |
| 27 | -if {$::RESULT ne "1"} { | |
| 27 | +if {[normalize_result] ne "1"} { | |
| 28 | 28 | puts "Fossil was not compiled with Tcl support." |
| 29 | 29 | test_cleanup_then_return |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | ############################################################################### |
| 33 | 33 |
| --- test/th1-tcl.test | |
| +++ test/th1-tcl.test | |
| @@ -22,11 +22,11 @@ | |
| 22 | |
| 23 | ############################################################################### |
| 24 | |
| 25 | fossil test-th-eval "hasfeature tcl" |
| 26 | |
| 27 | if {$::RESULT ne "1"} { |
| 28 | puts "Fossil was not compiled with Tcl support." |
| 29 | test_cleanup_then_return |
| 30 | } |
| 31 | |
| 32 | ############################################################################### |
| 33 |
| --- test/th1-tcl.test | |
| +++ test/th1-tcl.test | |
| @@ -22,11 +22,11 @@ | |
| 22 | |
| 23 | ############################################################################### |
| 24 | |
| 25 | fossil test-th-eval "hasfeature tcl" |
| 26 | |
| 27 | if {[normalize_result] ne "1"} { |
| 28 | puts "Fossil was not compiled with Tcl support." |
| 29 | test_cleanup_then_return |
| 30 | } |
| 31 | |
| 32 | ############################################################################### |
| 33 |
+1
-1
| --- test/unversioned.test | ||
| +++ test/unversioned.test | ||
| @@ -178,11 +178,11 @@ | ||
| 178 | 178 | test unversioned-23 {[::sha1::sha1 $RESULT] eq \ |
| 179 | 179 | {962f96ebd613e4fdd9aa2d20bd9fe21a64e925f2}} |
| 180 | 180 | |
| 181 | 181 | ############################################################################### |
| 182 | 182 | |
| 183 | -fossil unversioned cat unversioned3.txt | |
| 183 | +fossil unversioned cat unversioned3.txt -keepNewline | |
| 184 | 184 | test unversioned-24 {[::sha1::sha1 $RESULT] eq \ |
| 185 | 185 | {c6b95509120d9703cc4fbe5cdfcb435b5912b3e4}} |
| 186 | 186 | |
| 187 | 187 | ############################################################################### |
| 188 | 188 | |
| 189 | 189 |
| --- test/unversioned.test | |
| +++ test/unversioned.test | |
| @@ -178,11 +178,11 @@ | |
| 178 | test unversioned-23 {[::sha1::sha1 $RESULT] eq \ |
| 179 | {962f96ebd613e4fdd9aa2d20bd9fe21a64e925f2}} |
| 180 | |
| 181 | ############################################################################### |
| 182 | |
| 183 | fossil unversioned cat unversioned3.txt |
| 184 | test unversioned-24 {[::sha1::sha1 $RESULT] eq \ |
| 185 | {c6b95509120d9703cc4fbe5cdfcb435b5912b3e4}} |
| 186 | |
| 187 | ############################################################################### |
| 188 | |
| 189 |
| --- test/unversioned.test | |
| +++ test/unversioned.test | |
| @@ -178,11 +178,11 @@ | |
| 178 | test unversioned-23 {[::sha1::sha1 $RESULT] eq \ |
| 179 | {962f96ebd613e4fdd9aa2d20bd9fe21a64e925f2}} |
| 180 | |
| 181 | ############################################################################### |
| 182 | |
| 183 | fossil unversioned cat unversioned3.txt -keepNewline |
| 184 | test unversioned-24 {[::sha1::sha1 $RESULT] eq \ |
| 185 | {c6b95509120d9703cc4fbe5cdfcb435b5912b3e4}} |
| 186 | |
| 187 | ############################################################################### |
| 188 | |
| 189 |