Fossil SCM

Add setting TH1 command, with tests. Improve handling of the TH1 trace log.

mistachkin 2013-05-08 04:12 trunk
Commit 0264475c4a0048c96a54abd7bb8f825a1f04cd35
+2 -8
--- src/main.c
+++ src/main.c
@@ -1672,14 +1672,11 @@
16721672
**
16731673
** COMMAND: test-http
16741674
** Works like the http command but gives setup permission to all users.
16751675
*/
16761676
void cmd_test_http(void){
1677
- g.thTrace = find_option("th-trace", 0, 0)!=0;
1678
- if( g.thTrace ){
1679
- blob_zero(&g.thLog);
1680
- }
1677
+ Th_InitTraceLog();
16811678
login_set_capabilities("sx", 0);
16821679
g.useLocalauth = 1;
16831680
cgi_set_parameter("REMOTE_ADDR", "127.0.0.1");
16841681
g.httpIn = stdin;
16851682
g.httpOut = stdout;
@@ -1781,15 +1778,12 @@
17811778
const char *zStopperFile; /* Name of file used to terminate server */
17821779
zStopperFile = find_option("stopper", 0, 1);
17831780
#endif
17841781
17851782
zFileGlob = find_option("files", 0, 1);
1786
- g.thTrace = find_option("th-trace", 0, 0)!=0;
17871783
g.useLocalauth = find_option("localauth", 0, 0)!=0;
1788
- if( g.thTrace ){
1789
- blob_zero(&g.thLog);
1790
- }
1784
+ Th_InitTraceLog();
17911785
zPort = find_option("port", "P", 1);
17921786
zNotFound = find_option("notfound", 0, 1);
17931787
zAltBase = find_option("baseurl", 0, 1);
17941788
if( zAltBase ){
17951789
set_base_url(zAltBase);
17961790
--- src/main.c
+++ src/main.c
@@ -1672,14 +1672,11 @@
1672 **
1673 ** COMMAND: test-http
1674 ** Works like the http command but gives setup permission to all users.
1675 */
1676 void cmd_test_http(void){
1677 g.thTrace = find_option("th-trace", 0, 0)!=0;
1678 if( g.thTrace ){
1679 blob_zero(&g.thLog);
1680 }
1681 login_set_capabilities("sx", 0);
1682 g.useLocalauth = 1;
1683 cgi_set_parameter("REMOTE_ADDR", "127.0.0.1");
1684 g.httpIn = stdin;
1685 g.httpOut = stdout;
@@ -1781,15 +1778,12 @@
1781 const char *zStopperFile; /* Name of file used to terminate server */
1782 zStopperFile = find_option("stopper", 0, 1);
1783 #endif
1784
1785 zFileGlob = find_option("files", 0, 1);
1786 g.thTrace = find_option("th-trace", 0, 0)!=0;
1787 g.useLocalauth = find_option("localauth", 0, 0)!=0;
1788 if( g.thTrace ){
1789 blob_zero(&g.thLog);
1790 }
1791 zPort = find_option("port", "P", 1);
1792 zNotFound = find_option("notfound", 0, 1);
1793 zAltBase = find_option("baseurl", 0, 1);
1794 if( zAltBase ){
1795 set_base_url(zAltBase);
1796
--- src/main.c
+++ src/main.c
@@ -1672,14 +1672,11 @@
1672 **
1673 ** COMMAND: test-http
1674 ** Works like the http command but gives setup permission to all users.
1675 */
1676 void cmd_test_http(void){
1677 Th_InitTraceLog();
 
 
 
1678 login_set_capabilities("sx", 0);
1679 g.useLocalauth = 1;
1680 cgi_set_parameter("REMOTE_ADDR", "127.0.0.1");
1681 g.httpIn = stdin;
1682 g.httpOut = stdout;
@@ -1781,15 +1778,12 @@
1778 const char *zStopperFile; /* Name of file used to terminate server */
1779 zStopperFile = find_option("stopper", 0, 1);
1780 #endif
1781
1782 zFileGlob = find_option("files", 0, 1);
 
1783 g.useLocalauth = find_option("localauth", 0, 0)!=0;
1784 Th_InitTraceLog();
 
 
1785 zPort = find_option("port", "P", 1);
1786 zNotFound = find_option("notfound", 0, 1);
1787 zAltBase = find_option("baseurl", 0, 1);
1788 if( zAltBase ){
1789 set_base_url(zAltBase);
1790
+81 -3
--- src/th_main.c
+++ src/th_main.c
@@ -55,10 +55,32 @@
5555
va_start(ap, zFormat);
5656
blob_vappendf(&g.thLog, zFormat, ap);
5757
va_end(ap);
5858
}
5959
60
+/*
61
+** Checks if the TH1 trace log needs to be enabled. If so, prepares
62
+** it for use.
63
+*/
64
+void Th_InitTraceLog(){
65
+ g.thTrace = find_option("th-trace", 0, 0)!=0;
66
+ if( g.thTrace ){
67
+ blob_zero(&g.thLog);
68
+ }
69
+}
70
+
71
+/*
72
+** Prints the entire contents of the TH1 trace log to the standard
73
+** output channel.
74
+*/
75
+void Th_PrintTraceLog(){
76
+ if( g.thTrace ){
77
+ fossil_print("\n------------------ BEGIN TRACE LOG ------------------\n");
78
+ fossil_print("%s", blob_str(&g.thLog));
79
+ fossil_print("\n------------------- END TRACE LOG -------------------\n");
80
+ }
81
+}
6082
6183
/*
6284
** True if output is enabled. False if disabled.
6385
*/
6486
static int enableOutput = 1;
@@ -692,10 +714,55 @@
692714
return TH_ERROR;
693715
}
694716
}
695717
return res;
696718
}
719
+
720
+/*
721
+** TH1 command: setting name
722
+**
723
+** Gets and returns the value of the specified Fossil setting.
724
+*/
725
+#define SETTING_WRONGNUMARGS "setting ?-strict? ?--? name"
726
+static int settingCmd(
727
+ Th_Interp *interp,
728
+ void *p,
729
+ int argc,
730
+ const char **argv,
731
+ int *argl
732
+){
733
+ int rc;
734
+ int strict = 0;
735
+ int nArg = 1;
736
+ char *zValue;
737
+ if( argc<2 || argc>4 ){
738
+ return Th_WrongNumArgs(interp, SETTING_WRONGNUMARGS);
739
+ }
740
+ if( fossil_strcmp(argv[nArg], "-strict")==0 ){
741
+ strict = 1; nArg++;
742
+ }
743
+ if( fossil_strcmp(argv[nArg], "--")==0 ) nArg++;
744
+ if( nArg+1!=argc ){
745
+ return Th_WrongNumArgs(interp, SETTING_WRONGNUMARGS);
746
+ }
747
+ zValue = db_get(argv[nArg], 0);
748
+ if( zValue!=0 ){
749
+ Th_SetResult(interp, zValue, -1);
750
+ rc = TH_OK;
751
+ }else if( strict ){
752
+ Th_ErrorMessage(interp, "no value for setting \"", argv[nArg], -1);
753
+ rc = TH_ERROR;
754
+ }else{
755
+ Th_SetResult(interp, 0, 0);
756
+ rc = TH_OK;
757
+ }
758
+ if( g.thTrace ){
759
+ Th_Trace("[setting %s%#h] => %d<br />\n", strict ? "strict " : "",
760
+ argl[nArg], argv[nArg], rc);
761
+ }
762
+ return rc;
763
+}
697764
698765
/*
699766
** TH1 command: regexp ?-nocase? ?--? exp string
700767
**
701768
** Checks the string against the specified regular expression and returns
@@ -765,10 +832,11 @@
765832
{"puts", putsCmd, (void*)&aFlags[1]},
766833
{"query", queryCmd, 0},
767834
{"randhex", randhexCmd, 0},
768835
{"regexp", regexpCmd, 0},
769836
{"repository", repositoryCmd, 0},
837
+ {"setting", settingCmd, 0},
770838
{"tclReady", tclReadyCmd, 0},
771839
{"stime", stimeCmd, 0},
772840
{"utime", utimeCmd, 0},
773841
{"wiki", wikiCmd, (void*)&aFlags[0]},
774842
{0, 0, 0}
@@ -998,29 +1066,39 @@
9981066
/*
9991067
** COMMAND: test-th-render
10001068
*/
10011069
void test_th_render(void){
10021070
Blob in;
1071
+ Th_InitTraceLog();
1072
+ if( find_option("th-open-config", 0, 0)!=0 ){
1073
+ db_find_and_open_repository(OPEN_ANY_SCHEMA | OPEN_OK_NOT_FOUND, 0);
1074
+ db_open_config(0);
1075
+ }
10031076
if( g.argc<3 ){
10041077
usage("FILE");
10051078
}
1006
- db_open_config(0); /* Needed for global "tcl" setting. */
10071079
blob_zero(&in);
10081080
blob_read_from_file(&in, g.argv[2]);
10091081
Th_Render(blob_str(&in));
1082
+ Th_PrintTraceLog();
10101083
}
10111084
10121085
/*
10131086
** COMMAND: test-th-eval
10141087
*/
10151088
void test_th_eval(void){
10161089
int rc;
10171090
const char *zRc;
1091
+ Th_InitTraceLog();
1092
+ if( find_option("th-open-config", 0, 0)!=0 ){
1093
+ db_find_and_open_repository(OPEN_ANY_SCHEMA | OPEN_OK_NOT_FOUND, 0);
1094
+ db_open_config(0);
1095
+ }
10181096
if( g.argc!=3 ){
10191097
usage("script");
10201098
}
10211099
Th_FossilInit(0, 0);
10221100
rc = Th_Eval(g.interp, 0, g.argv[2], -1);
10231101
zRc = Th_ReturnCodeName(rc, 1);
1024
- fossil_print("%s%s%s\n", zRc, zRc ? ": " : "",
1025
- Th_GetResult(g.interp, 0));
1102
+ fossil_print("%s%s%s\n", zRc, zRc ? ": " : "", Th_GetResult(g.interp, 0));
1103
+ Th_PrintTraceLog();
10261104
}
10271105
--- src/th_main.c
+++ src/th_main.c
@@ -55,10 +55,32 @@
55 va_start(ap, zFormat);
56 blob_vappendf(&g.thLog, zFormat, ap);
57 va_end(ap);
58 }
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
61 /*
62 ** True if output is enabled. False if disabled.
63 */
64 static int enableOutput = 1;
@@ -692,10 +714,55 @@
692 return TH_ERROR;
693 }
694 }
695 return res;
696 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
697
698 /*
699 ** TH1 command: regexp ?-nocase? ?--? exp string
700 **
701 ** Checks the string against the specified regular expression and returns
@@ -765,10 +832,11 @@
765 {"puts", putsCmd, (void*)&aFlags[1]},
766 {"query", queryCmd, 0},
767 {"randhex", randhexCmd, 0},
768 {"regexp", regexpCmd, 0},
769 {"repository", repositoryCmd, 0},
 
770 {"tclReady", tclReadyCmd, 0},
771 {"stime", stimeCmd, 0},
772 {"utime", utimeCmd, 0},
773 {"wiki", wikiCmd, (void*)&aFlags[0]},
774 {0, 0, 0}
@@ -998,29 +1066,39 @@
998 /*
999 ** COMMAND: test-th-render
1000 */
1001 void test_th_render(void){
1002 Blob in;
 
 
 
 
 
1003 if( g.argc<3 ){
1004 usage("FILE");
1005 }
1006 db_open_config(0); /* Needed for global "tcl" setting. */
1007 blob_zero(&in);
1008 blob_read_from_file(&in, g.argv[2]);
1009 Th_Render(blob_str(&in));
 
1010 }
1011
1012 /*
1013 ** COMMAND: test-th-eval
1014 */
1015 void test_th_eval(void){
1016 int rc;
1017 const char *zRc;
 
 
 
 
 
1018 if( g.argc!=3 ){
1019 usage("script");
1020 }
1021 Th_FossilInit(0, 0);
1022 rc = Th_Eval(g.interp, 0, g.argv[2], -1);
1023 zRc = Th_ReturnCodeName(rc, 1);
1024 fossil_print("%s%s%s\n", zRc, zRc ? ": " : "",
1025 Th_GetResult(g.interp, 0));
1026 }
1027
--- src/th_main.c
+++ src/th_main.c
@@ -55,10 +55,32 @@
55 va_start(ap, zFormat);
56 blob_vappendf(&g.thLog, zFormat, ap);
57 va_end(ap);
58 }
59
60 /*
61 ** Checks if the TH1 trace log needs to be enabled. If so, prepares
62 ** it for use.
63 */
64 void Th_InitTraceLog(){
65 g.thTrace = find_option("th-trace", 0, 0)!=0;
66 if( g.thTrace ){
67 blob_zero(&g.thLog);
68 }
69 }
70
71 /*
72 ** Prints the entire contents of the TH1 trace log to the standard
73 ** output channel.
74 */
75 void Th_PrintTraceLog(){
76 if( g.thTrace ){
77 fossil_print("\n------------------ BEGIN TRACE LOG ------------------\n");
78 fossil_print("%s", blob_str(&g.thLog));
79 fossil_print("\n------------------- END TRACE LOG -------------------\n");
80 }
81 }
82
83 /*
84 ** True if output is enabled. False if disabled.
85 */
86 static int enableOutput = 1;
@@ -692,10 +714,55 @@
714 return TH_ERROR;
715 }
716 }
717 return res;
718 }
719
720 /*
721 ** TH1 command: setting name
722 **
723 ** Gets and returns the value of the specified Fossil setting.
724 */
725 #define SETTING_WRONGNUMARGS "setting ?-strict? ?--? name"
726 static int settingCmd(
727 Th_Interp *interp,
728 void *p,
729 int argc,
730 const char **argv,
731 int *argl
732 ){
733 int rc;
734 int strict = 0;
735 int nArg = 1;
736 char *zValue;
737 if( argc<2 || argc>4 ){
738 return Th_WrongNumArgs(interp, SETTING_WRONGNUMARGS);
739 }
740 if( fossil_strcmp(argv[nArg], "-strict")==0 ){
741 strict = 1; nArg++;
742 }
743 if( fossil_strcmp(argv[nArg], "--")==0 ) nArg++;
744 if( nArg+1!=argc ){
745 return Th_WrongNumArgs(interp, SETTING_WRONGNUMARGS);
746 }
747 zValue = db_get(argv[nArg], 0);
748 if( zValue!=0 ){
749 Th_SetResult(interp, zValue, -1);
750 rc = TH_OK;
751 }else if( strict ){
752 Th_ErrorMessage(interp, "no value for setting \"", argv[nArg], -1);
753 rc = TH_ERROR;
754 }else{
755 Th_SetResult(interp, 0, 0);
756 rc = TH_OK;
757 }
758 if( g.thTrace ){
759 Th_Trace("[setting %s%#h] => %d<br />\n", strict ? "strict " : "",
760 argl[nArg], argv[nArg], rc);
761 }
762 return rc;
763 }
764
765 /*
766 ** TH1 command: regexp ?-nocase? ?--? exp string
767 **
768 ** Checks the string against the specified regular expression and returns
@@ -765,10 +832,11 @@
832 {"puts", putsCmd, (void*)&aFlags[1]},
833 {"query", queryCmd, 0},
834 {"randhex", randhexCmd, 0},
835 {"regexp", regexpCmd, 0},
836 {"repository", repositoryCmd, 0},
837 {"setting", settingCmd, 0},
838 {"tclReady", tclReadyCmd, 0},
839 {"stime", stimeCmd, 0},
840 {"utime", utimeCmd, 0},
841 {"wiki", wikiCmd, (void*)&aFlags[0]},
842 {0, 0, 0}
@@ -998,29 +1066,39 @@
1066 /*
1067 ** COMMAND: test-th-render
1068 */
1069 void test_th_render(void){
1070 Blob in;
1071 Th_InitTraceLog();
1072 if( find_option("th-open-config", 0, 0)!=0 ){
1073 db_find_and_open_repository(OPEN_ANY_SCHEMA | OPEN_OK_NOT_FOUND, 0);
1074 db_open_config(0);
1075 }
1076 if( g.argc<3 ){
1077 usage("FILE");
1078 }
 
1079 blob_zero(&in);
1080 blob_read_from_file(&in, g.argv[2]);
1081 Th_Render(blob_str(&in));
1082 Th_PrintTraceLog();
1083 }
1084
1085 /*
1086 ** COMMAND: test-th-eval
1087 */
1088 void test_th_eval(void){
1089 int rc;
1090 const char *zRc;
1091 Th_InitTraceLog();
1092 if( find_option("th-open-config", 0, 0)!=0 ){
1093 db_find_and_open_repository(OPEN_ANY_SCHEMA | OPEN_OK_NOT_FOUND, 0);
1094 db_open_config(0);
1095 }
1096 if( g.argc!=3 ){
1097 usage("script");
1098 }
1099 Th_FossilInit(0, 0);
1100 rc = Th_Eval(g.interp, 0, g.argv[2], -1);
1101 zRc = Th_ReturnCodeName(rc, 1);
1102 fossil_print("%s%s%s\n", zRc, zRc ? ": " : "", Th_GetResult(g.interp, 0));
1103 Th_PrintTraceLog();
1104 }
1105
+21 -11
--- test/th1-tcl.test
+++ test/th1-tcl.test
@@ -32,11 +32,12 @@
3232
3333
set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test.
3434
3535
###############################################################################
3636
37
-fossil test-th-render [file nativename [file join $dir th1-tcl1.txt]]
37
+fossil test-th-render --th-open-config \
38
+ [file nativename [file join $dir th1-tcl1.txt]]
3839
3940
test th1-tcl-1 {[regexp -- {^tclReady\(before\) = 0
4041
tclReady\(after\) = 1
4142
\d+
4243
\d+
@@ -58,61 +59,70 @@
5859
three words now
5960
$} [string map [list \r\n \n] $RESULT]]}
6061
6162
###############################################################################
6263
63
-fossil test-th-render [file nativename [file join $dir th1-tcl2.txt]]
64
+fossil test-th-render --th-open-config \
65
+ [file nativename [file join $dir th1-tcl2.txt]]
6466
6567
test th1-tcl-2 {[regexp -- {^\d+
6668
$} [string map [list \r\n \n] $RESULT]]}
6769
6870
###############################################################################
6971
70
-fossil test-th-render [file nativename [file join $dir th1-tcl3.txt]]
72
+fossil test-th-render --th-open-config \
73
+ [file nativename [file join $dir th1-tcl3.txt]]
7174
7275
test th1-tcl-3 {$RESULT eq {<hr><p class="thmainError">ERROR:\
7376
invalid command name &quot;bad_command&quot;</p>}}
7477
7578
###############################################################################
7679
77
-fossil test-th-render [file nativename [file join $dir th1-tcl4.txt]]
80
+fossil test-th-render --th-open-config \
81
+ [file nativename [file join $dir th1-tcl4.txt]]
7882
7983
test th1-tcl-4 {$RESULT eq {<hr><p class="thmainError">ERROR:\
8084
divide by zero</p>}}
8185
8286
###############################################################################
8387
84
-fossil test-th-render [file nativename [file join $dir th1-tcl5.txt]]
88
+fossil test-th-render --th-open-config \
89
+ [file nativename [file join $dir th1-tcl5.txt]]
8590
8691
test th1-tcl-5 {$RESULT eq {<hr><p class="thmainError">ERROR:\
8792
Tcl command not found: bad_command</p>} || $RESULT eq {<hr><p\
8893
class="thmainError">ERROR: invalid command name &quot;bad_command&quot;</p>}}
8994
9095
###############################################################################
9196
92
-fossil test-th-render [file nativename [file join $dir th1-tcl6.txt]]
97
+fossil test-th-render --th-open-config \
98
+ [file nativename [file join $dir th1-tcl6.txt]]
9399
94100
test th1-tcl-6 {$RESULT eq {<hr><p class="thmainError">ERROR:\
95101
no such command: bad_command</p>}}
96102
97103
###############################################################################
98104
99
-fossil test-th-render [file nativename [file join $dir th1-tcl7.txt]]
105
+fossil test-th-render --th-open-config \
106
+ [file nativename [file join $dir th1-tcl7.txt]]
100107
101108
test th1-tcl-7 {$RESULT eq {<hr><p class="thmainError">ERROR:\
102109
syntax error in expression: &quot;2**0&quot;</p>}}
103110
104111
###############################################################################
105112
106
-fossil test-th-render [file nativename [file join $dir th1-tcl8.txt]]
113
+fossil test-th-render --th-open-config \
114
+ [file nativename [file join $dir th1-tcl8.txt]]
107115
108116
test th1-tcl-8 {$RESULT eq {<hr><p class="thmainError">ERROR:\
109117
cannot invoke Tcl command: tailcall</p>} || $RESULT eq {<hr><p\
110118
class="thmainError">ERROR: tailcall can only be called from a proc or\
111119
lambda</p>}}
112120
113121
###############################################################################
114122
115
-fossil test-th-render [file nativename [file join $dir th1-tcl9.txt]]
123
+fossil test-th-render --th-open-config \
124
+ [file nativename [file join $dir th1-tcl9.txt]]
116125
117
-test th1-tcl-9 {[string trim $RESULT] eq [list [file tail $fossilexe] 2 \
118
-[list test-th-render [file nativename [file join $dir th1-tcl9.txt]]]]}
126
+test th1-tcl-9 {[string trim $RESULT] eq [list [file tail $fossilexe] 3 \
127
+[list test-th-render --th-open-config [file nativename [file join $dir \
128
+th1-tcl9.txt]]]]}
119129
120130
ADDED test/th1.test
--- test/th1-tcl.test
+++ test/th1-tcl.test
@@ -32,11 +32,12 @@
32
33 set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test.
34
35 ###############################################################################
36
37 fossil test-th-render [file nativename [file join $dir th1-tcl1.txt]]
 
