Fossil SCM

Let th1-docs test run in a test repo by copying the file we need. This avoids running the test in the actual development checkout.

preben 2023-12-11 21:10 testing-improvements
Commit f1f5c4ce1e5c0694137554147b7a29d47d2234f9274a464f8f07c6c240d3f3ac
1 file changed +14 -18
+14 -18
--- test/th1-docs.test
+++ test/th1-docs.test
@@ -30,50 +30,46 @@
3030
if {[normalize_result] ne "1"} {
3131
puts "Fossil was not compiled with Tcl support."
3232
test_cleanup_then_return
3333
}
3434
35
-run_in_checkout {
36
- set changes [fossil changes --changed]
37
-}
38
-
39
-if {[string length $changes]} {
40
- puts "Skipping th1-docs-* tests: uncommitted changes in Fossil checkout."
41
- test_cleanup_then_return
42
-}
43
-
4435
###############################################################################
4536
46
-test_setup ""
37
+test_setup
4738
4839
###############################################################################
4940
5041
set env(TH1_ENABLE_DOCS) 1; # TH1 docs must be enabled for this test.
5142
set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test.
5243
5344
###############################################################################
5445
55
-run_in_checkout {
56
- set data [fossil info]
57
-}
46
+set data [fossil info]
5847
5948
regexp -line -- {^repository: (.*)$} $data dummy repository
6049
6150
if {[string length $repository] == 0 || ![file exists $repository]} {
6251
error "unable to locate repository"
6352
}
6453
6554
set dataFileName [file join $::testdir th1-docs-input.txt]
55
+set origFileStat [file join $::testdir fileStat.th1]
56
+
57
+if {![file exists $origFileStat]} {
58
+ error "unable to locate [$origFileStat]"
59
+}
60
+
61
+file copy $origFileStat fileStat.th1
62
+fossil add fileStat.th1
63
+fossil commit -m "Add fileStat.th1"
6664
6765
###############################################################################
6866
69
-run_in_checkout {
70
- set RESULT [test_fossil_http \
71
- $repository $dataFileName /doc/trunk/test/fileStat.th1]
72
-}
67
+set RESULT [test_fossil_http \
68
+ $repository $dataFileName /doc/trunk/fileStat.th1]
7369
74
-test th1-docs-1a {[regexp {<title>Fossil: test/fileStat.th1</title>} $RESULT]}
70
+test th1-docs-1a {[regexp {<title>Unnamed Fossil Project: fileStat.th1</title>} $RESULT]}
7571
test th1-docs-1b {[regexp {>\[[0-9a-f]{40,64}\]<} $RESULT]}
7672
test th1-docs-1c {[regexp { contains \d+ files\.} $RESULT]}
7773
7874
###############################################################################
7975
8076
--- test/th1-docs.test
+++ test/th1-docs.test
@@ -30,50 +30,46 @@
30 if {[normalize_result] ne "1"} {
31 puts "Fossil was not compiled with Tcl support."
32 test_cleanup_then_return
33 }
34
35 run_in_checkout {
36 set changes [fossil changes --changed]
37 }
38
39 if {[string length $changes]} {
40 puts "Skipping th1-docs-* tests: uncommitted changes in Fossil checkout."
41 test_cleanup_then_return
42 }
43
44 ###############################################################################
45
46 test_setup ""
47
48 ###############################################################################
49
50 set env(TH1_ENABLE_DOCS) 1; # TH1 docs must be enabled for this test.
51 set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test.
52
53 ###############################################################################
54
55 run_in_checkout {
56 set data [fossil info]
57 }
58
59 regexp -line -- {^repository: (.*)$} $data dummy repository
60
61 if {[string length $repository] == 0 || ![file exists $repository]} {
62 error "unable to locate repository"
63 }
64
65 set dataFileName [file join $::testdir th1-docs-input.txt]
 
 
 
 
 
 
 
 
 
66
67 ###############################################################################
68
69 run_in_checkout {
70 set RESULT [test_fossil_http \
71 $repository $dataFileName /doc/trunk/test/fileStat.th1]
72 }
73
74 test th1-docs-1a {[regexp {<title>Fossil: test/fileStat.th1</title>} $RESULT]}
75 test th1-docs-1b {[regexp {>\[[0-9a-f]{40,64}\]<} $RESULT]}
76 test th1-docs-1c {[regexp { contains \d+ files\.} $RESULT]}
77
78 ###############################################################################
79
80
--- test/th1-docs.test
+++ test/th1-docs.test
@@ -30,50 +30,46 @@
30 if {[normalize_result] ne "1"} {
31 puts "Fossil was not compiled with Tcl support."
32 test_cleanup_then_return
33 }
34
 
 
 
 
 
 
 
 
 
35 ###############################################################################
36
37 test_setup
38
39 ###############################################################################
40
41 set env(TH1_ENABLE_DOCS) 1; # TH1 docs must be enabled for this test.
42 set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test.
43
44 ###############################################################################
45
46 set data [fossil info]
 
 
47
48 regexp -line -- {^repository: (.*)$} $data dummy repository
49
50 if {[string length $repository] == 0 || ![file exists $repository]} {
51 error "unable to locate repository"
52 }
53
54 set dataFileName [file join $::testdir th1-docs-input.txt]
55 set origFileStat [file join $::testdir fileStat.th1]
56
57 if {![file exists $origFileStat]} {
58 error "unable to locate [$origFileStat]"
59 }
60
61 file copy $origFileStat fileStat.th1
62 fossil add fileStat.th1
63 fossil commit -m "Add fileStat.th1"
64
65 ###############################################################################
66
67 set RESULT [test_fossil_http \
68 $repository $dataFileName /doc/trunk/fileStat.th1]
 
 
69
70 test th1-docs-1a {[regexp {<title>Unnamed Fossil Project: fileStat.th1</title>} $RESULT]}
71 test th1-docs-1b {[regexp {>\[[0-9a-f]{40,64}\]<} $RESULT]}
72 test th1-docs-1c {[regexp { contains \d+ files\.} $RESULT]}
73
74 ###############################################################################
75
76

Keyboard Shortcuts

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