Fossil SCM

Updates to the 'cmdline', 'set-manifest', and 'unversioned.test' tests.

mistachkin 2020-06-12 00:29 trunk
Commit ecb52c1f78be487b9983f4cbfe3b3a96f1dfc083f605603330ad767ada6b56df
--- test/cmdline.test
+++ test/cmdline.test
@@ -18,19 +18,37 @@
1818
# Test command line parsing
1919
#
2020
2121
test_setup ""
2222
23
-proc cmd-line {testname args} {
23
+proc cmd-line {usefile testname args} {
2424
set i 1
2525
foreach {cmdline result} $args {
26
- fossil test-echo $cmdline
27
- test cmd-line-$testname.$i {[lrange [split $::RESULT \n] 3 end]=="\{argv\[2\] = \[$result\]\}"}
26
+ if {$usefile} {
27
+ set cmdlinefile [file join \
28
+ [getTemporaryPath] fossil-cmd-line-$testname.txt]
29
+
30
+ write_file $cmdlinefile $cmdline
31
+ fossil test-echo --args $cmdlinefile
32
+ file delete $cmdlinefile
33
+ } else {
34
+ fossil test-echo $cmdline
35
+ }
36
+
37
+ test cmd-line-$testname.$i \
38
+ {[lrange [split $::RESULT \n] 3 end]=="\{argv\[2\] = \[$result\]\}"}
39
+
2840
incr i
2941
}
3042
}
31
-cmd-line 100 abc abc a\"bc a\"bc \"abc\" \"abc\"
32
-cmd-line 101 * * *.* *.*
43
+
44
+cmd-line false 100 abc abc a\"bc a\"bc \"abc\" \"abc\"
45
+
46
+#
47
+# NOTE: Use an --args file on Windows to avoid unwanted glob expansion
48
+# from MinGW and/or the MSVCRT.
49
+#
50
+cmd-line $is_windows 101 * * *.* *.*
3351
3452
###############################################################################
3553
3654
test_cleanup
3755
--- test/cmdline.test
+++ test/cmdline.test
@@ -18,19 +18,37 @@
18 # Test command line parsing
19 #
20
21 test_setup ""
22
23 proc cmd-line {testname args} {
24 set i 1
25 foreach {cmdline result} $args {
26 fossil test-echo $cmdline
27 test cmd-line-$testname.$i {[lrange [split $::RESULT \n] 3 end]=="\{argv\[2\] = \[$result\]\}"}
 
 
 
 
 
 
 
 
 
 
 
 
28 incr i
29 }
30 }
31 cmd-line 100 abc abc a\"bc a\"bc \"abc\" \"abc\"
32 cmd-line 101 * * *.* *.*
 
 
 
 
 
 
33
34 ###############################################################################
35
36 test_cleanup
37
--- test/cmdline.test
+++ test/cmdline.test
@@ -18,19 +18,37 @@
18 # Test command line parsing
19 #
20
21 test_setup ""
22
23 proc cmd-line {usefile testname args} {
24 set i 1
25 foreach {cmdline result} $args {
26 if {$usefile} {
27 set cmdlinefile [file join \
28 [getTemporaryPath] fossil-cmd-line-$testname.txt]
29
30 write_file $cmdlinefile $cmdline
31 fossil test-echo --args $cmdlinefile
32 file delete $cmdlinefile
33 } else {
34 fossil test-echo $cmdline
35 }
36
37 test cmd-line-$testname.$i \
38 {[lrange [split $::RESULT \n] 3 end]=="\{argv\[2\] = \[$result\]\}"}
39
40 incr i
41 }
42 }
43
44 cmd-line false 100 abc abc a\"bc a\"bc \"abc\" \"abc\"
45
46 #
47 # NOTE: Use an --args file on Windows to avoid unwanted glob expansion
48 # from MinGW and/or the MSVCRT.
49 #
50 cmd-line $is_windows 101 * * *.* *.*
51
52 ###############################################################################
53
54 test_cleanup
55
--- test/set-manifest.test
+++ test/set-manifest.test
@@ -16,16 +16,10 @@
1616
############################################################################
1717
#
1818
# Test manifest setting
1919
#
2020
21
-# We need SHA1 to effectively test the manifest files produced by
22
-# fossil. It looks like the one from tcllib is exactly what we need.
23
-# On ActiveTcl, add it with teacup. On other platforms, YMMV.
24
-# teacup install sha1
25
-package require sha1
26
-
2721
proc file_contains {fname match} {
2822
set fp [open $fname r]
2923
set contents [read $fp]
3024
close $fp
3125
set lines [split $contents "\n"]
@@ -34,10 +28,19 @@
3428
return 1
3529
}
3630
}
3731
return 0
3832
}
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
+}
3942
4043
# We need a respository, so let it have one.
4144
test_setup
4245
4346
#### Verify classic behavior of the manifest setting
4447
--- test/set-manifest.test
+++ test/set-manifest.test
@@ -16,16 +16,10 @@
16 ############################################################################
17 #
18 # Test manifest setting
19 #
20
21 # We need SHA1 to effectively test the manifest files produced by
22 # fossil. It looks like the one from tcllib is exactly what we need.
23 # On ActiveTcl, add it with teacup. On other platforms, YMMV.
24 # teacup install sha1
25 package require sha1
26
27 proc file_contains {fname match} {
28 set fp [open $fname r]
29 set contents [read $fp]
30 close $fp
31 set lines [split $contents "\n"]
@@ -34,10 +28,19 @@
34 return 1
35 }
36 }
37 return 0
38 }
 
 
 
 
 
 
 
 
 
