Fossil SCM

Modify 'th1-hooks' test to decouple it from needing to run within a Fossil source checkout.

mistachkin 2016-01-11 00:40 trunk
Commit 9bfdc5c68208f5e3b98b8f95d367b9fd37d0f84b
+4 -3
--- test/tester.tcl
+++ test/tester.tcl
@@ -249,12 +249,11 @@
249249
#
250250
# NOTE: This uses the "testdir" global variable provided by the
251251
# test suite; alternatively, the root of the source tree
252252
# could be obtained directly from Fossil.
253253
#
254
- return [file normalize [file join [file dirname $::testdir] \
255
- .fossil-settings th1-setup]]
254
+ return [file normalize [file join .fossil-settings th1-setup]]
256255
}
257256
258257
# Return the saved name of the versioned settings file containing
259258
# the TH1 setup script.
260259
#
@@ -267,11 +266,13 @@
267266
# preserve the existing TH1 setup script. Prior to completing the test,
268267
# the [restoreTh1SetupFile] procedure should be called to restore the
269268
# original TH1 setup script.
270269
#
271270
proc writeTh1SetupFile { data } {
272
- return [write_file [getTh1SetupFileName] $data]
271
+ set fileName [getTh1SetupFileName]
272
+ file mkdir [file dirname $fileName]
273
+ return [write_file $fileName $data]
273274
}
274275
275276
# Saves the TH1 setup script file by renaming it, based on the current
276277
# process ID.
277278
#
278279
--- test/tester.tcl
+++ test/tester.tcl
@@ -249,12 +249,11 @@
249 #
250 # NOTE: This uses the "testdir" global variable provided by the
251 # test suite; alternatively, the root of the source tree
252 # could be obtained directly from Fossil.
253 #
254 return [file normalize [file join [file dirname $::testdir] \
255 .fossil-settings th1-setup]]
256 }
257
258 # Return the saved name of the versioned settings file containing
259 # the TH1 setup script.
260 #
@@ -267,11 +266,13 @@
267 # preserve the existing TH1 setup script. Prior to completing the test,
268 # the [restoreTh1SetupFile] procedure should be called to restore the
269 # original TH1 setup script.
270 #
271 proc writeTh1SetupFile { data } {
272 return [write_file [getTh1SetupFileName] $data]
 
 
273 }
274
275 # Saves the TH1 setup script file by renaming it, based on the current
276 # process ID.
277 #
278
--- test/tester.tcl
+++ test/tester.tcl
@@ -249,12 +249,11 @@
249 #
250 # NOTE: This uses the "testdir" global variable provided by the
251 # test suite; alternatively, the root of the source tree
252 # could be obtained directly from Fossil.
253 #
254 return [file normalize [file join .fossil-settings th1-setup]]
 
255 }
256
257 # Return the saved name of the versioned settings file containing
258 # the TH1 setup script.
259 #
@@ -267,11 +266,13 @@
266 # preserve the existing TH1 setup script. Prior to completing the test,
267 # the [restoreTh1SetupFile] procedure should be called to restore the
268 # original TH1 setup script.
269 #
270 proc writeTh1SetupFile { data } {
271 set fileName [getTh1SetupFileName]
272 file mkdir [file dirname $fileName]
273 return [write_file $fileName $data]
274 }
275
276 # Saves the TH1 setup script file by renaming it, based on the current
277 # process ID.
278 #
279
--- test/th1-hooks.test
+++ test/th1-hooks.test
@@ -24,10 +24,15 @@
2424
puts "Fossil was not compiled with TH1 hooks support."; return
2525
}
2626
2727
###############################################################################
2828
29
+repo_init
30
+write_file f1 "f1"; fossil add f1; fossil commit -m "c1"
31
+
32
+###############################################################################
33
+
2934
set env(TH1_ENABLE_HOOKS) 1; # TH1 hooks must be enabled for this test.
3035
3136
###############################################################################
3237
3338
set testTh1Setup {
@@ -130,11 +135,11 @@
130135
131136
test th1-cmd-hooks-2b {[second_data_line] eq {ERROR: unsupported timeline}}
132137
133138
###############################################################################
134139
135
-fossil timeline now
140
+fossil timeline -n -1 now
136141
test th1-cmd-hooks-3a {[first_data_line] eq \
137142
{<h1><b>command_hook timeline</b></h1>}}
138143
139144
test th1-cmd-hooks-3b \
140145
{[regexp -- {=== \d{4}-\d{2}-\d{2} ===} [second_data_line]]}
@@ -171,11 +176,13 @@
171176
{<h1><b>command_hook test4</b></h1>}}
172177
173178
###############################################################################
174179
175180
set RESULT [test_fossil_http $repository $dataFileName /timeline]
176
-test th1-web-hooks-1a {[regexp {<title>Fossil: Timeline</title>} $RESULT]}
181
+
182
+test th1-web-hooks-1a {[regexp \
183
+ {<title>Unnamed Fossil Project: Timeline</title>} $RESULT]}
177184
178185
test th1-web-hooks-1b {[regexp [appendArgs \
179186
{<h1><b>command_hook http webpage_hook timeline} " " \
180187
{webpage_notify timeline</b></h1>}] $RESULT]}
181188
182189
--- test/th1-hooks.test
+++ test/th1-hooks.test
@@ -24,10 +24,15 @@
24 puts "Fossil was not compiled with TH1 hooks support."; return
25 }
26
27 ###############################################################################
28
 
 
 
 
 
