Fossil SCM

Add the 'checkout', 'render', 'styleHeader', 'styleFooter', 'trace', 'getParameter', and 'setParameter' TH1 commands.

mistachkin 2014-06-14 20:07 trunk merge
Commit 57be4d552ef2ec210fb7c7fc4482e14f3d5d7dc8
2 files changed +170 +134
+170
--- src/th_main.c
+++ src/th_main.c
@@ -572,10 +572,173 @@
572572
if( openRepository ) db_find_and_open_repository(OPEN_OK_NOT_FOUND, 0);
573573
}
574574
Th_SetResult(interp, g.zRepositoryName, -1);
575575
return TH_OK;
576576
}
577
+
578
+/*
579
+** TH1 command: checkout ?BOOLEAN?
580
+**
581
+** Return the fully qualified directory name of the current checkout or an
582
+** empty string if it is not available.
583
+*/
584
+static int checkoutCmd(
585
+ Th_Interp *interp,
586
+ void *p,
587
+ int argc,
588
+ const char **argv,
589
+ int *argl
590
+){
591
+ if( argc!=1 && argc!=2 ){
592
+ return Th_WrongNumArgs(interp, "checkout ?BOOLEAN?");
593
+ }
594
+ if( argc==2 ){
595
+ int openRepository = 0;
596
+ if( Th_ToInt(interp, argv[1], argl[1], &openRepository) ){
597
+ return TH_ERROR;
598
+ }
599
+ if( openRepository ) db_find_and_open_repository(OPEN_OK_NOT_FOUND, 0);
600
+ }
601
+ Th_SetResult(interp, g.zLocalRoot, -1);
602
+ return TH_OK;
603
+}
604
+
605
+/*
606
+** TH1 command: trace STRING
607
+**
608
+** Generate a TH1 trace message if debugging is enabled.
609
+*/
610
+static int traceCmd(
611
+ Th_Interp *interp,
612
+ void *p,
613
+ int argc,
614
+ const char **argv,
615
+ int *argl
616
+){
617
+ if( argc!=2 ){
618
+ return Th_WrongNumArgs(interp, "trace STRING");
619
+ }
620
+ if( g.thTrace ){
621
+ Th_Trace("%s", argv[1]);
622
+ }
623
+ Th_SetResult(interp, 0, 0);
624
+ return TH_OK;
625
+}
626
+
627
+/*
628
+** TH1 command: getParameter NAME ?DEFAULT?
629
+**
630
+** Return the value of the specified query parameter or the specified default
631
+** value when there is no matching query parameter.
632
+*/
633
+static int getParameterCmd(
634
+ Th_Interp *interp,
635
+ void *p,
636
+ int argc,
637
+ const char **argv,
638
+ int *argl
639
+){
640
+ const char *zDefault = 0;
641
+ if( argc!=2 && argc!=3 ){
642
+ return Th_WrongNumArgs(interp, "getParameter NAME ?DEFAULT?");
643
+ }
644
+ if( argc==3 ){
645
+ zDefault = argv[2];
646
+ }
647
+ Th_SetResult(interp, cgi_parameter(argv[1], zDefault), -1);
648
+ return TH_OK;
649
+}
650
+
651
+/*
652
+** TH1 command: setParameter NAME VALUE
653
+**
654
+** Sets the value of the specified query parameter.
655
+*/
656
+static int setParameterCmd(
657
+ Th_Interp *interp,
658
+ void *p,
659
+ int argc,
660
+ const char **argv,
661
+ int *argl
662
+){
663
+ if( argc!=3 ){
664
+ return Th_WrongNumArgs(interp, "setParameter NAME VALUE");
665
+ }
666
+ cgi_replace_parameter(mprintf("%s", argv[1]), mprintf("%s", argv[2]));
667
+ return TH_OK;
668
+}
669
+
670
+/*
671
+** TH1 command: render STRING
672
+**
673
+** Renders the template and writes the results.
674
+*/
675
+static int renderCmd(
676
+ Th_Interp *interp,
677
+ void *p,
678
+ int argc,
679
+ const char **argv,
680
+ int *argl
681
+){
682
+ int rc;
683
+ if( argc!=2 ){
684
+ return Th_WrongNumArgs(interp, "render STRING");
685
+ }
686
+ rc = Th_Render(argv[1]);
687
+ Th_SetResult(interp, 0, 0);
688
+ return rc;
689
+}
690
+
691
+/*
692
+** TH1 command: styleHeader TITLE
693
+**
694
+** Render the configured style header.
695
+*/
696
+static int styleHeaderCmd(
697
+ Th_Interp *interp,
698
+ void *p,
699
+ int argc,
700
+ const char **argv,
701
+ int *argl
702
+){
703
+ if( argc!=2 ){
704
+ return Th_WrongNumArgs(interp, "styleHeader TITLE");
705
+ }
706
+ if( g.zConfigDbName ){
707
+ style_header("%s", argv[1]);
708
+ Th_SetResult(interp, 0, 0);
709
+ return TH_OK;
710
+ }else{
711
+ Th_SetResult(interp, "configuration unavailable", -1);
712
+ return TH_ERROR;
713
+ }
714
+}
715
+
716
+/*
717
+** TH1 command: styleFooter
718
+**
719
+** Render the configured style footer.
720
+*/
721
+static int styleFooterCmd(
722
+ Th_Interp *interp,
723
+ void *p,
724
+ int argc,
725
+ const char **argv,
726
+ int *argl
727
+){
728
+ if( argc!=1 ){
729
+ return Th_WrongNumArgs(interp, "styleFooter");
730
+ }
731
+ if( g.zConfigDbName ){
732
+ style_footer();
733
+ Th_SetResult(interp, 0, 0);
734
+ return TH_OK;
735
+ }else{
736
+ Th_SetResult(interp, "configuration unavailable", -1);
737
+ return TH_ERROR;
738
+ }
739
+}
577740
578741
#ifdef _WIN32
579742
# include <windows.h>
580743
#else
581744
# include <sys/time.h>
@@ -1004,14 +1167,16 @@
10041167
const char *zName;
10051168
Th_CommandProc xProc;
10061169
void *pContext;
10071170
} aCommand[] = {
10081171
{"anycap", anycapCmd, 0},
1172
+ {"checkout", checkoutCmd, 0},
10091173
{"combobox", comboboxCmd, 0},
10101174
{"date", dateCmd, 0},
10111175
{"decorate", wikiCmd, (void*)&aFlags[2]},
10121176
{"enable_output", enableOutputCmd, 0},
1177
+ {"getParameter", getParameterCmd, 0},
10131178
{"httpize", httpizeCmd, 0},
10141179
{"hascap", hascapCmd, 0},
10151180
{"hasfeature", hasfeatureCmd, 0},
10161181
{"html", putsCmd, (void*)&aFlags[0]},
10171182
{"htmlize", htmlizeCmd, 0},
@@ -1019,13 +1184,18 @@
10191184
{"linecount", linecntCmd, 0},
10201185
{"puts", putsCmd, (void*)&aFlags[1]},
10211186
{"query", queryCmd, 0},
10221187
{"randhex", randhexCmd, 0},
10231188
{"regexp", regexpCmd, 0},
1189
+ {"render", renderCmd, 0},
10241190
{"repository", repositoryCmd, 0},
1191
+ {"setParameter", setParameterCmd, 0},
10251192
{"setting", settingCmd, 0},
1193
+ {"styleHeader", styleHeaderCmd, 0},
1194
+ {"styleFooter", styleFooterCmd, 0},
10261195
{"tclReady", tclReadyCmd, 0},
1196
+ {"trace", traceCmd, 0},
10271197
{"stime", stimeCmd, 0},
10281198
{"utime", utimeCmd, 0},
10291199
{"wiki", wikiCmd, (void*)&aFlags[0]},
10301200
{0, 0, 0}
10311201
};
10321202
--- src/th_main.c
+++ src/th_main.c
@@ -572,10 +572,173 @@
572 if( openRepository ) db_find_and_open_repository(OPEN_OK_NOT_FOUND, 0);
573 }
574 Th_SetResult(interp, g.zRepositoryName, -1);
575 return TH_OK;
576 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
577
578 #ifdef _WIN32
579 # include <windows.h>
580 #else
581 # include <sys/time.h>
@@ -1004,14 +1167,16 @@
1004 const char *zName;
1005 Th_CommandProc xProc;
1006 void *pContext;
1007 } aCommand[] = {
1008 {"anycap", anycapCmd, 0},
 
1009 {"combobox", comboboxCmd, 0},
1010 {"date", dateCmd, 0},
1011 {"decorate", wikiCmd, (void*)&aFlags[2]},
1012 {"enable_output", enableOutputCmd, 0},
 
1013 {"httpize", httpizeCmd, 0},
1014 {"hascap", hascapCmd, 0},
1015 {"hasfeature", hasfeatureCmd, 0},
1016 {"html", putsCmd, (void*)&aFlags[0]},
1017 {"htmlize", htmlizeCmd, 0},
@@ -1019,13 +1184,18 @@
1019 {"linecount", linecntCmd, 0},
1020 {"puts", putsCmd, (void*)&aFlags[1]},
1021 {"query", queryCmd, 0},
1022 {"randhex", randhexCmd, 0},
1023 {"regexp", regexpCmd, 0},
 
1024 {"repository", repositoryCmd, 0},
 
1025 {"setting", settingCmd, 0},
 
 
1026 {"tclReady", tclReadyCmd, 0},
 
1027 {"stime", stimeCmd, 0},
1028 {"utime", utimeCmd, 0},
1029 {"wiki", wikiCmd, (void*)&aFlags[0]},
1030 {0, 0, 0}
1031 };
1032
--- src/th_main.c
+++ src/th_main.c
@@ -572,10 +572,173 @@
572 if( openRepository ) db_find_and_open_repository(OPEN_OK_NOT_FOUND, 0);
573 }
574 Th_SetResult(interp, g.zRepositoryName, -1);
575 return TH_OK;
576 }
577
578 /*
579 ** TH1 command: checkout ?BOOLEAN?
580 **
581 ** Return the fully qualified directory name of the current checkout or an
582 ** empty string if it is not available.
583 */
584 static int checkoutCmd(
585 Th_Interp *interp,
586 void *p,
587 int argc,
588 const char **argv,
589 int *argl
590 ){
591 if( argc!=1 && argc!=2 ){
592 return Th_WrongNumArgs(interp, "checkout ?BOOLEAN?");
593 }
594 if( argc==2 ){
595 int openRepository = 0;
596 if( Th_ToInt(interp, argv[1], argl[1], &openRepository) ){
597 return TH_ERROR;
598 }
599 if( openRepository ) db_find_and_open_repository(OPEN_OK_NOT_FOUND, 0);
600 }
601 Th_SetResult(interp, g.zLocalRoot, -1);
602 return TH_OK;
603 }
604
605 /*
606 ** TH1 command: trace STRING
607 **
608 ** Generate a TH1 trace message if debugging is enabled.
609 */
610 static int traceCmd(
611 Th_Interp *interp,
612 void *p,
613 int argc,
614 const char **argv,
615 int *argl
616 ){
617 if( argc!=2 ){
618 return Th_WrongNumArgs(interp, "trace STRING");
619 }
620 if( g.thTrace ){
621 Th_Trace("%s", argv[1]);
622 }
623 Th_SetResult(interp, 0, 0);
624 return TH_OK;
625 }
626
627 /*
628 ** TH1 command: getParameter NAME ?DEFAULT?
629 **
630 ** Return the value of the specified query parameter or the specified default
631 ** value when there is no matching query parameter.
632 */
633 static int getParameterCmd(
634 Th_Interp *interp,
635 void *p,
636 int argc,
637 const char **argv,
638 int *argl
639 ){
640 const char *zDefault = 0;
641 if( argc!=2 && argc!=3 ){
642 return Th_WrongNumArgs(interp, "getParameter NAME ?DEFAULT?");
643 }
644 if( argc==3 ){
645 zDefault = argv[2];
646 }
647 Th_SetResult(interp, cgi_parameter(argv[1], zDefault), -1);
648 return TH_OK;
649 }
650
651 /*
652 ** TH1 command: setParameter NAME VALUE
653 **
654 ** Sets the value of the specified query parameter.
655 */
656 static int setParameterCmd(
657 Th_Interp *interp,
658 void *p,
659 int argc,
660 const char **argv,
661 int *argl
662 ){
663 if( argc!=3 ){
664 return Th_WrongNumArgs(interp, "setParameter NAME VALUE");
665 }
666 cgi_replace_parameter(mprintf("%s", argv[1]), mprintf("%s", argv[2]));
667 return TH_OK;
668 }
669
670 /*
671 ** TH1 command: render STRING
672 **
673 ** Renders the template and writes the results.
674 */
675 static int renderCmd(
676 Th_Interp *interp,
677 void *p,
678 int argc,
679 const char **argv,
680 int *argl
681 ){
682 int rc;
683 if( argc!=2 ){
684 return Th_WrongNumArgs(interp, "render STRING");
685 }
686 rc = Th_Render(argv[1]);
687 Th_SetResult(interp, 0, 0);
688 return rc;
689 }
690
691 /*
692 ** TH1 command: styleHeader TITLE
693 **
694 ** Render the configured style header.
695 */
696 static int styleHeaderCmd(
697 Th_Interp *interp,
698 void *p,
699 int argc,
700 const char **argv,
701 int *argl
702 ){
703 if( argc!=2 ){
704 return Th_WrongNumArgs(interp, "styleHeader TITLE");
705 }
706 if( g.zConfigDbName ){
707 style_header("%s", argv[1]);
708 Th_SetResult(interp, 0, 0);
709 return TH_OK;
710 }else{
711 Th_SetResult(interp, "configuration unavailable", -1);
712 return TH_ERROR;
713 }
714 }
715
716 /*
717 ** TH1 command: styleFooter
718 **
719 ** Render the configured style footer.
720 */
721 static int styleFooterCmd(
722 Th_Interp *interp,
723 void *p,
724 int argc,
725 const char **argv,
726 int *argl
727 ){
728 if( argc!=1 ){
729 return Th_WrongNumArgs(interp, "styleFooter");
730 }
731 if( g.zConfigDbName ){
732 style_footer();
733 Th_SetResult(interp, 0, 0);
734 return TH_OK;
735 }else{
736 Th_SetResult(interp, "configuration unavailable", -1);
737 return TH_ERROR;
738 }
739 }
740
741 #ifdef _WIN32
742 # include <windows.h>
743 #else
744 # include <sys/time.h>
@@ -1004,14 +1167,16 @@
1167 const char *zName;
1168 Th_CommandProc xProc;
1169 void *pContext;
1170 } aCommand[] = {
1171 {"anycap", anycapCmd, 0},
1172 {"checkout", checkoutCmd, 0},
1173 {"combobox", comboboxCmd, 0},
1174 {"date", dateCmd, 0},
1175 {"decorate", wikiCmd, (void*)&aFlags[2]},
1176 {"enable_output", enableOutputCmd, 0},
1177 {"getParameter", getParameterCmd, 0},
1178 {"httpize", httpizeCmd, 0},
1179 {"hascap", hascapCmd, 0},
1180 {"hasfeature", hasfeatureCmd, 0},
1181 {"html", putsCmd, (void*)&aFlags[0]},
1182 {"htmlize", htmlizeCmd, 0},
@@ -1019,13 +1184,18 @@
1184 {"linecount", linecntCmd, 0},
1185 {"puts", putsCmd, (void*)&aFlags[1]},
1186 {"query", queryCmd, 0},
1187 {"randhex", randhexCmd, 0},
1188 {"regexp", regexpCmd, 0},
1189 {"render", renderCmd, 0},
1190 {"repository", repositoryCmd, 0},
1191 {"setParameter", setParameterCmd, 0},
1192 {"setting", settingCmd, 0},
1193 {"styleHeader", styleHeaderCmd, 0},
1194 {"styleFooter", styleFooterCmd, 0},
1195 {"tclReady", tclReadyCmd, 0},
1196 {"trace", traceCmd, 0},
1197 {"stime", stimeCmd, 0},
1198 {"utime", utimeCmd, 0},
1199 {"wiki", wikiCmd, (void*)&aFlags[0]},
1200 {0, 0, 0}
1201 };
1202
+134
--- test/th1.test
+++ test/th1.test
@@ -472,5 +472,139 @@
472472
473473
###############################################################################
474474
475475
fossil test-th-eval "expr 0+0b"
476476
test th1-expr-35 {$RESULT eq {TH_ERROR: expected number, got: "0b"}}
477
+
478
+###############################################################################
479
+
480
+fossil test-th-eval "checkout 1"
481
+test th1-checkout-1 {[string length $RESULT] > 0}
482
+
483
+###############################################################################
484
+
485
+fossil test-th-eval "checkout"
486
+test th1-checkout-2 {[string length $RESULT] == 0}
487
+
488
+###############################################################################
489
+
490
+set savedPwd [pwd]; cd /
491
+fossil test-th-eval "checkout 1"
492
+cd $savedPwd; unset savedPwd
493
+test th1-checkout-3 {[string length $RESULT] == 0}
494
+
495
+###############################################################################
496
+
497
+set savedPwd [pwd]; cd /
498
+fossil test-th-eval "checkout"
499
+cd $savedPwd; unset savedPwd
500
+test th1-checkout-4 {[string length $RESULT] == 0}
501
+
502
+###############################################################################
503
+
504
+fossil test-th-eval "render {}"
505
+test th1-render-1 {$RESULT eq {}}
506
+
507
+###############################################################################
508
+
509
+fossil test-th-eval "render {$<x> before <th1>set x 123</th1> after $<x> }"
510
+test th1-render-2 {$RESULT eq {no such variable: x before after 123 }}
511
+
512
+###############################################################################
513
+
514
+fossil test-th-eval "trace {}"
515
+test th1-trace-1 {$RESULT eq {}}
516
+
517
+###############################################################################
518
+
519
+fossil test-th-eval --th-trace "trace {}"
520
+test th1-trace-2 {[string map [list \r\n \n] [string trim $RESULT]] eq \
521
+{------------------ BEGIN TRACE LOG ------------------
522
+th1-setup {} => TH_OK<br />
523
+
524
+------------------- END TRACE LOG -------------------}}
525
+
526
+###############################################################################
527
+
528
+fossil test-th-eval "trace {this is a trace message.}"
529
+test th1-trace-3 {$RESULT eq {}}
530
+
531
+###############################################################################
532
+
533
+fossil test-th-eval --th-trace "trace {this is a trace message.}"
534
+test th1-trace-4 {[string map [list \r\n \n] [string trim $RESULT]] eq \
535
+{------------------ BEGIN TRACE LOG ------------------
536
+th1-setup {} => TH_OK<br />
537
+this is a trace message.
538
+------------------- END TRACE LOG -------------------}}
539
+
540
+###############################################################################
541
+
542
+fossil test-th-eval "styleHeader {Page Title Here}"
543
+test th1-header-1 {$RESULT eq {TH_ERROR: configuration unavailable}}
544
+
545
+###############################################################################
546
+
547
+fossil test-th-eval --th-open-config "styleHeader {Page Title Here}"
548
+test th1-header-2 {[regexp -- {<title>Fossil: Page Title Here</title>} $RESULT]}
549
+
550
+###############################################################################
551
+
552
+fossil test-th-eval "styleFooter"
553
+test th1-footer-1 {$RESULT eq {TH_ERROR: configuration unavailable}}
554
+
555
+###############################################################################
556
+
557
+fossil test-th-eval --th-open-config "styleFooter"
558
+test th1-footer-2 {$RESULT eq {}}
559
+
560
+###############################################################################
561
+
562
+fossil test-th-eval "getParameter"
563
+test th1-get-parameter-1 {$RESULT eq \
564
+ {TH_ERROR: wrong # args: should be "getParameter NAME ?DEFAULT?"}}
565
+
566
+###############################################################################
567
+
568
+fossil test-th-eval "getParameter test1"
569
+test th1-get-parameter-2 {$RESULT eq {}}
570
+
571
+###############################################################################
572
+
573
+fossil test-th-eval "getParameter test1 defValue1"
574
+test th1-get-parameter-3 {$RESULT eq {defValue1}}
575
+
576
+###############################################################################
577
+
578
+fossil test-th-eval "setParameter"
579
+test th1-set-parameter-1 {$RESULT eq \
580
+ {TH_ERROR: wrong # args: should be "setParameter NAME VALUE"}}
581
+
582
+###############################################################################
583
+
584
+fossil test-th-eval "setParameter test1 value1; getParameter test1"
585
+test th1-set-parameter-2 {$RESULT eq {value1}}
586
+
587
+###############################################################################
588
+
589
+fossil test-th-eval "setParameter test2 value2; getParameter test1"
590
+test th1-set-parameter-3 {$RESULT eq {}}
591
+
592
+###############################################################################
593
+
594
+fossil test-th-eval "setParameter test3 value3; getParameter test3"
595
+test th1-set-parameter-4 {$RESULT eq {value3}}
596
+
597
+###############################################################################
598
+
599
+fossil test-th-eval "setParameter test3 value3; getParameter test3 defValue3"
600
+test th1-set-parameter-5 {$RESULT eq {value3}}
601
+
602
+###############################################################################
603
+
604
+fossil test-th-eval "setParameter test4 value4; setParameter test4 value5; getParameter test4"
605
+test th1-set-parameter-6 {$RESULT eq {value5}}
606
+
607
+###############################################################################
608
+
609
+fossil test-th-eval "setParameter test4 value4; setParameter test4 value5; getParameter test4 defValue4"
610
+test th1-set-parameter-7 {$RESULT eq {value5}}
477611
--- test/th1.test
+++ test/th1.test
@@ -472,5 +472,139 @@
472
473 ###############################################################################
474
475 fossil test-th-eval "expr 0+0b"
476 test th1-expr-35 {$RESULT eq {TH_ERROR: expected number, got: "0b"}}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
477
--- test/th1.test
+++ test/th1.test
@@ -472,5 +472,139 @@
472
473 ###############################################################################
474
475 fossil test-th-eval "expr 0+0b"
476 test th1-expr-35 {$RESULT eq {TH_ERROR: expected number, got: "0b"}}
477
478 ###############################################################################
479
480 fossil test-th-eval "checkout 1"
481 test th1-checkout-1 {[string length $RESULT] > 0}
482
483 ###############################################################################
484
485 fossil test-th-eval "checkout"
486 test th1-checkout-2 {[string length $RESULT] == 0}
487
488 ###############################################################################
489
490 set savedPwd [pwd]; cd /
491 fossil test-th-eval "checkout 1"
492 cd $savedPwd; unset savedPwd
493 test th1-checkout-3 {[string length $RESULT] == 0}
494
495 ###############################################################################
496
497 set savedPwd [pwd]; cd /
498 fossil test-th-eval "checkout"
499 cd $savedPwd; unset savedPwd
500 test th1-checkout-4 {[string length $RESULT] == 0}
501
502 ###############################################################################
503
504 fossil test-th-eval "render {}"
505 test th1-render-1 {$RESULT eq {}}
506
507 ###############################################################################
508
509 fossil test-th-eval "render {$<x> before <th1>set x 123</th1> after $<x> }"
510 test th1-render-2 {$RESULT eq {no such variable: x before after 123 }}
511
512 ###############################################################################
513
514 fossil test-th-eval "trace {}"
515 test th1-trace-1 {$RESULT eq {}}
516
517 ###############################################################################
518
519 fossil test-th-eval --th-trace "trace {}"
520 test th1-trace-2 {[string map [list \r\n \n] [string trim $RESULT]] eq \
521 {------------------ BEGIN TRACE LOG ------------------
522 th1-setup {} => TH_OK<br />
523
524 ------------------- END TRACE LOG -------------------}}
525
526 ###############################################################################
527
528 fossil test-th-eval "trace {this is a trace message.}"
529 test th1-trace-3 {$RESULT eq {}}
530
531 ###############################################################################
532
533 fossil test-th-eval --th-trace "trace {this is a trace message.}"
534 test th1-trace-4 {[string map [list \r\n \n] [string trim $RESULT]] eq \
535 {------------------ BEGIN TRACE LOG ------------------
536 th1-setup {} => TH_OK<br />
537 this is a trace message.
538 ------------------- END TRACE LOG -------------------}}
539
540 ###############################################################################
541
542 fossil test-th-eval "styleHeader {Page Title Here}"
543 test th1-header-1 {$RESULT eq {TH_ERROR: configuration unavailable}}
544
545 ###############################################################################
546
547 fossil test-th-eval --th-open-config "styleHeader {Page Title Here}"
548 test th1-header-2 {[regexp -- {<title>Fossil: Page Title Here</title>} $RESULT]}
549
550 ###############################################################################
551
552 fossil test-th-eval "styleFooter"
553 test th1-footer-1 {$RESULT eq {TH_ERROR: configuration unavailable}}
554
555 ###############################################################################
556
557 fossil test-th-eval --th-open-config "styleFooter"
558 test th1-footer-2 {$RESULT eq {}}
559
560 ###############################################################################
561
562 fossil test-th-eval "getParameter"
563 test th1-get-parameter-1 {$RESULT eq \
564 {TH_ERROR: wrong # args: should be "getParameter NAME ?DEFAULT?"}}
565
566 ###############################################################################
567
568 fossil test-th-eval "getParameter test1"
569 test th1-get-parameter-2 {$RESULT eq {}}
570
571 ###############################################################################
572
573 fossil test-th-eval "getParameter test1 defValue1"
574 test th1-get-parameter-3 {$RESULT eq {defValue1}}
575
576 ###############################################################################
577
578 fossil test-th-eval "setParameter"
579 test th1-set-parameter-1 {$RESULT eq \
580 {TH_ERROR: wrong # args: should be "setParameter NAME VALUE"}}
581
582 ###############################################################################
583
584 fossil test-th-eval "setParameter test1 value1; getParameter test1"
585 test th1-set-parameter-2 {$RESULT eq {value1}}
586
587 ###############################################################################
588
589 fossil test-th-eval "setParameter test2 value2; getParameter test1"
590 test th1-set-parameter-3 {$RESULT eq {}}
591
592 ###############################################################################
593
594 fossil test-th-eval "setParameter test3 value3; getParameter test3"
595 test th1-set-parameter-4 {$RESULT eq {value3}}
596
597 ###############################################################################
598
599 fossil test-th-eval "setParameter test3 value3; getParameter test3 defValue3"
600 test th1-set-parameter-5 {$RESULT eq {value3}}
601
602 ###############################################################################
603
604 fossil test-th-eval "setParameter test4 value4; setParameter test4 value5; getParameter test4"
605 test th1-set-parameter-6 {$RESULT eq {value5}}
606
607 ###############################################################################
608
609 fossil test-th-eval "setParameter test4 value4; setParameter test4 value5; getParameter test4 defValue4"
610 test th1-set-parameter-7 {$RESULT eq {value5}}
611

Keyboard Shortcuts

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