Fossil SCM

Remove superfluous 'then' from the test suite. Also, enhance -verbose when used for merge tests.

mistachkin 2020-06-13 01:25 trunk
Commit 3c7825278bb42efe410330fd45f7ee98de422e1e7773d35bb0210ae178edddc7
--- test/fake-editor.tcl
+++ test/fake-editor.tcl
@@ -50,11 +50,11 @@
5050
5151
###############################################################################
5252
5353
set fileName [lindex $argv 0]
5454
55
-if {[file exists $fileName]} then {
55
+if {[file exists $fileName]} {
5656
set data [readFile $fileName]
5757
} else {
5858
set data ""
5959
}
6060
@@ -67,11 +67,11 @@
6767
# modified) content back to the original file.
6868
#
6969
set script $env(FAKE_EDITOR_SCRIPT)
7070
set code [catch $script error]
7171
72
- if {$code != 0} then {
72
+ if {$code != 0} {
7373
if {[info exists env(FAKE_EDITOR_VERBOSE)]} {
7474
if {[info exists errorInfo]} {
7575
puts stdout "ERROR ($code): $errorInfo"
7676
} else {
7777
puts stdout "ERROR ($code): $error"
7878
--- test/fake-editor.tcl
+++ test/fake-editor.tcl
@@ -50,11 +50,11 @@
50
51 ###############################################################################
52
53 set fileName [lindex $argv 0]
54
55 if {[file exists $fileName]} then {
56 set data [readFile $fileName]
57 } else {
58 set data ""
59 }
60
@@ -67,11 +67,11 @@
67 # modified) content back to the original file.
68 #
69 set script $env(FAKE_EDITOR_SCRIPT)
70 set code [catch $script error]
71
72 if {$code != 0} then {
73 if {[info exists env(FAKE_EDITOR_VERBOSE)]} {
74 if {[info exists errorInfo]} {
75 puts stdout "ERROR ($code): $errorInfo"
76 } else {
77 puts stdout "ERROR ($code): $error"
78
--- test/fake-editor.tcl
+++ test/fake-editor.tcl
@@ -50,11 +50,11 @@
50
51 ###############################################################################
52
53 set fileName [lindex $argv 0]
54
55 if {[file exists $fileName]} {
56 set data [readFile $fileName]
57 } else {
58 set data ""
59 }
60
@@ -67,11 +67,11 @@
67 # modified) content back to the original file.
68 #
69 set script $env(FAKE_EDITOR_SCRIPT)
70 set code [catch $script error]
71
72 if {$code != 0} {
73 if {[info exists env(FAKE_EDITOR_VERBOSE)]} {
74 if {[info exists errorInfo]} {
75 puts stdout "ERROR ($code): $errorInfo"
76 } else {
77 puts stdout "ERROR ($code): $error"
78
+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 {[normalize_result] ne "1"} then {
28
+if {[normalize_result] ne "1"} {
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 {[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
--- 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"} {
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/set-manifest.test
+++ test/set-manifest.test
@@ -33,11 +33,11 @@
3333
3434
# We need SHA1 to effectively test the manifest files produced by
3535
# fossil. It looks like the one from tcllib is exactly what we need.
3636
# On ActiveTcl, add it with teacup. On other platforms, YMMV.
3737
# teacup install sha1
38
-if {[catch {package require sha1}] != 0} then {
38
+if {[catch {package require sha1}] != 0} {
3939
puts "The \"sha1\" package is not available."
4040
test_cleanup_then_return
4141
}
4242
4343
# We need a respository, so let it have one.
4444
--- test/set-manifest.test
+++ test/set-manifest.test
@@ -33,11 +33,11 @@
33
34 # We need SHA1 to effectively test the manifest files produced by
35 # fossil. It looks like the one from tcllib is exactly what we need.
36 # On ActiveTcl, add it with teacup. On other platforms, YMMV.
37 # teacup install sha1
38 if {[catch {package require sha1}] != 0} then {
39 puts "The \"sha1\" package is not available."
40 test_cleanup_then_return
41 }
42
43 # We need a respository, so let it have one.
44
--- test/set-manifest.test
+++ test/set-manifest.test
@@ -33,11 +33,11 @@
33
34 # We need SHA1 to effectively test the manifest files produced by
35 # fossil. It looks like the one from tcllib is exactly what we need.
36 # On ActiveTcl, add it with teacup. On other platforms, YMMV.
37 # teacup install sha1
38 if {[catch {package require sha1}] != 0} {
39 puts "The \"sha1\" package is not available."
40 test_cleanup_then_return
41 }
42
43 # We need a respository, so let it have one.
44
+10 -2
--- test/tester.tcl
+++ test/tester.tcl
@@ -360,11 +360,19 @@
360360
proc same_file {a b} {
361361
set x [read_file $a]
362362
regsub -all { +\n} $x \n x
363363
set y [read_file $b]
364364
regsub -all { +\n} $y \n y
365
- return [expr {$x==$y}]
365
+ if {$x == $y} {
366
+ return 1
367
+ } else {
368
+ if {$::VERBOSE} {
369
+ protOut "NOT_SAME_FILE($a): \{\n$x\n\}"
370
+ protOut "NOT_SAME_FILE($b): \{\n$y\n\}"
371
+ }
372
+ return 0
373
+ }
366374
}
367375
368376
# Return true if two strings refer to the
369377
# same uuid. That is, the shorter is a prefix
370378
# of the longer.
@@ -373,11 +381,11 @@
373381
set na [string length $a]
374382
set nb [string length $b]
375383
if {$na == $nb} {
376384
return [expr {$a eq $b}]
377385
}
378
- if {$na < $nb} then {
386
+ if {$na < $nb} {
379387
return [string match "$a*" $b]
380388
}
381389
return [string match "$b*" $a]
382390
}
383391
384392
--- test/tester.tcl
+++ test/tester.tcl
@@ -360,11 +360,19 @@
360 proc same_file {a b} {
361 set x [read_file $a]
362 regsub -all { +\n} $x \n x
363 set y [read_file $b]
364 regsub -all { +\n} $y \n y
365 return [expr {$x==$y}]
 
 
 
 
 
 
 
 
366 }
367
368 # Return true if two strings refer to the
369 # same uuid. That is, the shorter is a prefix
370 # of the longer.
@@ -373,11 +381,11 @@
373 set na [string length $a]
374 set nb [string length $b]
375 if {$na == $nb} {
376 return [expr {$a eq $b}]
377 }
378 if {$na < $nb} then {
379 return [string match "$a*" $b]
380 }
381 return [string match "$b*" $a]
382 }
383
384
--- test/tester.tcl
+++ test/tester.tcl
@@ -360,11 +360,19 @@
360 proc same_file {a b} {
361 set x [read_file $a]
362 regsub -all { +\n} $x \n x
363 set y [read_file $b]
364 regsub -all { +\n} $y \n y
365 if {$x == $y} {
366 return 1
367 } else {
368 if {$::VERBOSE} {
369 protOut "NOT_SAME_FILE($a): \{\n$x\n\}"
370 protOut "NOT_SAME_FILE($b): \{\n$y\n\}"
371 }
372 return 0
373 }
374 }
375
376 # Return true if two strings refer to the
377 # same uuid. That is, the shorter is a prefix
378 # of the longer.
@@ -373,11 +381,11 @@
381 set na [string length $a]
382 set nb [string length $b]
383 if {$na == $nb} {
384 return [expr {$a eq $b}]
385 }
386 if {$na < $nb} {
387 return [string match "$a*" $b]
388 }
389 return [string match "$b*" $a]
390 }
391
392
--- test/unversioned.test
+++ test/unversioned.test
@@ -18,11 +18,11 @@
1818
# The "unversioned" command.
1919
#
2020
2121
set path [file dirname [info script]]
2222
23
-if {[catch {package require sha1}] != 0} then {
23
+if {[catch {package require sha1}] != 0} {
2424
puts "The \"sha1\" package is not available."
2525
test_cleanup_then_return
2626
}
2727
2828
require_no_open_checkout
2929
--- test/unversioned.test
+++ test/unversioned.test
@@ -18,11 +18,11 @@
18 # The "unversioned" command.
19 #
20
21 set path [file dirname [info script]]
22
23 if {[catch {package require sha1}] != 0} then {
24 puts "The \"sha1\" package is not available."
25 test_cleanup_then_return
26 }
27
28 require_no_open_checkout
29
--- test/unversioned.test
+++ test/unversioned.test
@@ -18,11 +18,11 @@
18 # The "unversioned" command.
19 #
20
21 set path [file dirname [info script]]
22
23 if {[catch {package require sha1}] != 0} {
24 puts "The \"sha1\" package is not available."
25 test_cleanup_then_return
26 }
27
28 require_no_open_checkout
29

Keyboard Shortcuts

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