29 set env(TH1_ENABLE_HOOKS) 1; # TH1 hooks must be enabled for this test.
30
31 ###############################################################################
32
33 set testTh1Setup {
@@ -130,11 +135,11 @@
130
131 test th1-cmd-hooks-2b {[second_data_line] eq {ERROR: unsupported timeline}}
132
133 ###############################################################################
134
135 fossil timeline now
136 test th1-cmd-hooks-3a {[first_data_line] eq \
137 {<h1><b>command_hook timeline</b></h1>}}
138
139 test th1-cmd-hooks-3b \
140 {[regexp -- {=== \d{4}-\d{2}-\d{2} ===} [second_data_line]]}
@@ -171,11 +176,13 @@
171 {<h1><b>command_hook test4</b></h1>}}
172
173 ###############################################################################
174
175 set RESULT [test_fossil_http $repository $dataFileName /timeline]
176 test th1-web-hooks-1a {[regexp {<title>Fossil: Timeline</title>} $RESULT]}
 
 
177
178 test th1-web-hooks-1b {[regexp [appendArgs \
179 {<h1><b>command_hook http webpage_hook timeline} " " \
180 {webpage_notify timeline</b></h1>}] $RESULT]}
181
182
--- test/th1-hooks.test
+++ test/th1-hooks.test
@@ -24,10 +24,15 @@
24 puts "Fossil was not compiled with TH1 hooks support."; return
25 }
26
27 ###############################################################################
28
29 repo_init
30 write_file f1 "f1"; fossil add f1; fossil commit -m "c1"
31
32 ###############################################################################
33
34 set env(TH1_ENABLE_HOOKS) 1; # TH1 hooks must be enabled for this test.
35
36 ###############################################################################
37
38 set testTh1Setup {
@@ -130,11 +135,11 @@
135
136 test th1-cmd-hooks-2b {[second_data_line] eq {ERROR: unsupported timeline}}
137
138 ###############################################################################
139
140 fossil timeline -n -1 now
141 test th1-cmd-hooks-3a {[first_data_line] eq \
142 {<h1><b>command_hook timeline</b></h1>}}
143
144 test th1-cmd-hooks-3b \
145 {[regexp -- {=== \d{4}-\d{2}-\d{2} ===} [second_data_line]]}
@@ -171,11 +176,13 @@
176 {<h1><b>command_hook test4</b></h1>}}
177
178 ###############################################################################
179
180 set RESULT [test_fossil_http $repository $dataFileName /timeline]
181
182 test th1-web-hooks-1a {[regexp \
183 {<title>Unnamed Fossil Project: Timeline</title>} $RESULT]}
184
185 test th1-web-hooks-1b {[regexp [appendArgs \
186 {<h1><b>command_hook http webpage_hook timeline} " " \
187 {webpage_notify timeline</b></h1>}] $RESULT]}
188
189

Keyboard Shortcuts

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