Fossil SCM
Remove superfluous 'then' from the test suite. Also, enhance -verbose when used for merge tests.
Commit
3c7825278bb42efe410330fd45f7ee98de422e1e7773d35bb0210ae178edddc7
Parent
7f002bc6b2136c3…
5 files changed
+2
-2
+1
-1
+1
-1
+10
-2
+1
-1
+2
-2
| --- test/fake-editor.tcl | ||
| +++ test/fake-editor.tcl | ||
| @@ -50,11 +50,11 @@ | ||
| 50 | 50 | |
| 51 | 51 | ############################################################################### |
| 52 | 52 | |
| 53 | 53 | set fileName [lindex $argv 0] |
| 54 | 54 | |
| 55 | -if {[file exists $fileName]} then { | |
| 55 | +if {[file exists $fileName]} { | |
| 56 | 56 | set data [readFile $fileName] |
| 57 | 57 | } else { |
| 58 | 58 | set data "" |
| 59 | 59 | } |
| 60 | 60 | |
| @@ -67,11 +67,11 @@ | ||
| 67 | 67 | # modified) content back to the original file. |
| 68 | 68 | # |
| 69 | 69 | set script $env(FAKE_EDITOR_SCRIPT) |
| 70 | 70 | set code [catch $script error] |
| 71 | 71 | |
| 72 | - if {$code != 0} then { | |
| 72 | + if {$code != 0} { | |
| 73 | 73 | if {[info exists env(FAKE_EDITOR_VERBOSE)]} { |
| 74 | 74 | if {[info exists errorInfo]} { |
| 75 | 75 | puts stdout "ERROR ($code): $errorInfo" |
| 76 | 76 | } else { |
| 77 | 77 | puts stdout "ERROR ($code): $error" |
| 78 | 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]} 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 @@ | ||
| 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 {[normalize_result] ne "1"} then { | |
| 28 | +if {[normalize_result] ne "1"} { | |
| 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 {[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 |
+1
-1
| --- test/set-manifest.test | ||
| +++ test/set-manifest.test | ||
| @@ -33,11 +33,11 @@ | ||
| 33 | 33 | |
| 34 | 34 | # We need SHA1 to effectively test the manifest files produced by |
| 35 | 35 | # fossil. It looks like the one from tcllib is exactly what we need. |
| 36 | 36 | # On ActiveTcl, add it with teacup. On other platforms, YMMV. |
| 37 | 37 | # teacup install sha1 |
| 38 | -if {[catch {package require sha1}] != 0} then { | |
| 38 | +if {[catch {package require sha1}] != 0} { | |
| 39 | 39 | puts "The \"sha1\" package is not available." |
| 40 | 40 | test_cleanup_then_return |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | # We need a respository, so let it have one. |
| 44 | 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} 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 @@ | ||
| 360 | 360 | proc same_file {a b} { |
| 361 | 361 | set x [read_file $a] |
| 362 | 362 | regsub -all { +\n} $x \n x |
| 363 | 363 | set y [read_file $b] |
| 364 | 364 | 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 | + } | |
| 366 | 374 | } |
| 367 | 375 | |
| 368 | 376 | # Return true if two strings refer to the |
| 369 | 377 | # same uuid. That is, the shorter is a prefix |
| 370 | 378 | # of the longer. |
| @@ -373,11 +381,11 @@ | ||
| 373 | 381 | set na [string length $a] |
| 374 | 382 | set nb [string length $b] |
| 375 | 383 | if {$na == $nb} { |
| 376 | 384 | return [expr {$a eq $b}] |
| 377 | 385 | } |
| 378 | - if {$na < $nb} then { | |
| 386 | + if {$na < $nb} { | |
| 379 | 387 | return [string match "$a*" $b] |
| 380 | 388 | } |
| 381 | 389 | return [string match "$b*" $a] |
| 382 | 390 | } |
| 383 | 391 | |
| 384 | 392 |
| --- 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 |
+1
-1
| --- test/unversioned.test | ||
| +++ test/unversioned.test | ||
| @@ -18,11 +18,11 @@ | ||
| 18 | 18 | # The "unversioned" command. |
| 19 | 19 | # |
| 20 | 20 | |
| 21 | 21 | set path [file dirname [info script]] |
| 22 | 22 | |
| 23 | -if {[catch {package require sha1}] != 0} then { | |
| 23 | +if {[catch {package require sha1}] != 0} { | |
| 24 | 24 | puts "The \"sha1\" package is not available." |
| 25 | 25 | test_cleanup_then_return |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | require_no_open_checkout |
| 29 | 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} 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 |