38
39 test th1-tcl-1 {[regexp -- {^tclReady\(before\) = 0
40 tclReady\(after\) = 1
41 \d+
42 \d+
@@ -58,61 +59,70 @@
58 three words now
59 $} [string map [list \r\n \n] $RESULT]]}
60
61 ###############################################################################
62
63 fossil test-th-render [file nativename [file join $dir th1-tcl2.txt]]
 
64
65 test th1-tcl-2 {[regexp -- {^\d+
66 $} [string map [list \r\n \n] $RESULT]]}
67
68 ###############################################################################
69
70 fossil test-th-render [file nativename [file join $dir th1-tcl3.txt]]
 
71
72 test th1-tcl-3 {$RESULT eq {<hr><p class="thmainError">ERROR:\
73 invalid command name &quot;bad_command&quot;</p>}}
74
75 ###############################################################################
76
77 fossil test-th-render [file nativename [file join $dir th1-tcl4.txt]]
 
78
79 test th1-tcl-4 {$RESULT eq {<hr><p class="thmainError">ERROR:\
80 divide by zero</p>}}
81
82 ###############################################################################
83
84 fossil test-th-render [file nativename [file join $dir th1-tcl5.txt]]
 
85
86 test th1-tcl-5 {$RESULT eq {<hr><p class="thmainError">ERROR:\
87 Tcl command not found: bad_command</p>} || $RESULT eq {<hr><p\
88 class="thmainError">ERROR: invalid command name &quot;bad_command&quot;</p>}}
89
90 ###############################################################################
91
92 fossil test-th-render [file nativename [file join $dir th1-tcl6.txt]]
 
