Fossil SCM

Fix TH1 hook return code handling for errors. Cleanup and fix TH1 hook tests. Corrections to the TH1 hooks tests, taking into account 'http' sub-command argument changes.

mistachkin 2015-03-22 20:07 trunk
Commit a313f031a48c4513ba64df87b0dc946dfbe11bd5
+14 -2
--- src/th_main.c
+++ src/th_main.c
@@ -1833,10 +1833,16 @@
18331833
** Make sure that the TH1 script error was not caused by a "missing"
18341834
** command hook handler as that is not actually an error condition.
18351835
*/
18361836
if( memcmp(zResult, NO_COMMAND_HOOK_ERROR, nResult)!=0 ){
18371837
sendError(zResult, nResult, 0);
1838
+ }else{
1839
+ /*
1840
+ ** There is no command hook handler "installed". This situation
1841
+ ** is NOT actually an error.
1842
+ */
1843
+ rc = TH_OK;
18381844
}
18391845
}
18401846
/*
18411847
** If the script returned TH_ERROR (e.g. the "command_hook" TH1 command does
18421848
** not exist because commands are not being hooked), return TH_OK because we
@@ -1853,11 +1859,11 @@
18531859
** clean it up now. This is very important because some commands do not
18541860
** expect the repository and/or the configuration ("user") database to be
18551861
** open prior to their own code doing so.
18561862
*/
18571863
if( TH_INIT_HOOK & TH_INIT_NEED_CONFIG ) Th_CloseConfig(1);
1858
- return (rc != TH_ERROR) ? rc : TH_OK;
1864
+ return rc;
18591865
}
18601866
18611867
/*
18621868
** This function is called by Fossil just after dispatching a command.
18631869
** Returning a value other than TH_OK from this function (i.e. via an
@@ -1914,10 +1920,16 @@
19141920
** Make sure that the TH1 script error was not caused by a "missing"
19151921
** webpage hook handler as that is not actually an error condition.
19161922
*/
19171923
if( memcmp(zResult, NO_WEBPAGE_HOOK_ERROR, nResult)!=0 ){
19181924
sendError(zResult, nResult, 1);
1925
+ }else{
1926
+ /*
1927
+ ** There is no webpage hook handler "installed". This situation
1928
+ ** is NOT actually an error.
1929
+ */
1930
+ rc = TH_OK;
19191931
}
19201932
}
19211933
/*
19221934
** If the script returned TH_ERROR (e.g. the "webpage_hook" TH1 command does
19231935
** not exist because commands are not being hooked), return TH_OK because we
@@ -1934,11 +1946,11 @@
19341946
** clean it up now. This is very important because some commands do not
19351947
** expect the repository and/or the configuration ("user") database to be
19361948
** open prior to their own code doing so.
19371949
*/
19381950
if( TH_INIT_HOOK & TH_INIT_NEED_CONFIG ) Th_CloseConfig(1);
1939
- return (rc != TH_ERROR) ? rc : TH_OK;
1951
+ return rc;
19401952
}
19411953
19421954
/*
19431955
** This function is called by Fossil just after processing a web page.
19441956
** Returning a value other than TH_OK from this function (i.e. via an
19451957
--- src/th_main.c
+++ src/th_main.c
@@ -1833,10 +1833,16 @@
1833 ** Make sure that the TH1 script error was not caused by a "missing"
1834 ** command hook handler as that is not actually an error condition.
1835 */
1836 if( memcmp(zResult, NO_COMMAND_HOOK_ERROR, nResult)!=0 ){
1837 sendError(zResult, nResult, 0);
 
 
 
 
 
 
1838 }
1839 }
1840 /*
1841 ** If the script returned TH_ERROR (e.g. the "command_hook" TH1 command does
1842 ** not exist because commands are not being hooked), return TH_OK because we
@@ -1853,11 +1859,11 @@
1853 ** clean it up now. This is very important because some commands do not
1854 ** expect the repository and/or the configuration ("user") database to be
1855 ** open prior to their own code doing so.
1856 */
1857 if( TH_INIT_HOOK & TH_INIT_NEED_CONFIG ) Th_CloseConfig(1);
1858 return (rc != TH_ERROR) ? rc : TH_OK;
1859 }
1860
1861 /*
1862 ** This function is called by Fossil just after dispatching a command.
1863 ** Returning a value other than TH_OK from this function (i.e. via an
@@ -1914,10 +1920,16 @@
1914 ** Make sure that the TH1 script error was not caused by a "missing"
1915 ** webpage hook handler as that is not actually an error condition.
1916 */
1917 if( memcmp(zResult, NO_WEBPAGE_HOOK_ERROR, nResult)!=0 ){
1918 sendError(zResult, nResult, 1);
 
 
 
 
 
 
1919 }
1920 }
1921 /*
1922 ** If the script returned TH_ERROR (e.g. the "webpage_hook" TH1 command does
1923 ** not exist because commands are not being hooked), return TH_OK because we
@@ -1934,11 +1946,11 @@
1934 ** clean it up now. This is very important because some commands do not
1935 ** expect the repository and/or the configuration ("user") database to be
1936 ** open prior to their own code doing so.
1937 */
1938 if( TH_INIT_HOOK & TH_INIT_NEED_CONFIG ) Th_CloseConfig(1);
1939 return (rc != TH_ERROR) ? rc : TH_OK;
1940 }
1941
1942 /*
1943 ** This function is called by Fossil just after processing a web page.
1944 ** Returning a value other than TH_OK from this function (i.e. via an
1945
--- src/th_main.c
+++ src/th_main.c
@@ -1833,10 +1833,16 @@
1833 ** Make sure that the TH1 script error was not caused by a "missing"
1834 ** command hook handler as that is not actually an error condition.
1835 */
1836 if( memcmp(zResult, NO_COMMAND_HOOK_ERROR, nResult)!=0 ){
1837 sendError(zResult, nResult, 0);
1838 }else{
1839 /*
1840 ** There is no command hook handler "installed". This situation
1841 ** is NOT actually an error.
1842 */
1843 rc = TH_OK;
1844 }
1845 }
1846 /*
1847 ** If the script returned TH_ERROR (e.g. the "command_hook" TH1 command does
1848 ** not exist because commands are not being hooked), return TH_OK because we
@@ -1853,11 +1859,11 @@
1859 ** clean it up now. This is very important because some commands do not
1860 ** expect the repository and/or the configuration ("user") database to be
1861 ** open prior to their own code doing so.
1862 */
1863 if( TH_INIT_HOOK & TH_INIT_NEED_CONFIG ) Th_CloseConfig(1);
1864 return rc;
1865 }
1866
1867 /*
1868 ** This function is called by Fossil just after dispatching a command.
1869 ** Returning a value other than TH_OK from this function (i.e. via an
@@ -1914,10 +1920,16 @@
1920 ** Make sure that the TH1 script error was not caused by a "missing"
1921 ** webpage hook handler as that is not actually an error condition.
1922 */
1923 if( memcmp(zResult, NO_WEBPAGE_HOOK_ERROR, nResult)!=0 ){
1924 sendError(zResult, nResult, 1);
1925 }else{
1926 /*
1927 ** There is no webpage hook handler "installed". This situation
1928 ** is NOT actually an error.
1929 */
1930 rc = TH_OK;
1931 }
1932 }
1933 /*
1934 ** If the script returned TH_ERROR (e.g. the "webpage_hook" TH1 command does
1935 ** not exist because commands are not being hooked), return TH_OK because we
@@ -1934,11 +1946,11 @@
1946 ** clean it up now. This is very important because some commands do not
1947 ** expect the repository and/or the configuration ("user") database to be
1948 ** open prior to their own code doing so.
1949 */
1950 if( TH_INIT_HOOK & TH_INIT_NEED_CONFIG ) Th_CloseConfig(1);
1951 return rc;
1952 }
1953
1954 /*
1955 ** This function is called by Fossil just after processing a web page.
1956 ** Returning a value other than TH_OK from this function (i.e. via an
1957
--- test/tester.tcl
+++ test/tester.tcl
@@ -328,10 +328,19 @@
328328
}
329329
append out \n$line
330330
}
331331
return [string range $out 1 end]
332332
}
333
+
334
+# obtains and increments a "sequence number" for this test run.
335
+proc getSeqNo {} {
336
+ upvar #0 seqNo seqNo
337
+ if {![info exists seqNo]} {
338
+ set seqNo 0
339
+ }
340
+ return [incr seqNo]
341
+}
333342
334343
protInit $fossilexe
335344
foreach testfile $argv {
336345
set dir [file root [file tail $testfile]]
337346
file delete -force $dir
338347
--- test/tester.tcl
+++ test/tester.tcl
@@ -328,10 +328,19 @@
328 }
329 append out \n$line
330 }
331 return [string range $out 1 end]
332 }
 
 
 
 
 
 
 
 
 
333
334 protInit $fossilexe
335 foreach testfile $argv {
336 set dir [file root [file tail $testfile]]
337 file delete -force $dir
338
--- test/tester.tcl
+++ test/tester.tcl
@@ -328,10 +328,19 @@
328 }
329 append out \n$line
330 }
331 return [string range $out 1 end]
332 }
333
334 # obtains and increments a "sequence number" for this test run.
335 proc getSeqNo {} {
336 upvar #0 seqNo seqNo
337 if {![info exists seqNo]} {
338 set seqNo 0
339 }
340 return [incr seqNo]
341 }
342
343 protInit $fossilexe
344 foreach testfile $argv {
345 set dir [file root [file tail $testfile]]
346 file delete -force $dir
347
--- test/th1-hooks.test
+++ test/th1-hooks.test
@@ -29,45 +29,53 @@
2929
set env(TH1_ENABLE_HOOKS) 1; # TH1 hooks must be enabled for this test.
3030
3131
###############################################################################
3232
3333
proc fossil_th1_hook_http { repository url } {
34
- set suffix [appendArgs [pid] - [clock seconds] .txt]
34
+ set suffix [appendArgs [pid] - [getSeqNo] - [clock seconds] .txt]
3535
set inFileName [file join $::tempPath [appendArgs test-http-in- $suffix]]
3636
set outFileName [file join $::tempPath [appendArgs test-http-out- $suffix]]
3737
set data [subst [read_file [file join $::testdir th1-hooks-input.txt]]]
3838
3939
write_file $inFileName $data
40
- fossil http $repository $inFileName $outFileName 127.0.0.1
40
+ fossil http $inFileName $outFileName 127.0.0.1 $repository
4141
set result [expr {[file exists $outFileName] ? [read_file $outFileName] : ""}]
4242
4343
if {1} then {
4444
catch {file delete $inFileName}
4545
catch {file delete $outFileName}
4646
}
4747
4848
return $result
4949
}
50
+
51
+proc normalize_result {} {
52
+ return [string map [list \r\n \n] [string trim $::RESULT]]
53
+}
5054
5155
proc first_data_line {} {
52
- return [lindex [split [string trim $::RESULT] \r\n] 0]
56
+ return [lindex [split [normalize_result] \n] 0]
5357
}
5458
5559
proc second_data_line {} {
56
- return [lindex [split [string trim $::RESULT] \r\n] 1]
60
+ return [lindex [split [normalize_result] \n] 1]
5761
}
5862
5963
proc third_data_line {} {
60
- return [lindex [split [string trim $::RESULT] \r\n] 2]
64
+ return [lindex [split [normalize_result] \n] 2]
6165
}
6266
6367
proc last_data_line {} {
64
- return [lindex [split [string trim $::RESULT] \r\n] end]
68
+ return [lindex [split [normalize_result] \n] end]
6569
}
6670
6771
proc next_to_last_data_line {} {
68
- return [lindex [split [string trim $::RESULT] \r\n] end-1]
72
+ return [lindex [split [normalize_result] \n] end-1]
73
+}
74
+
75
+proc third_to_last_data_line {} {
76
+ return [lindex [split [normalize_result] \n] end-2]
6977
}
7078
7179
###############################################################################
7280
7381
set testTh1Setup {
@@ -103,13 +111,18 @@
103111
break "TH_BREAK return code"
104112
} elseif {$::cmd_name eq "test4"} {
105113
emit_hook_log
106114
return -code 2 "TH_RETURN return code"
107115
} elseif {$::cmd_name eq "timeline"} {
108
- if {$::cmd_args eq "custom"} {
116
+ set length [llength $::cmd_args]
117
+ set length [expr {$length - 1}]
118
+ if {[lindex $::cmd_args $length] eq "custom"} {
109119
emit_hook_log
110120
return "custom timeline"
121
+ } elseif {[lindex $::cmd_args $length] eq "now"} {
122
+ emit_hook_log
123
+ return "now timeline"
111124
} else {
112125
emit_hook_log
113126
error "unsupported timeline"
114127
}
115128
}
@@ -147,55 +160,79 @@
147160
saveTh1SetupFile; writeTh1SetupFile $testTh1Setup
148161
149162
###############################################################################
150163
151164
fossil timeline custom; # NOTE: Bad "WHEN" argument.
152
-test th1-cmd-hooks-1a {[string map [list \r\n \n] [string trim $RESULT]] eq {<h1><b>command_hook timeline</b></h1>
153
-ERROR: unsupported timeline
165
+test th1-cmd-hooks-1a {[normalize_result] eq \
166
+{<h1><b>command_hook timeline</b></h1>
154167
+++ no more data (0) +++
155168
156169
<h1><b>command_hook timeline command_notify timeline</b></h1>}}
157170
158171
###############################################################################
159172
160173
fossil timeline
161
-test th1-cmd-hooks-2a {[first_data_line] eq {<h1><b>command_hook timeline</b></h1>}}
174
+test th1-cmd-hooks-2a {[first_data_line] eq \
175
+ {<h1><b>command_hook timeline</b></h1>}}
176
+
162177
test th1-cmd-hooks-2b {[second_data_line] eq {ERROR: unsupported timeline}}
163
-test th1-cmd-hooks-2c {[regexp -- {=== \d{4}-\d{2}-\d{2} ===} [third_data_line]]}
164
-test th1-cmd-hooks-2d {[last_data_line] eq {<h1><b>command_hook timeline command_notify timeline</b></h1>}}
178
+
179
+###############################################################################
180
+
181
+fossil timeline now
182
+test th1-cmd-hooks-3a {[first_data_line] eq \
183
+ {<h1><b>command_hook timeline</b></h1>}}
184
+
185
+test th1-cmd-hooks-3b \
186
+ {[regexp -- {=== \d{4}-\d{2}-\d{2} ===} [second_data_line]]}
187
+
188
+test th1-cmd-hooks-3c \
189
+ {[regexp -- {--- line limit \(\d+\) reached ---} [third_to_last_data_line]]}
190
+
191
+test th1-cmd-hooks-3d {[last_data_line] eq \
192
+ {<h1><b>command_hook timeline command_notify timeline</b></h1>}}
165193
166194
###############################################################################
167195
168196
fossil test1
169197
test th1-custom-cmd-1a {[next_to_last_data_line] eq $repository}
170
-test th1-custom-cmd-1b {[last_data_line] eq {<h1><b>command_hook test1 command_notify test1</b></h1>}}
198
+
199
+test th1-custom-cmd-1b {[last_data_line] eq \
200
+ {<h1><b>command_hook test1 command_notify test1</b></h1>}}
171201
172202
###############################################################################
173203
174204
fossil test2
175205
test th1-custom-cmd-2a {[first_data_line] eq {ERROR: unsupported command}}
176206
177207
###############################################################################
178208
179209
fossil test3
180
-test th1-custom-cmd-3a {[string trim $RESULT] eq {<h1><b>command_hook test3</b></h1>}}
210
+test th1-custom-cmd-3a {[string trim $RESULT] eq \
211
+ {<h1><b>command_hook test3</b></h1>}}
181212
182213
###############################################################################
183214
184215
fossil test4
185
-test th1-custom-cmd-4a {[string trim $RESULT] eq {<h1><b>command_hook test4</b></h1>}}
216
+test th1-custom-cmd-4a {[string trim $RESULT] eq \
217
+ {<h1><b>command_hook test4</b></h1>}}
186218
187219
###############################################################################
188220
189221
set RESULT [fossil_th1_hook_http $repository /timeline]
190222
test th1-web-hooks-1a {[regexp {<title>Fossil: Timeline</title>} $RESULT]}
191
-test th1-web-hooks-1b {[regexp {<h1><b>command_hook http webpage_hook timeline webpage_notify timeline</b></h1>} $RESULT]}
223
+
224
+test th1-web-hooks-1b {[regexp [appendArgs \
225
+ {<h1><b>command_hook http webpage_hook timeline} " " \
226
+ {webpage_notify timeline</b></h1>}] $RESULT]}
192227
193228
###############################################################################
194229
195230
set RESULT [fossil_th1_hook_http $repository /test1]
196231
test th1-custom-web-1a {[next_to_last_data_line] eq $repository}
197
-test th1-custom-web-1b {[last_data_line] eq {<h1><b>command_hook http webpage_hook test1 webpage_notify test1</b></h1>}}
232
+
233
+test th1-custom-web-1b {[last_data_line] eq \
234
+ {<h1><b>command_hook http webpage_hook test1 webpage_notify test1</b></h1>}}
198235
199236
###############################################################################
200237
201238
restoreTh1SetupFile
202239
--- test/th1-hooks.test
+++ test/th1-hooks.test
@@ -29,45 +29,53 @@
29 set env(TH1_ENABLE_HOOKS) 1; # TH1 hooks must be enabled for this test.
30
31 ###############################################################################
32
33 proc fossil_th1_hook_http { repository url } {
34 set suffix [appendArgs [pid] - [clock seconds] .txt]
35 set inFileName [file join $::tempPath [appendArgs test-http-in- $suffix]]
36 set outFileName [file join $::tempPath [appendArgs test-http-out- $suffix]]
37 set data [subst [read_file [file join $::testdir th1-hooks-input.txt]]]
38
39 write_file $inFileName $data
40 fossil http $repository $inFileName $outFileName 127.0.0.1
41 set result [expr {[file exists $outFileName] ? [read_file $outFileName] : ""}]
42
43 if {1} then {
44 catch {file delete $inFileName}
45 catch {file delete $outFileName}
46 }
47
48 return $result
49 }
 
 
 
 
50
51 proc first_data_line {} {
52 return [lindex [split [string trim $::RESULT] \r\n] 0]
53 }
54
55 proc second_data_line {} {
56 return [lindex [split [string trim $::RESULT] \r\n] 1]
57 }
58
59 proc third_data_line {} {
60 return [lindex [split [string trim $::RESULT] \r\n] 2]
61 }
62
63 proc last_data_line {} {
64 return [lindex [split [string trim $::RESULT] \r\n] end]
65 }
66
67 proc next_to_last_data_line {} {
68 return [lindex [split [string trim $::RESULT] \r\n] end-1]
 
 
 
 
69 }
70
71 ###############################################################################
72
73 set testTh1Setup {
@@ -103,13 +111,18 @@
103 break "TH_BREAK return code"
104 } elseif {$::cmd_name eq "test4"} {
105 emit_hook_log
106 return -code 2 "TH_RETURN return code"
107 } elseif {$::cmd_name eq "timeline"} {
108 if {$::cmd_args eq "custom"} {
 
 
109 emit_hook_log
110 return "custom timeline"
 
 
 
111 } else {
112 emit_hook_log
113 error "unsupported timeline"
114 }
115 }
@@ -147,55 +160,79 @@
147 saveTh1SetupFile; writeTh1SetupFile $testTh1Setup
148
149 ###############################################################################
150
151 fossil timeline custom; # NOTE: Bad "WHEN" argument.
152 test th1-cmd-hooks-1a {[string map [list \r\n \n] [string trim $RESULT]] eq {<h1><b>command_hook timeline</b></h1>
153 ERROR: unsupported timeline
154 +++ no more data (0) +++
155
156 <h1><b>command_hook timeline command_notify timeline</b></h1>}}
157
158 ###############################################################################
159
160 fossil timeline
161 test th1-cmd-hooks-2a {[first_data_line] eq {<h1><b>command_hook timeline</b></h1>}}
 
 
162 test th1-cmd-hooks-2b {[second_data_line] eq {ERROR: unsupported timeline}}
163 test th1-cmd-hooks-2c {[regexp -- {=== \d{4}-\d{2}-\d{2} ===} [third_data_line]]}
164 test th1-cmd-hooks-2d {[last_data_line] eq {<h1><b>command_hook timeline command_notify timeline</b></h1>}}
 
 
 
 
 
 
 
 
 
 
 
 
 
165
166 ###############################################################################
167
168 fossil test1
169 test th1-custom-cmd-1a {[next_to_last_data_line] eq $repository}
170 test th1-custom-cmd-1b {[last_data_line] eq {<h1><b>command_hook test1 command_notify test1</b></h1>}}
 
 
171
172 ###############################################################################
173
174 fossil test2
175 test th1-custom-cmd-2a {[first_data_line] eq {ERROR: unsupported command}}
176
177 ###############################################################################
178
179 fossil test3
180 test th1-custom-cmd-3a {[string trim $RESULT] eq {<h1><b>command_hook test3</b></h1>}}
 
181
182 ###############################################################################
183
184 fossil test4
185 test th1-custom-cmd-4a {[string trim $RESULT] eq {<h1><b>command_hook test4</b></h1>}}
 
186
187 ###############################################################################
188
189 set RESULT [fossil_th1_hook_http $repository /timeline]
190 test th1-web-hooks-1a {[regexp {<title>Fossil: Timeline</title>} $RESULT]}
191 test th1-web-hooks-1b {[regexp {<h1><b>command_hook http webpage_hook timeline webpage_notify timeline</b></h1>} $RESULT]}
 
 
 
192
193 ###############################################################################
194
195 set RESULT [fossil_th1_hook_http $repository /test1]
196 test th1-custom-web-1a {[next_to_last_data_line] eq $repository}
197 test th1-custom-web-1b {[last_data_line] eq {<h1><b>command_hook http webpage_hook test1 webpage_notify test1</b></h1>}}
 
 
198
199 ###############################################################################
200
201 restoreTh1SetupFile
202
--- test/th1-hooks.test
+++ test/th1-hooks.test
@@ -29,45 +29,53 @@
29 set env(TH1_ENABLE_HOOKS) 1; # TH1 hooks must be enabled for this test.
30
31 ###############################################################################
32
33 proc fossil_th1_hook_http { repository url } {
34 set suffix [appendArgs [pid] - [getSeqNo] - [clock seconds] .txt]
35 set inFileName [file join $::tempPath [appendArgs test-http-in- $suffix]]
36 set outFileName [file join $::tempPath [appendArgs test-http-out- $suffix]]
37 set data [subst [read_file [file join $::testdir th1-hooks-input.txt]]]
38
39 write_file $inFileName $data
40 fossil http $inFileName $outFileName 127.0.0.1 $repository
41 set result [expr {[file exists $outFileName] ? [read_file $outFileName] : ""}]
42
43 if {1} then {
44 catch {file delete $inFileName}
45 catch {file delete $outFileName}
46 }
47
48 return $result
49 }
50
51 proc normalize_result {} {
52 return [string map [list \r\n \n] [string trim $::RESULT]]
53 }
54
55 proc first_data_line {} {
56 return [lindex [split [normalize_result] \n] 0]
57 }
58
59 proc second_data_line {} {
60 return [lindex [split [normalize_result] \n] 1]
61 }
62
63 proc third_data_line {} {
64 return [lindex [split [normalize_result] \n] 2]
65 }
66
67 proc last_data_line {} {
68 return [lindex [split [normalize_result] \n] end]
69 }
70
71 proc next_to_last_data_line {} {
72 return [lindex [split [normalize_result] \n] end-1]
73 }
74
75 proc third_to_last_data_line {} {
76 return [lindex [split [normalize_result] \n] end-2]
77 }
78
79 ###############################################################################
80
81 set testTh1Setup {
@@ -103,13 +111,18 @@
111 break "TH_BREAK return code"
112 } elseif {$::cmd_name eq "test4"} {
113 emit_hook_log
114 return -code 2 "TH_RETURN return code"
115 } elseif {$::cmd_name eq "timeline"} {
116 set length [llength $::cmd_args]
117 set length [expr {$length - 1}]
118 if {[lindex $::cmd_args $length] eq "custom"} {
119 emit_hook_log
120 return "custom timeline"
121 } elseif {[lindex $::cmd_args $length] eq "now"} {
122 emit_hook_log
123 return "now timeline"
124 } else {
125 emit_hook_log
126 error "unsupported timeline"
127 }
128 }
@@ -147,55 +160,79 @@
160 saveTh1SetupFile; writeTh1SetupFile $testTh1Setup
161
162 ###############################################################################
163
164 fossil timeline custom; # NOTE: Bad "WHEN" argument.
165 test th1-cmd-hooks-1a {[normalize_result] eq \
166 {<h1><b>command_hook timeline</b></h1>
167 +++ no more data (0) +++
168
169 <h1><b>command_hook timeline command_notify timeline</b></h1>}}
170
171 ###############################################################################
172
173 fossil timeline
174 test th1-cmd-hooks-2a {[first_data_line] eq \
175 {<h1><b>command_hook timeline</b></h1>}}
176
177 test th1-cmd-hooks-2b {[second_data_line] eq {ERROR: unsupported timeline}}
178
179 ###############################################################################
180
181 fossil timeline now
182 test th1-cmd-hooks-3a {[first_data_line] eq \
183 {<h1><b>command_hook timeline</b></h1>}}
184
185 test th1-cmd-hooks-3b \
186 {[regexp -- {=== \d{4}-\d{2}-\d{2} ===} [second_data_line]]}
187
188 test th1-cmd-hooks-3c \
189 {[regexp -- {--- line limit \(\d+\) reached ---} [third_to_last_data_line]]}
190
191 test th1-cmd-hooks-3d {[last_data_line] eq \
192 {<h1><b>command_hook timeline command_notify timeline</b></h1>}}
193
194 ###############################################################################
195
196 fossil test1
197 test th1-custom-cmd-1a {[next_to_last_data_line] eq $repository}
198
199 test th1-custom-cmd-1b {[last_data_line] eq \
200 {<h1><b>command_hook test1 command_notify test1</b></h1>}}
201
202 ###############################################################################
203
204 fossil test2
205 test th1-custom-cmd-2a {[first_data_line] eq {ERROR: unsupported command}}
206
207 ###############################################################################
208
209 fossil test3
210 test th1-custom-cmd-3a {[string trim $RESULT] eq \
211 {<h1><b>command_hook test3</b></h1>}}
212
213 ###############################################################################
214
215 fossil test4
216 test th1-custom-cmd-4a {[string trim $RESULT] eq \
217 {<h1><b>command_hook test4</b></h1>}}
218
219 ###############################################################################
220
221 set RESULT [fossil_th1_hook_http $repository /timeline]
222 test th1-web-hooks-1a {[regexp {<title>Fossil: Timeline</title>} $RESULT]}
223
224 test th1-web-hooks-1b {[regexp [appendArgs \
225 {<h1><b>command_hook http webpage_hook timeline} " " \
226 {webpage_notify timeline</b></h1>}] $RESULT]}
227
228 ###############################################################################
229
230 set RESULT [fossil_th1_hook_http $repository /test1]
231 test th1-custom-web-1a {[next_to_last_data_line] eq $repository}
232
233 test th1-custom-web-1b {[last_data_line] eq \
234 {<h1><b>command_hook http webpage_hook test1 webpage_notify test1</b></h1>}}
235
236 ###############################################################################
237
238 restoreTh1SetupFile
239

Keyboard Shortcuts

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