Fossil SCM

Another test-case which gave an expected error-message, with fix: before: $ fossil test-th-eval "expr 0+0b" TH_ERROR: syntax error in expression: "0+0b" after: $ ./fossil test-th-eval "expr 0+0b" TH_ERROR: expected number, got: "0b"

jan.nijtmans 2014-04-04 11:07 trunk
Commit b78ae90a84d5b0551f31b187b7f08fd6a9471e29
2 files changed +1 -1 +8
+1 -1
--- src/th.c
+++ src/th.c
@@ -1882,11 +1882,11 @@
18821882
){
18831883
int i;
18841884
int (*isdigit)(char) = th_isdigit;
18851885
char c;
18861886
1887
- if( nInput<3) return TH_ERROR;
1887
+ if( nInput<2) return TH_ERROR;
18881888
assert(zInput[0]=='0');
18891889
c = zInput[1];
18901890
if( c>='A' && c<='Z' ) c += 'a' - 'A';
18911891
if( c=='x' ){
18921892
isdigit = th_ishexdig;
18931893
--- src/th.c
+++ src/th.c
@@ -1882,11 +1882,11 @@
1882 ){
1883 int i;
1884 int (*isdigit)(char) = th_isdigit;
1885 char c;
1886
1887 if( nInput<3) return TH_ERROR;
1888 assert(zInput[0]=='0');
1889 c = zInput[1];
1890 if( c>='A' && c<='Z' ) c += 'a' - 'A';
1891 if( c=='x' ){
1892 isdigit = th_ishexdig;
1893
--- src/th.c
+++ src/th.c
@@ -1882,11 +1882,11 @@
1882 ){
1883 int i;
1884 int (*isdigit)(char) = th_isdigit;
1885 char c;
1886
1887 if( nInput<2) return TH_ERROR;
1888 assert(zInput[0]=='0');
1889 c = zInput[1];
1890 if( c>='A' && c<='Z' ) c += 'a' - 'A';
1891 if( c=='x' ){
1892 isdigit = th_ishexdig;
1893
--- test/th1.test
+++ test/th1.test
@@ -467,5 +467,13 @@
467467
468468
###############################################################################
469469
470470
fossil test-th-eval "expr 0b1+5"
471471
test th1-expr-34 {$RESULT eq {6}}
472
+
473
+
474
+###############################################################################
475
+
476
+fossil test-th-eval "expr 0+0b"
477
+test th1-expr-35 {$RESULT eq {TH_ERROR: expected number, got: "0b"}}
478
+
479
+
472480
--- test/th1.test
+++ test/th1.test
@@ -467,5 +467,13 @@
467
468 ###############################################################################
469
470 fossil test-th-eval "expr 0b1+5"
471 test th1-expr-34 {$RESULT eq {6}}
 
 
 
 
 
 
 
 
472
--- test/th1.test
+++ test/th1.test
@@ -467,5 +467,13 @@
467
468 ###############################################################################
469
470 fossil test-th-eval "expr 0b1+5"
471 test th1-expr-34 {$RESULT eq {6}}
472
473
474 ###############################################################################
475
476 fossil test-th-eval "expr 0+0b"
477 test th1-expr-35 {$RESULT eq {TH_ERROR: expected number, got: "0b"}}
478
479
480

Keyboard Shortcuts

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