93
94 test th1-tcl-6 {$RESULT eq {<hr><p class="thmainError">ERROR:\
95 no such command: bad_command</p>}}
96
97 ###############################################################################
98
99 fossil test-th-render [file nativename [file join $dir th1-tcl7.txt]]
 
100
101 test th1-tcl-7 {$RESULT eq {<hr><p class="thmainError">ERROR:\
102 syntax error in expression: &quot;2**0&quot;</p>}}
103
104 ###############################################################################
105
106 fossil test-th-render [file nativename [file join $dir th1-tcl8.txt]]
 
107
108 test th1-tcl-8 {$RESULT eq {<hr><p class="thmainError">ERROR:\
109 cannot invoke Tcl command: tailcall</p>} || $RESULT eq {<hr><p\
110 class="thmainError">ERROR: tailcall can only be called from a proc or\
111 lambda</p>}}
112
113 ###############################################################################
114
115 fossil test-th-render [file nativename [file join $dir th1-tcl9.txt]]
 
116
117 test th1-tcl-9 {[string trim $RESULT] eq [list [file tail $fossilexe] 2 \
118 [list test-th-render [file nativename [file join $dir th1-tcl9.txt]]]]}
 
119
120 DDED test/th1.test
--- test/th1-tcl.test
+++ test/th1-tcl.test
@@ -32,11 +32,12 @@
32
33 set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test.
34
35 ###############################################################################
36
37 fossil test-th-render --th-open-config \
38 [file nativename [file join $dir th1-tcl1.txt]]
39
40 test th1-tcl-1 {[regexp -- {^tclReady\(before\) = 0
41 tclReady\(after\) = 1
42 \d+
43 \d+
@@ -58,61 +59,70 @@
59 three words now
60 $} [string map [list \r\n \n] $RESULT]]}
61
62 ###############################################################################
63
64 fossil test-th-render --th-open-config \
65 [file nativename [file join $dir th1-tcl2.txt]]
66
67 test th1-tcl-2 {[regexp -- {^\d+
68 $} [string map [list \r\n \n] $RESULT]]}
69
70 ###############################################################################
71
72 fossil test-th-render --th-open-config \
73 [file nativename [file join $dir th1-tcl3.txt]]
74
75 test th1-tcl-3 {$RESULT eq {<hr><p class="thmainError">ERROR:\
76 invalid command name &quot;bad_command&quot;</p>}}
77
78 ###############################################################################
79
80 fossil test-th-render --th-open-config \
81 [file nativename [file join $dir th1-tcl4.txt]]
82
83 test th1-tcl-4 {$RESULT eq {<hr><p class="thmainError">ERROR:\
84 divide by zero</p>}}
85
86 ###############################################################################
87
88 fossil test-th-render --th-open-config \
89 [file nativename [file join $dir th1-tcl5.txt]]
90
91 test th1-tcl-5 {$RESULT eq {<hr><p class="thmainError">ERROR:\
92 Tcl command not found: bad_command</p>} || $RESULT eq {<hr><p\
93 class="thmainError">ERROR: invalid command name &quot;bad_command&quot;</p>}}
94
95 ###############################################################################
96
97 fossil test-th-render --th-open-config \
98 [file nativename [file join $dir th1-tcl6.txt]]
99
100 test th1-tcl-6 {$RESULT eq {<hr><p class="thmainError">ERROR:\
101 no such command: bad_command</p>}}
102
103 ###############################################################################
104
105 fossil test-th-render --th-open-config \
106 [file nativename [file join $dir th1-tcl7.txt]]
107
108 test th1-tcl-7 {$RESULT eq {<hr><p class="thmainError">ERROR:\
109 syntax error in expression: &quot;2**0&quot;</p>}}
110
111 ###############################################################################
112
113 fossil test-th-render --th-open-config \
114 [file nativename [file join $dir th1-tcl8.txt]]
115
116 test th1-tcl-8 {$RESULT eq {<hr><p class="thmainError">ERROR:\
117 cannot invoke Tcl command: tailcall</p>} || $RESULT eq {<hr><p\
118 class="thmainError">ERROR: tailcall can only be called from a proc or\
119 lambda</p>}}
120
121 ###############################################################################
122
123 fossil test-th-render --th-open-config \
124 [file nativename [file join $dir th1-tcl9.txt]]
125
126 test th1-tcl-9 {[string trim $RESULT] eq [list [file tail $fossilexe] 3 \
127 [list test-th-render --th-open-config [file nativename [file join $dir \
128 th1-tcl9.txt]]]]}
129
130 DDED test/th1.test
--- a/test/th1.test
+++ b/test/th1.test
@@ -0,0 +1,39 @@
1
+ file (i.e.
2
+# ""n_in_checkopyright7run_in_checkab "") changes.
3
+#kdownin_checkout {
4
+oyrun_in_chec"TH_ERROexisrce file (i.e.
5
+# "") changes.
6
+#
7
+run_in_checkout {
8
+
9
+markdown{run_in_checkout {
10
+oyrun_in_checkout
11
+1run_in_checkoutcheckout"
12
+ }
13
+}
14
+2run_in_chout {run_in_checkout {
15
+oyrun_in_checkout
16
+1run_in_checkoutcheckout"
17
+ }
18
+}
19
+2run_in_checkout {
20
+
21
+
22
+test th1-header-2run_in_checkout {
23
+#3run_in_checkout {
24
+#
25
+# Copyright7run_in_checkout#
26
+# Copyright}
27
+}
28
+run_in_checkout#
29
+# Copyright
30
+8run_in_checkout9ODO: Modify the result of this test if the source file (i.e.
31
+# "") changes.
32
+#
33
+run_iut {
34
+
35
+
36
+test th1-heatcheckout"
37
+ }
38
+}
39
+2run_eckout 1;
--- a/test/th1.test
+++ b/test/th1.test
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/test/th1.test
+++ b/test/th1.test
@@ -0,0 +1,39 @@
1 file (i.e.
2 # ""n_in_checkopyright7run_in_checkab "") changes.
3 #kdownin_checkout {
4 oyrun_in_chec"TH_ERROexisrce file (i.e.
5 # "") changes.
6 #
7 run_in_checkout {
8
9 markdown{run_in_checkout {
10 oyrun_in_checkout
11 1run_in_checkoutcheckout"
12 }
13 }
14 2run_in_chout {run_in_checkout {
15 oyrun_in_checkout
16 1run_in_checkoutcheckout"
17 }
18 }
19 2run_in_checkout {
20
21
22 test th1-header-2run_in_checkout {
23 #3run_in_checkout {
24 #
25 # Copyright7run_in_checkout#
26 # Copyright}
27 }
28 run_in_checkout#
29 # Copyright
30 8run_in_checkout9ODO: Modify the result of this test if the source file (i.e.
31 # "") changes.
32 #
33 run_iut {
34
35
36 test th1-heatcheckout"
37 }
38 }
39 2run_eckout 1;

Keyboard Shortcuts

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