Fossil SCM

The changes in [b045d0774ed48936] are too far reaching. Instead, add a -keepNewline option and use it where appropriate.

mistachkin 2016-10-05 08:10 trunk
Commit 561402f2e08045d8e47cdd02ef5bb569dd41356b
+1 -1
--- test/json.test
+++ test/json.test
@@ -23,11 +23,11 @@
2323
# practice of eliminating all trace of the fossil json command when
2424
# not configured. If that changes, these conditions might not prevent
2525
# the rest of this file from running.
2626
fossil test-th-eval "hasfeature json"
2727
28
-if {$::RESULT ne "1"} then {
28
+if {[normalize_result] ne "1"} then {
2929
puts "Fossil was not compiled with JSON support."
3030
test_cleanup_then_return
3131
}
3232
3333
# We need a JSON parser to effectively test the JSON produced by
3434
--- 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 @@
136136
#
137137
proc fossil_maybe_answer {answer args} {
138138
global fossilexe
139139
set cmd $fossilexe
140140
set expectError 0
141
- if {[lindex $args end] eq "-expectError"} {
141
+ set index [lsearch -exact $args -expectError]
142
+ if {$index != -1} {
142143
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]
144151
}
145152
foreach a $args {
146153
lappend cmd $a
147154
}
148155
protOut $cmd
@@ -150,14 +157,22 @@
150157
flush stdout
151158
if {[string length $answer] > 0} {
152159
protOut $answer
153160
set prompt_file [file join $::tempPath fossil_prompt_answer]
154161
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
+ }
156167
file delete $prompt_file
157168
} 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
+ }
159174
}
160175
global RESULT CODE
161176
set CODE $rc
162177
if {($rc && !$expectError) || (!$rc && $expectError)} {
163178
protOut "ERROR: $result" 1
164179
--- 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
--- test/th1-docs.test
+++ test/th1-docs.test
@@ -18,18 +18,18 @@
1818
# TH1 Docs
1919
#
2020
2121
fossil test-th-eval "hasfeature th1Docs"
2222
23
-if {$::RESULT ne "1"} {
23
+if {[normalize_result] ne "1"} {
2424
puts "Fossil was not compiled with TH1 docs support."
2525
test_cleanup_then_return
2626
}
2727
2828
fossil test-th-eval "hasfeature tcl"
2929
30
-if {$::RESULT ne "1"} {
30
+if {[normalize_result] ne "1"} {
3131
puts "Fossil was not compiled with Tcl support."
3232
test_cleanup_then_return
3333
}
3434
3535
###############################################################################
3636
--- 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
--- test/th1-hooks.test
+++ test/th1-hooks.test
@@ -18,11 +18,11 @@
1818
# TH1 Hooks
1919
#
2020
2121
fossil test-th-eval "hasfeature th1Hooks"
2222
23
-if {$::RESULT ne "1"} {
23
+if {[normalize_result] ne "1"} {
2424
puts "Fossil was not compiled with TH1 hooks support."
2525
test_cleanup_then_return
2626
}
2727
2828
###############################################################################
2929
--- 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
--- test/th1-tcl.test
+++ test/th1-tcl.test
@@ -22,11 +22,11 @@
2222
2323
###############################################################################
2424
2525
fossil test-th-eval "hasfeature tcl"
2626
27
-if {$::RESULT ne "1"} {
27
+if {[normalize_result] ne "1"} {
2828
puts "Fossil was not compiled with Tcl support."
2929
test_cleanup_then_return
3030
}
3131
3232
###############################################################################
3333
--- 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
--- test/unversioned.test
+++ test/unversioned.test
@@ -178,11 +178,11 @@
178178
test unversioned-23 {[::sha1::sha1 $RESULT] eq \
179179
{962f96ebd613e4fdd9aa2d20bd9fe21a64e925f2}}
180180
181181
###############################################################################
182182
183
-fossil unversioned cat unversioned3.txt
183
+fossil unversioned cat unversioned3.txt -keepNewline
184184
test unversioned-24 {[::sha1::sha1 $RESULT] eq \
185185
{c6b95509120d9703cc4fbe5cdfcb435b5912b3e4}}
186186
187187
###############################################################################
188188
189189
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button