Fossil SCM

Skip running the Tcl integration tests if Fossil was not compiled with Tcl integration support.

mistachkin 2013-03-10 09:23 trunk
Commit 6c47a16e5def3b50b0d326718fa44be39acc3fc4
+19 -3
--- src/th_main.c
+++ src/th_main.c
@@ -87,14 +87,14 @@
8787
}
8888
8989
/*
9090
** Return a name for a TH1 return code.
9191
*/
92
-const char *Th_ReturnCodeName(int rc){
92
+const char *Th_ReturnCodeName(int rc, int nullIfOk){
9393
static char zRc[32];
9494
switch( rc ){
95
- case TH_OK: return "TH_OK";
95
+ case TH_OK: return nullIfOk ? 0 : "TH_OK";
9696
case TH_ERROR: return "TH_ERROR";
9797
case TH_BREAK: return "TH_BREAK";
9898
case TH_RETURN: return "TH_RETURN";
9999
case TH_CONTINUE: return "TH_CONTINUE";
100100
default: {
@@ -742,11 +742,11 @@
742742
sendError(zResult, nResult, 0);
743743
}
744744
}
745745
if( g.thTrace ){
746746
Th_Trace("th1-setup {%h} => %h<br />\n", g.th1Setup,
747
- Th_ReturnCodeName(rc));
747
+ Th_ReturnCodeName(rc, 0));
748748
}
749749
}
750750
}
751751
752752
/*
@@ -932,5 +932,21 @@
932932
db_open_config(0); /* Needed for global "tcl" setting. */
933933
blob_zero(&in);
934934
blob_read_from_file(&in, g.argv[2]);
935935
Th_Render(blob_str(&in));
936936
}
937
+
938
+/*
939
+** COMMAND: test-th-eval
940
+*/
941
+void test_th_eval(void){
942
+ int rc;
943
+ const char *zRc;
944
+ if( g.argc!=3 ){
945
+ usage("script");
946
+ }
947
+ Th_FossilInit(0, 0);
948
+ rc = Th_Eval(g.interp, 0, g.argv[2], -1);
949
+ zRc = Th_ReturnCodeName(rc, 1);
950
+ fossil_print("%s%s%s\n", zRc, zRc ? ": " : "",
951
+ Th_GetResult(g.interp, 0));
952
+}
937953
--- src/th_main.c
+++ src/th_main.c
@@ -87,14 +87,14 @@
87 }
88
89 /*
90 ** Return a name for a TH1 return code.
91 */
92 const char *Th_ReturnCodeName(int rc){
93 static char zRc[32];
94 switch( rc ){
95 case TH_OK: return "TH_OK";
96 case TH_ERROR: return "TH_ERROR";
97 case TH_BREAK: return "TH_BREAK";
98 case TH_RETURN: return "TH_RETURN";
99 case TH_CONTINUE: return "TH_CONTINUE";
100 default: {
@@ -742,11 +742,11 @@
742 sendError(zResult, nResult, 0);
743 }
744 }
745 if( g.thTrace ){
746 Th_Trace("th1-setup {%h} => %h<br />\n", g.th1Setup,
747 Th_ReturnCodeName(rc));
748 }
749 }
750 }
751
752 /*
@@ -932,5 +932,21 @@
932 db_open_config(0); /* Needed for global "tcl" setting. */
933 blob_zero(&in);
934 blob_read_from_file(&in, g.argv[2]);
935 Th_Render(blob_str(&in));
936 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
937
--- src/th_main.c
+++ src/th_main.c
@@ -87,14 +87,14 @@
87 }
88
89 /*
90 ** Return a name for a TH1 return code.
91 */
92 const char *Th_ReturnCodeName(int rc, int nullIfOk){
93 static char zRc[32];
94 switch( rc ){
95 case TH_OK: return nullIfOk ? 0 : "TH_OK";
96 case TH_ERROR: return "TH_ERROR";
97 case TH_BREAK: return "TH_BREAK";
98 case TH_RETURN: return "TH_RETURN";
99 case TH_CONTINUE: return "TH_CONTINUE";
100 default: {
@@ -742,11 +742,11 @@
742 sendError(zResult, nResult, 0);
743 }
744 }
745 if( g.thTrace ){
746 Th_Trace("th1-setup {%h} => %h<br />\n", g.th1Setup,
747 Th_ReturnCodeName(rc, 0));
748 }
749 }
750 }
751
752 /*
@@ -932,5 +932,21 @@
932 db_open_config(0); /* Needed for global "tcl" setting. */
933 blob_zero(&in);
934 blob_read_from_file(&in, g.argv[2]);
935 Th_Render(blob_str(&in));
936 }
937
938 /*
939 ** COMMAND: test-th-eval
940 */
941 void test_th_eval(void){
942 int rc;
943 const char *zRc;
944 if( g.argc!=3 ){
945 usage("script");
946 }
947 Th_FossilInit(0, 0);
948 rc = Th_Eval(g.interp, 0, g.argv[2], -1);
949 zRc = Th_ReturnCodeName(rc, 1);
950 fossil_print("%s%s%s\n", zRc, zRc ? ": " : "",
951 Th_GetResult(g.interp, 0));
952 }
953
--- test/th1-tcl.test
+++ test/th1-tcl.test
@@ -17,10 +17,18 @@
1717
#
1818
# TH1/Tcl integration
1919
#
2020
2121
set dir [file dirname [info script]]
22
+
23
+###############################################################################
24
+
25
+fossil test-th-eval "hasfeature tcl"
26
+
27
+if {$::RESULT ne "1"} then {
28
+ puts "Fossil was not compiled with Tcl support."; return
29
+}
2230
2331
###############################################################################
2432
2533
set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test.
2634
2735
--- test/th1-tcl.test
+++ test/th1-tcl.test
@@ -17,10 +17,18 @@
17 #
18 # TH1/Tcl integration
19 #
20
21 set dir [file dirname [info script]]
 
 
 
 
 
 
 
 
22
23 ###############################################################################
24
25 set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test.
26
27
--- test/th1-tcl.test
+++ test/th1-tcl.test
@@ -17,10 +17,18 @@
17 #
18 # TH1/Tcl integration
19 #
20
21 set dir [file dirname [info script]]
22
23 ###############################################################################
24
25 fossil test-th-eval "hasfeature tcl"
26
27 if {$::RESULT ne "1"} then {
28 puts "Fossil was not compiled with Tcl support."; return
29 }
30
31 ###############################################################################
32
33 set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test.
34
35

Keyboard Shortcuts

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