Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Minor style and comment cleanup. Add verify_all_options() to several TH1 test commands. Add 'test-th-source' test command, with test. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f141fbeac5d923217477673b04e3ac9b |
User & Date: | mistachkin 2016-01-28 05:37:31.711 |
Context
2016-01-28
| ||
19:48 | Update referenced OpenSSL version. ... (check-in: 0c860dd9 user: mistachkin tags: trunk) | |
05:37 | Minor style and comment cleanup. Add verify_all_options() to several TH1 test commands. Add 'test-th-source' test command, with test. ... (check-in: f141fbea user: mistachkin tags: trunk) | |
00:08 | Make the MSVC batch build tool sub-routine 'fn_UnsetVariable' a bit more robust. ... (check-in: 8e9cdd24 user: mistachkin tags: trunk) | |
Changes
Changes to src/th_main.c.
︙ | ︙ | |||
2289 2290 2291 2292 2293 2294 2295 | ** ** --cgi Include a CGI response header in the output ** --http Include an HTTP response header in the output ** --open-config Open the configuration database ** --th-trace Trace TH1 execution (for debugging purposes) */ void test_th_render(void){ | | | 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 | ** ** --cgi Include a CGI response header in the output ** --http Include an HTTP response header in the output ** --open-config Open the configuration database ** --th-trace Trace TH1 execution (for debugging purposes) */ void test_th_render(void){ int forceCgi, fullHttpReply; Blob in; Th_InitTraceLog(); forceCgi = find_option("cgi", 0, 0)!=0; fullHttpReply = find_option("http", 0, 0)!=0; if( fullHttpReply ) forceCgi = 1; if( forceCgi ) Th_ForceCgi(fullHttpReply); if( find_option("open-config", 0, 0)!=0 ){ |
︙ | ︙ | |||
2316 2317 2318 2319 2320 2321 2322 | /* ** COMMAND: test-th-eval ** ** Usage: %fossil test-th-eval SCRIPT ** ** Evaluate SCRIPT as if it were a header or footer or ticket rendering | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 | /* ** COMMAND: test-th-eval ** ** Usage: %fossil test-th-eval SCRIPT ** ** Evaluate SCRIPT as if it were a header or footer or ticket rendering ** script and show the results on standard output. ** ** Options: ** ** --cgi Include a CGI response header in the output ** --http Include an HTTP response header in the output ** --open-config Open the configuration database ** --th-trace Trace TH1 execution (for debugging purposes) */ void test_th_eval(void){ int rc; const char *zRc; int forceCgi, fullHttpReply; Th_InitTraceLog(); forceCgi = find_option("cgi", 0, 0)!=0; fullHttpReply = find_option("http", 0, 0)!=0; if( fullHttpReply ) forceCgi = 1; if( forceCgi ) Th_ForceCgi(fullHttpReply); if( find_option("open-config", 0, 0)!=0 ){ Th_OpenConfig(1); } verify_all_options(); if( g.argc!=3 ){ usage("script"); } Th_FossilInit(TH_INIT_DEFAULT); rc = Th_Eval(g.interp, 0, g.argv[2], -1); zRc = Th_ReturnCodeName(rc, 1); fossil_print("%s%s%s\n", zRc, zRc ? ": " : "", Th_GetResult(g.interp, 0)); Th_PrintTraceLog(); if( forceCgi ) cgi_reply(); } /* ** COMMAND: test-th-source ** ** Usage: %fossil test-th-source FILE ** ** Evaluate the contents of the file named "FILE" as if it were a header ** or footer or ticket rendering script and show the results on standard ** output. ** ** Options: ** ** --cgi Include a CGI response header in the output ** --http Include an HTTP response header in the output ** --open-config Open the configuration database ** --th-trace Trace TH1 execution (for debugging purposes) */ void test_th_source(void){ int rc; const char *zRc; int forceCgi, fullHttpReply; Blob in; Th_InitTraceLog(); forceCgi = find_option("cgi", 0, 0)!=0; fullHttpReply = find_option("http", 0, 0)!=0; if( fullHttpReply ) forceCgi = 1; if( forceCgi ) Th_ForceCgi(fullHttpReply); if( find_option("open-config", 0, 0)!=0 ){ Th_OpenConfig(1); } verify_all_options(); if( g.argc!=3 ){ usage("file"); } blob_zero(&in); blob_read_from_file(&in, g.argv[2]); Th_FossilInit(TH_INIT_DEFAULT); rc = Th_Eval(g.interp, 0, blob_str(&in), -1); zRc = Th_ReturnCodeName(rc, 1); fossil_print("%s%s%s\n", zRc, zRc ? ": " : "", Th_GetResult(g.interp, 0)); Th_PrintTraceLog(); if( forceCgi ) cgi_reply(); } #ifdef FOSSIL_ENABLE_TH1_HOOKS /* ** COMMAND: test-th-hook ** ** Usage: %fossil test-th-hook TYPE NAME FLAGS ** ** Evaluates the TH1 script configured for the pre-operation (i.e. a command ** or web page) "hook" or post-operation "notification". The results of the ** script evaluation, if any, will be printed to the standard output channel. ** The NAME argument must be the name of a command or web page; however, it ** does not necessarily have to be a command or web page that is normally ** recognized by Fossil. The FLAGS argument will be used to set the value ** of the "cmd_flags" and/or "web_flags" TH1 variables, if applicable. The ** TYPE argument must be one of the following: |
︙ | ︙ | |||
2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 | char *zResult = 0; int forceCgi, fullHttpReply; Th_InitTraceLog(); forceCgi = find_option("cgi", 0, 0)!=0; fullHttpReply = find_option("http", 0, 0)!=0; if( fullHttpReply ) forceCgi = 1; if( forceCgi ) Th_ForceCgi(fullHttpReply); if( g.argc<5 ){ usage("TYPE NAME FLAGS"); } if( fossil_stricmp(g.argv[2], "cmdhook")==0 ){ rc = Th_CommandHook(g.argv[3], (char)atoi(g.argv[4])); }else if( fossil_stricmp(g.argv[2], "cmdnotify")==0 ){ rc = Th_CommandNotify(g.argv[3], (char)atoi(g.argv[4])); | > | 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 | char *zResult = 0; int forceCgi, fullHttpReply; Th_InitTraceLog(); forceCgi = find_option("cgi", 0, 0)!=0; fullHttpReply = find_option("http", 0, 0)!=0; if( fullHttpReply ) forceCgi = 1; if( forceCgi ) Th_ForceCgi(fullHttpReply); verify_all_options(); if( g.argc<5 ){ usage("TYPE NAME FLAGS"); } if( fossil_stricmp(g.argv[2], "cmdhook")==0 ){ rc = Th_CommandHook(g.argv[3], (char)atoi(g.argv[4])); }else if( fossil_stricmp(g.argv[2], "cmdnotify")==0 ){ rc = Th_CommandNotify(g.argv[3], (char)atoi(g.argv[4])); |
︙ | ︙ |
Changes to test/th1.test.
︙ | ︙ | |||
1434 1435 1436 1437 1438 1439 1440 | fossil test-th-eval {set tcl_platform(engine)} test th1-platform-3 {$RESULT eq "TH1"} ############################################################################### fossil test-th-eval {set tcl_platform(platform)} test th1-platform-4 {$RESULT eq "windows" || $RESULT eq "unix"} | > > > > > > > > > > > > > > > > > | 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 | fossil test-th-eval {set tcl_platform(engine)} test th1-platform-3 {$RESULT eq "TH1"} ############################################################################### fossil test-th-eval {set tcl_platform(platform)} test th1-platform-4 {$RESULT eq "windows" || $RESULT eq "unix"} ############################################################################### set th1FileName [file join $::tempPath th1-[pid].th1] write_file $th1FileName { set x "" for {set i 0} {$i < 10} {set i [expr {$i + 1}]} { set x "$x $i" } return [string trim $x] set y; # NOTE: Never hit. } fossil test-th-source $th1FileName test th1-source-1 {$RESULT eq {TH_RETURN: 0 1 2 3 4 5 6 7 8 9}} file delete $th1FileName |