Fossil SCM

Modularization and cleanup of several test files.

mistachkin 2014-06-10 05:01 trunk
Commit 2c9d6b5e0f7b1a2a1ff1c477017a0f454be24446
+15 -2
--- test/tester.tcl
+++ test/tester.tcl
@@ -47,10 +47,17 @@
4747
foreach f [lsort [glob $testdir/*.test]] {
4848
set base [file root [file tail $f]]
4949
lappend argv $base
5050
}
5151
}
52
+
53
+set tempPath [expr {[info exists env(TEMP)] ? \
54
+ $env(TEMP) : [file dirname [info script]]}]
55
+
56
+if {$tcl_platform(platform) eq "windows"} then {
57
+ set tempPath [string map [list \\ /] $tempPath]
58
+}
5259
5360
# start protocol
5461
#
5562
proc protInit {cmd} {
5663
if {$::PROT} {
@@ -89,11 +96,11 @@
8996
set CODE $rc
9097
if {$rc} {puts "ERROR: $result"}
9198
set RESULT $result
9299
}
93100
94
-# Read a file into memory.
101
+# Read a file into memory.
95102
#
96103
proc read_file {filename} {
97104
set in [open $filename r]
98105
fconfigure $in -translation binary
99106
set txt [read $in [file size $filename]]
@@ -166,11 +173,17 @@
166173
test $name 1
167174
} else {
168175
protOut " Expected:\n [join $expected "\n "]"
169176
protOut " Got:\n [join $result "\n "]"
170177
test $name 0
171
- }
178
+ }
179
+}
180
+
181
+# Append all arguments into a single value and then returns it.
182
+#
183
+proc appendArgs {args} {
184
+ eval append result $args
172185
}
173186
174187
# Perform a test
175188
#
176189
set test_count 0
177190
--- test/tester.tcl
+++ test/tester.tcl
@@ -47,10 +47,17 @@
47 foreach f [lsort [glob $testdir/*.test]] {
48 set base [file root [file tail $f]]
49 lappend argv $base
50 }
51 }
 
 
 
 
 
 
 
52
53 # start protocol
54 #
55 proc protInit {cmd} {
56 if {$::PROT} {
@@ -89,11 +96,11 @@
89 set CODE $rc
90 if {$rc} {puts "ERROR: $result"}
91 set RESULT $result
92 }
93
94 # Read a file into memory.
95 #
96 proc read_file {filename} {
97 set in [open $filename r]
98 fconfigure $in -translation binary
99 set txt [read $in [file size $filename]]
@@ -166,11 +173,17 @@
166 test $name 1
167 } else {
168 protOut " Expected:\n [join $expected "\n "]"
169 protOut " Got:\n [join $result "\n "]"
170 test $name 0
171 }
 
 
 
 
 
 
172 }
173
174 # Perform a test
175 #
176 set test_count 0
177
--- test/tester.tcl
+++ test/tester.tcl
@@ -47,10 +47,17 @@
47 foreach f [lsort [glob $testdir/*.test]] {
48 set base [file root [file tail $f]]
49 lappend argv $base
50 }
51 }
52
53 set tempPath [expr {[info exists env(TEMP)] ? \
54 $env(TEMP) : [file dirname [info script]]}]
55
56 if {$tcl_platform(platform) eq "windows"} then {
57 set tempPath [string map [list \\ /] $tempPath]
58 }
59
60 # start protocol
61 #
62 proc protInit {cmd} {
63 if {$::PROT} {
@@ -89,11 +96,11 @@
96 set CODE $rc
97 if {$rc} {puts "ERROR: $result"}
98 set RESULT $result
99 }
100
101 # Read a file into memory.
102 #
103 proc read_file {filename} {
104 set in [open $filename r]
105 fconfigure $in -translation binary
106 set txt [read $in [file size $filename]]
@@ -166,11 +173,17 @@
173 test $name 1
174 } else {
175 protOut " Expected:\n [join $expected "\n "]"
176 protOut " Got:\n [join $result "\n "]"
177 test $name 0
178 }
179 }
180
181 # Append all arguments into a single value and then returns it.
182 #
183 proc appendArgs {args} {
184 eval append result $args
185 }
186
187 # Perform a test
188 #
189 set test_count 0
190
--- test/th1.test
+++ test/th1.test
@@ -468,12 +468,9 @@
468468
###############################################################################
469469
470470
fossil test-th-eval "expr 0b1+5"
471471
test th1-expr-34 {$RESULT eq {6}}
472472
473
-
474473
###############################################################################
475474
476475
fossil test-th-eval "expr 0+0b"
477476
test th1-expr-35 {$RESULT eq {TH_ERROR: expected number, got: "0b"}}
478
-
479
-
480477
--- test/th1.test
+++ test/th1.test
@@ -468,12 +468,9 @@
468 ###############################################################################
469
470 fossil test-th-eval "expr 0b1+5"
471 test th1-expr-34 {$RESULT eq {6}}
472
473
474 ###############################################################################
475
476 fossil test-th-eval "expr 0+0b"
477 test th1-expr-35 {$RESULT eq {TH_ERROR: expected number, got: "0b"}}
478
479
480
--- test/th1.test
+++ test/th1.test
@@ -468,12 +468,9 @@
468 ###############################################################################
469
470 fossil test-th-eval "expr 0b1+5"
471 test th1-expr-34 {$RESULT eq {6}}
472
 
473 ###############################################################################
474
475 fossil test-th-eval "expr 0+0b"
476 test th1-expr-35 {$RESULT eq {TH_ERROR: expected number, got: "0b"}}
 
 
477
--- test/utf.test
+++ test/utf.test
@@ -16,14 +16,10 @@
1616
############################################################################
1717
#
1818
# Test UTF-8/UTF-16 detection
1919
#
2020
21
-proc appendArgs {args} {
22
- eval append result $args
23
-}
24
-
2521
proc swap_byte_order {str} {
2622
set result ""
2723
for {set i 0} {$i < [string length $str]} {incr i} {
2824
set c [scan [string index $str $i] %c]
2925
set c [expr {(($c << 8) & 0xFF00) | (($c >> 8) & 0xFF)}]
@@ -315,17 +311,10 @@
315311
}
316312
}
317313
flush $f; close $f
318314
}
319315
320
-set tempPath [expr {[info exists env(TEMP)] ? \
321
- $env(TEMP) : [file dirname [info script]]}]
322
-
323
-if {$tcl_platform(platform) eq "windows"} then {
324
- set tempPath [string map [list \\ /] $tempPath]
325
-}
326
-
327316
createTestFiles $tempPath 100
328317
# createTestResults $tempPath 100
329318
########################### BEGIN GENERATED SECTION ###########################
330319
331320
utf-check 100 utf-check-100-0-0-0.jnk \
332321
--- test/utf.test
+++ test/utf.test
@@ -16,14 +16,10 @@
16 ############################################################################
17 #
18 # Test UTF-8/UTF-16 detection
19 #
20
21 proc appendArgs {args} {
22 eval append result $args
23 }
24
25 proc swap_byte_order {str} {
26 set result ""
27 for {set i 0} {$i < [string length $str]} {incr i} {
28 set c [scan [string index $str $i] %c]
29 set c [expr {(($c << 8) & 0xFF00) | (($c >> 8) & 0xFF)}]
@@ -315,17 +311,10 @@
315 }
316 }
317 flush $f; close $f
318 }
319
320 set tempPath [expr {[info exists env(TEMP)] ? \
321 $env(TEMP) : [file dirname [info script]]}]
322
323 if {$tcl_platform(platform) eq "windows"} then {
324 set tempPath [string map [list \\ /] $tempPath]
325 }
326
327 createTestFiles $tempPath 100
328 # createTestResults $tempPath 100
329 ########################### BEGIN GENERATED SECTION ###########################
330
331 utf-check 100 utf-check-100-0-0-0.jnk \
332
--- test/utf.test
+++ test/utf.test
@@ -16,14 +16,10 @@
16 ############################################################################
17 #
18 # Test UTF-8/UTF-16 detection
19 #
20
 
 
 
 
21 proc swap_byte_order {str} {
22 set result ""
23 for {set i 0} {$i < [string length $str]} {incr i} {
24 set c [scan [string index $str $i] %c]
25 set c [expr {(($c << 8) & 0xFF00) | (($c >> 8) & 0xFF)}]
@@ -315,17 +311,10 @@
311 }
312 }
313 flush $f; close $f
314 }
315
 
 
 
 
 
 
 
316 createTestFiles $tempPath 100
317 # createTestResults $tempPath 100
318 ########################### BEGIN GENERATED SECTION ###########################
319
320 utf-check 100 utf-check-100-0-0-0.jnk \
321

Keyboard Shortcuts

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