39
40 # We need a respository, so let it have one.
41 test_setup
42
43 #### Verify classic behavior of the manifest setting
44
--- test/set-manifest.test
+++ test/set-manifest.test
@@ -16,16 +16,10 @@
16 ############################################################################
17 #
18 # Test manifest setting
19 #
20
 
 
 
 
 
 
21 proc file_contains {fname match} {
22 set fp [open $fname r]
23 set contents [read $fp]
24 close $fp
25 set lines [split $contents "\n"]
@@ -34,10 +28,19 @@
28 return 1
29 }
30 }
31 return 0
32 }
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_setup
45
46 #### Verify classic behavior of the manifest setting
47
--- test/unversioned.test
+++ test/unversioned.test
@@ -119,11 +119,11 @@
119119
120120
###############################################################################
121121
122122
fossil unversioned add "unversioned space.txt" -expectError
123123
test unversioned-14 {[normalize_result] eq \
124
-{names of unversioned files may not contain whitespace}}
124
+{unversioned filenames may not contain whitespace: 'unversioned space.txt'}}
125125
126126
###############################################################################
127127
128128
fossil unversioned add "unversioned space.txt" --as unversioned3.txt
129129
test unversioned-15 {[normalize_result] eq {}}
@@ -343,11 +343,12 @@
343343
test unversioned-46 {[regexp \
344344
{Round-trips: 1 Artifacts sent: 0 received: 0
345345
Round-trips: 1 Artifacts sent: 0 received: 0
346346
Round-trips: 2 Artifacts sent: 0 received: 0
347347
Round-trips: 2 Artifacts sent: 0 received: 2
348
-\n? done, sent: \d+ received: \d+ ip: 127.0.0.1} [normalize_result]]}
348
+\n? done, sent: \d+ received: \d+ ip: (?:127\.0\.0\.1|::1)} \
349
+[normalize_result]]}
349350
350351
###############################################################################
351352
352353
fossil unversioned ls
353354
test unversioned-47 {[normalize_result] eq {unversioned2.txt
@@ -388,11 +389,12 @@
388389
test unversioned-52 {[regexp \
389390
{Round-trips: 1 Artifacts sent: 0 received: 0
390391
Round-trips: 1 Artifacts sent: 0 received: 0
391392
Round-trips: 2 Artifacts sent: 0 received: 0
392393
Round-trips: 2 Artifacts sent: 0 received: 2
393
-\n? done, sent: \d+ received: \d+ ip: 127.0.0.1} [normalize_result]]}
394
+\n? done, sent: \d+ received: \d+ ip: (?:127\.0\.0\.1|::1)} \
395
+[normalize_result]]}
394396
395397
###############################################################################
396398
397399
fossil unversioned list
398400
test unversioned-53 {[regexp \
@@ -412,11 +414,12 @@
412414
test unversioned-55 {[regexp \
413415
{Round-trips: 1 Artifacts sent: 0 received: 0
414416
Round-trips: 1 Artifacts sent: 0 received: 0
415417
Round-trips: 2 Artifacts sent: 1 received: 0
416418
Round-trips: 2 Artifacts sent: 1 received: 0
417
-\n? done, sent: \d+ received: \d+ ip: 127.0.0.1} [normalize_result]]}
419
+\n? done, sent: \d+ received: \d+ ip: (?:127\.0\.0\.1|::1)} \
420
+[normalize_result]]}
418421
419422
###############################################################################
420423
421424
fossil close
422425
test unversioned-56 {[normalize_result] eq {}}
423426
--- test/unversioned.test
+++ test/unversioned.test
@@ -119,11 +119,11 @@
119
120 ###############################################################################
121
122 fossil unversioned add "unversioned space.txt" -expectError
123 test unversioned-14 {[normalize_result] eq \
124 {names of unversioned files may not contain whitespace}}
125
126 ###############################################################################
127
128 fossil unversioned add "unversioned space.txt" --as unversioned3.txt
129 test unversioned-15 {[normalize_result] eq {}}
@@ -343,11 +343,12 @@
343 test unversioned-46 {[regexp \
344 {Round-trips: 1 Artifacts sent: 0 received: 0
345 Round-trips: 1 Artifacts sent: 0 received: 0
346 Round-trips: 2 Artifacts sent: 0 received: 0
347 Round-trips: 2 Artifacts sent: 0 received: 2
348 \n? done, sent: \d+ received: \d+ ip: 127.0.0.1} [normalize_result]]}
 
349
350 ###############################################################################
351
352 fossil unversioned ls
353 test unversioned-47 {[normalize_result] eq {unversioned2.txt
@@ -388,11 +389,12 @@
388 test unversioned-52 {[regexp \
389 {Round-trips: 1 Artifacts sent: 0 received: 0
390 Round-trips: 1 Artifacts sent: 0 received: 0
391 Round-trips: 2 Artifacts sent: 0 received: 0
392 Round-trips: 2 Artifacts sent: 0 received: 2
393 \n? done, sent: \d+ received: \d+ ip: 127.0.0.1} [normalize_result]]}
 
394
395 ###############################################################################
396
397 fossil unversioned list
398 test unversioned-53 {[regexp \
@@ -412,11 +414,12 @@
412 test unversioned-55 {[regexp \
413 {Round-trips: 1 Artifacts sent: 0 received: 0
414 Round-trips: 1 Artifacts sent: 0 received: 0
415 Round-trips: 2 Artifacts sent: 1 received: 0
416 Round-trips: 2 Artifacts sent: 1 received: 0
417 \n? done, sent: \d+ received: \d+ ip: 127.0.0.1} [normalize_result]]}
 
418
419 ###############################################################################
420
421 fossil close
422 test unversioned-56 {[normalize_result] eq {}}
423
--- test/unversioned.test
+++ test/unversioned.test
@@ -119,11 +119,11 @@
119
120 ###############################################################################
121
122 fossil unversioned add "unversioned space.txt" -expectError
123 test unversioned-14 {[normalize_result] eq \
124 {unversioned filenames may not contain whitespace: 'unversioned space.txt'}}
125
126 ###############################################################################
127
128 fossil unversioned add "unversioned space.txt" --as unversioned3.txt
129 test unversioned-15 {[normalize_result] eq {}}
@@ -343,11 +343,12 @@
343 test unversioned-46 {[regexp \
344 {Round-trips: 1 Artifacts sent: 0 received: 0
345 Round-trips: 1 Artifacts sent: 0 received: 0
346 Round-trips: 2 Artifacts sent: 0 received: 0
347 Round-trips: 2 Artifacts sent: 0 received: 2
348 \n? done, sent: \d+ received: \d+ ip: (?:127\.0\.0\.1|::1)} \
349 [normalize_result]]}
350
351 ###############################################################################
352
353 fossil unversioned ls
354 test unversioned-47 {[normalize_result] eq {unversioned2.txt
@@ -388,11 +389,12 @@
389 test unversioned-52 {[regexp \
390 {Round-trips: 1 Artifacts sent: 0 received: 0
391 Round-trips: 1 Artifacts sent: 0 received: 0
392 Round-trips: 2 Artifacts sent: 0 received: 0
393 Round-trips: 2 Artifacts sent: 0 received: 2
394 \n? done, sent: \d+ received: \d+ ip: (?:127\.0\.0\.1|::1)} \
395 [normalize_result]]}
396
397 ###############################################################################
398
399 fossil unversioned list
400 test unversioned-53 {[regexp \
@@ -412,11 +414,12 @@
414 test unversioned-55 {[regexp \
415 {Round-trips: 1 Artifacts sent: 0 received: 0
416 Round-trips: 1 Artifacts sent: 0 received: 0
417 Round-trips: 2 Artifacts sent: 1 received: 0
418 Round-trips: 2 Artifacts sent: 1 received: 0
419 \n? done, sent: \d+ received: \d+ ip: (?:127\.0\.0\.1|::1)} \
420 [normalize_result]]}
421
422 ###############################################################################
423
424 fossil close
425 test unversioned-56 {[normalize_result] eq {}}
426

Keyboard Shortcuts

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