summaryrefslogtreecommitdiffstats
path: root/tests/parseExpr.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/parseExpr.test')
-rw-r--r--tests/parseExpr.test273
1 files changed, 193 insertions, 80 deletions
diff --git a/tests/parseExpr.test b/tests/parseExpr.test
index b60cee3..2fc4fed 100644
--- a/tests/parseExpr.test
+++ b/tests/parseExpr.test
@@ -8,7 +8,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: parseExpr.test,v 1.13 2004/06/23 15:36:57 dkf Exp $
+# RCS: @(#) $Id: parseExpr.test,v 1.14 2005/05/10 18:35:22 kennykb Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -27,6 +27,64 @@ testConstraint testexprparser [llength [info commands testexprparser]]
testConstraint wideIntegerUnparsed [expr {-1 == 0xffffffff}]
+# Big test for correct ordering of data in [expr]
+
+proc testIEEE {} {
+ variable ieeeValues
+ binary scan [binary format dd -1.0 1.0] c* c
+ switch -exact -- $c {
+ {0 0 0 0 0 0 -16 -65 0 0 0 0 0 0 -16 63} {
+ # little endian
+ binary scan \x00\x00\x00\x00\x00\x00\xf0\xff d \
+ ieeeValues(-Infinity)
+ binary scan \x00\x00\x00\x00\x00\x00\xf0\xbf d \
+ ieeeValues(-Normal)
+ binary scan \x00\x00\x00\x00\x00\x00\x08\x80 d \
+ ieeeValues(-Subnormal)
+ binary scan \x00\x00\x00\x00\x00\x00\x00\x80 d \
+ ieeeValues(-0)
+ binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(+0)
+ binary scan \x00\x00\x00\x00\x00\x00\x08\x00 d \
+ ieeeValues(+Subnormal)
+ binary scan \x00\x00\x00\x00\x00\x00\xf0\x3f d \
+ ieeeValues(+Normal)
+ binary scan \x00\x00\x00\x00\x00\x00\xf0\x7f d \
+ ieeeValues(+Infinity)
+ binary scan \x00\x00\x00\x00\x00\x00\xf8\x7f d \
+ ieeeValues(NaN)
+ set ieeeValues(littleEndian) 1
+ return 1
+ }
+ {-65 -16 0 0 0 0 0 0 63 -16 0 0 0 0 0 0} {
+ binary scan \xff\xf0\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(-Infinity)
+ binary scan \xbf\xf0\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(-Normal)
+ binary scan \x80\x08\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(-Subnormal)
+ binary scan \x80\x00\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(-0)
+ binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(+0)
+ binary scan \x00\x08\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(+Subnormal)
+ binary scan \x3f\xf0\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(+Normal)
+ binary scan \x7f\xf0\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(+Infinity)
+ binary scan \x7f\xf8\x00\x00\x00\x00\x00\x00 d \
+ ieeeValues(NaN)
+ set ieeeValues(littleEndian) 0
+ return 1
+ }
+ default {
+ return 0
+ }
+ }
+}
+::tcltest::testConstraint ieeeFloatingPoint [testIEEE]
+
######################################################################
test parseExpr-1.1 {Tcl_ParseExpr procedure, computing string length} testexprparser {
@@ -38,9 +96,11 @@ test parseExpr-1.2 {Tcl_ParseExpr procedure, computing string length} testexprpa
test parseExpr-1.3 {Tcl_ParseExpr procedure, error getting initial lexeme} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {12345678901234567890} -1} msg] $msg
} {1 {integer value too large to represent}}
-test parseExpr-1.4 {Tcl_ParseExpr procedure, error in conditional expression} testexprparser {
- list [catch {testexprparser {foo+} -1} msg] $msg
-} {1 {syntax error in expression "foo+": variable references require preceding $}}
+test parseExpr-1.4 {Tcl_ParseExpr procedure, error in conditional expression} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {foo+} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "foo+": *preceding $*}}
test parseExpr-1.5 {Tcl_ParseExpr procedure, lexemes after the expression} testexprparser {
list [catch {testexprparser {1+2 345} -1} msg] $msg
} {1 {syntax error in expression "1+2 345": extra tokens at end of expression}}
@@ -48,9 +108,11 @@ test parseExpr-1.5 {Tcl_ParseExpr procedure, lexemes after the expression} teste
test parseExpr-2.1 {ParseCondExpr procedure, valid test subexpr} testexprparser {
testexprparser {2>3? 1 : 0} -1
} {- {} 0 subexpr {2>3? 1 : 0} 11 operator ? 0 subexpr 2>3 5 operator > 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
-test parseExpr-2.2 {ParseCondExpr procedure, error in test subexpr} testexprparser {
- list [catch {testexprparser {0 || foo} -1} msg] $msg
-} {1 {syntax error in expression "0 || foo": variable references require preceding $}}
+test parseExpr-2.2 {ParseCondExpr procedure, error in test subexpr} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {0 || foo} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "0 || foo": * preceding $*}}
test parseExpr-2.3 {ParseCondExpr procedure, next lexeme isn't "?"} testexprparser {
testexprparser {1+2} -1
} {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
@@ -63,25 +125,31 @@ test parseExpr-2.5 {ParseCondExpr procedure, bad lexeme after "?"} {testexprpars
test parseExpr-2.6 {ParseCondExpr procedure, valid "then" subexpression} testexprparser {
testexprparser {1? 3 : 4} -1
} {- {} 0 subexpr {1? 3 : 4} 7 operator ? 0 subexpr 1 1 text 1 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
-test parseExpr-2.7 {ParseCondExpr procedure, error in "then" subexpression} testexprparser {
- list [catch {testexprparser {1? fred : martha} -1} msg] $msg
-} {1 {syntax error in expression "1? fred : martha": variable references require preceding $}}
+test parseExpr-2.7 {ParseCondExpr procedure, error in "then" subexpression} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1? fred : martha} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1? fred : martha": *preceding $*}}
test parseExpr-2.8 {ParseCondExpr procedure, lexeme after "then" subexpr isn't ":"} testexprparser {
list [catch {testexprparser {1? 2 martha 3} -1} msg] $msg
} {1 {syntax error in expression "1? 2 martha 3": missing colon from ternary conditional}}
test parseExpr-2.9 {ParseCondExpr procedure, valid "else" subexpression} testexprparser {
testexprparser {27||3? 3 : 4&&9} -1
} {- {} 0 subexpr {27||3? 3 : 4&&9} 15 operator ? 0 subexpr 27||3 5 operator || 0 subexpr 27 1 text 27 0 subexpr 3 1 text 3 0 subexpr 3 1 text 3 0 subexpr 4&&9 5 operator && 0 subexpr 4 1 text 4 0 subexpr 9 1 text 9 0 {}}
-test parseExpr-2.10 {ParseCondExpr procedure, error in "else" subexpression} testexprparser {
- list [catch {testexprparser {1? 2 : martha} -1} msg] $msg
-} {1 {syntax error in expression "1? 2 : martha": variable references require preceding $}}
+test parseExpr-2.10 {ParseCondExpr procedure, error in "else" subexpression} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1? 2 : martha} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1? 2 : martha": * preceding $*}}
test parseExpr-3.1 {ParseLorExpr procedure, valid logical and subexpr} testexprparser {
testexprparser {1&&2 || 3} -1
} {- {} 0 subexpr {1&&2 || 3} 9 operator || 0 subexpr 1&&2 5 operator && 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
-test parseExpr-3.2 {ParseLorExpr procedure, error in logical and subexpr} testexprparser {
- list [catch {testexprparser {1&&foo || 3} -1} msg] $msg
-} {1 {syntax error in expression "1&&foo || 3": variable references require preceding $}}
+test parseExpr-3.2 {ParseLorExpr procedure, error in logical and subexpr} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1&&foo || 3} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1&&foo || 3": * preceding $*}}
test parseExpr-3.3 {ParseLorExpr procedure, next lexeme isn't "||"} testexprparser {
testexprparser {1&&2? 1 : 0} -1
} {- {} 0 subexpr {1&&2? 1 : 0} 11 operator ? 0 subexpr 1&&2 5 operator && 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
@@ -94,16 +162,20 @@ test parseExpr-3.5 {ParseLorExpr procedure, bad lexeme after "||"} {testexprpars
test parseExpr-3.6 {ParseLorExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1&&2 || 3 || 4} -1
} {- {} 0 subexpr {1&&2 || 3 || 4} 13 operator || 0 subexpr {1&&2 || 3} 9 operator || 0 subexpr 1&&2 5 operator && 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
-test parseExpr-3.7 {ParseLorExpr procedure, error in RHS subexpression} testexprparser {
- list [catch {testexprparser {1&&2 || 3 || martha} -1} msg] $msg
-} {1 {syntax error in expression "1&&2 || 3 || martha": variable references require preceding $}}
+test parseExpr-3.7 {ParseLorExpr procedure, error in RHS subexpression} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1&&2 || 3 || martha} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1&&2 || 3 || martha": * preceding $*}}
test parseExpr-4.1 {ParseLandExpr procedure, valid LHS "|" subexpr} testexprparser {
testexprparser {1|2 && 3} -1
} {- {} 0 subexpr {1|2 && 3} 9 operator && 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
-test parseExpr-4.2 {ParseLandExpr procedure, error in LHS "|" subexpr} testexprparser {
- list [catch {testexprparser {1&&foo && 3} -1} msg] $msg
-} {1 {syntax error in expression "1&&foo && 3": variable references require preceding $}}
+test parseExpr-4.2 {ParseLandExpr procedure, error in LHS "|" subexpr} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1&&foo && 3} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1&&foo && 3": * preceding $*}}
test parseExpr-4.3 {ParseLandExpr procedure, next lexeme isn't "&&"} testexprparser {
testexprparser {1|2? 1 : 0} -1
} {- {} 0 subexpr {1|2? 1 : 0} 11 operator ? 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
@@ -116,16 +188,20 @@ test parseExpr-4.5 {ParseLandExpr procedure, bad lexeme after "&&"} {testexprpar
test parseExpr-4.6 {ParseLandExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1|2 && 3 && 4} -1
} {- {} 0 subexpr {1|2 && 3 && 4} 13 operator && 0 subexpr {1|2 && 3} 9 operator && 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
-test parseExpr-4.7 {ParseLandExpr procedure, error in RHS subexpression} testexprparser {
- list [catch {testexprparser {1|2 && 3 && martha} -1} msg] $msg
-} {1 {syntax error in expression "1|2 && 3 && martha": variable references require preceding $}}
+test parseExpr-4.7 {ParseLandExpr procedure, error in RHS subexpression} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1|2 && 3 && martha} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1|2 && 3 && martha": * preceding $*}}
test parseExpr-5.1 {ParseBitOrExpr procedure, valid LHS "^" subexpr} testexprparser {
testexprparser {1^2 | 3} -1
} {- {} 0 subexpr {1^2 | 3} 9 operator | 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
-test parseExpr-5.2 {ParseBitOrExpr procedure, error in LHS "^" subexpr} testexprparser {
- list [catch {testexprparser {1|foo | 3} -1} msg] $msg
-} {1 {syntax error in expression "1|foo | 3": variable references require preceding $}}
+test parseExpr-5.2 {ParseBitOrExpr procedure, error in LHS "^" subexpr} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1|foo | 3} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1|foo | 3": * preceding $*}}
test parseExpr-5.3 {ParseBitOrExpr procedure, next lexeme isn't "|"} testexprparser {
testexprparser {1^2? 1 : 0} -1
} {- {} 0 subexpr {1^2? 1 : 0} 11 operator ? 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
@@ -138,16 +214,20 @@ test parseExpr-5.5 {ParseBitOrExpr procedure, bad lexeme after "|"} {testexprpar
test parseExpr-5.6 {ParseBitOrExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1^2 | 3 | 4} -1
} {- {} 0 subexpr {1^2 | 3 | 4} 13 operator | 0 subexpr {1^2 | 3} 9 operator | 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
-test parseExpr-5.7 {ParseBitOrExpr procedure, error in RHS subexpression} testexprparser {
- list [catch {testexprparser {1^2 | 3 | martha} -1} msg] $msg
-} {1 {syntax error in expression "1^2 | 3 | martha": variable references require preceding $}}
+test parseExpr-5.7 {ParseBitOrExpr procedure, error in RHS subexpression} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1^2 | 3 | martha} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1^2 | 3 | martha": * preceding $*}}
test parseExpr-6.1 {ParseBitXorExpr procedure, valid LHS "&" subexpr} testexprparser {
testexprparser {1&2 ^ 3} -1
} {- {} 0 subexpr {1&2 ^ 3} 9 operator ^ 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
-test parseExpr-6.2 {ParseBitXorExpr procedure, error in LHS "&" subexpr} testexprparser {
- list [catch {testexprparser {1^foo ^ 3} -1} msg] $msg
-} {1 {syntax error in expression "1^foo ^ 3": variable references require preceding $}}
+test parseExpr-6.2 {ParseBitXorExpr procedure, error in LHS "&" subexpr} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1^foo ^ 3} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1^foo ^ 3": * preceding $*}}
test parseExpr-6.3 {ParseBitXorExpr procedure, next lexeme isn't "^"} testexprparser {
testexprparser {1&2? 1 : 0} -1
} {- {} 0 subexpr {1&2? 1 : 0} 11 operator ? 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
@@ -160,16 +240,20 @@ test parseExpr-6.5 {ParseBitXorExpr procedure, bad lexeme after "^"} {testexprpa
test parseExpr-6.6 {ParseBitXorExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1&2 ^ 3 ^ 4} -1
} {- {} 0 subexpr {1&2 ^ 3 ^ 4} 13 operator ^ 0 subexpr {1&2 ^ 3} 9 operator ^ 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
-test parseExpr-6.7 {ParseBitXorExpr procedure, error in RHS subexpression} testexprparser {
- list [catch {testexprparser {1&2 ^ 3 ^ martha} -1} msg] $msg
-} {1 {syntax error in expression "1&2 ^ 3 ^ martha": variable references require preceding $}}
+test parseExpr-6.7 {ParseBitXorExpr procedure, error in RHS subexpression} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1&2 ^ 3 ^ martha} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1&2 ^ 3 ^ martha": * preceding $*}}
test parseExpr-7.1 {ParseBitAndExpr procedure, valid LHS equality subexpr} testexprparser {
testexprparser {1==2 & 3} -1
} {- {} 0 subexpr {1==2 & 3} 9 operator & 0 subexpr 1==2 5 operator == 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
-test parseExpr-7.2 {ParseBitAndExpr procedure, error in LHS equality subexpr} testexprparser {
- list [catch {testexprparser {1!=foo & 3} -1} msg] $msg
-} {1 {syntax error in expression "1!=foo & 3": variable references require preceding $}}
+test parseExpr-7.2 {ParseBitAndExpr procedure, error in LHS equality subexpr} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1!=foo & 3} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1!=foo & 3": * preceding $*}}
test parseExpr-7.3 {ParseBitAndExpr procedure, next lexeme isn't "&"} testexprparser {
testexprparser {1==2? 1 : 0} -1
} {- {} 0 subexpr {1==2? 1 : 0} 11 operator ? 0 subexpr 1==2 5 operator == 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
@@ -182,16 +266,20 @@ test parseExpr-7.5 {ParseBitAndExpr procedure, bad lexeme after "&"} {testexprpa
test parseExpr-7.6 {ParseBitAndExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1<2 & 3 & 4} -1
} {- {} 0 subexpr {1<2 & 3 & 4} 13 operator & 0 subexpr {1<2 & 3} 9 operator & 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
-test parseExpr-7.7 {ParseBitAndExpr procedure, error in RHS subexpression} testexprparser {
- list [catch {testexprparser {1==2 & 3>2 & martha} -1} msg] $msg
-} {1 {syntax error in expression "1==2 & 3>2 & martha": variable references require preceding $}}
+test parseExpr-7.7 {ParseBitAndExpr procedure, error in RHS subexpression} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1==2 & 3>2 & martha} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1==2 & 3>2 & martha": * preceding $*}}
test parseExpr-8.1 {ParseEqualityExpr procedure, valid LHS relational subexpr} testexprparser {
testexprparser {1<2 == 3} -1
} {- {} 0 subexpr {1<2 == 3} 9 operator == 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
-test parseExpr-8.2 {ParseEqualityExpr procedure, error in LHS relational subexpr} testexprparser {
- list [catch {testexprparser {1>=foo == 3} -1} msg] $msg
-} {1 {syntax error in expression "1>=foo == 3": variable references require preceding $}}
+test parseExpr-8.2 {ParseEqualityExpr procedure, error in LHS relational subexpr} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1>=foo == 3} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1>=foo == 3": * preceding $*}}
test parseExpr-8.3 {ParseEqualityExpr procedure, next lexeme isn't "==" or "!="} testexprparser {
testexprparser {1<2? 1 : 0} -1
} {- {} 0 subexpr {1<2? 1 : 0} 11 operator ? 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
@@ -207,16 +295,20 @@ test parseExpr-8.6 {ParseEqualityExpr procedure, bad lexeme after "==" or "!="}
test parseExpr-8.7 {ParseEqualityExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1<2 == 3 == 4} -1
} {- {} 0 subexpr {1<2 == 3 == 4} 13 operator == 0 subexpr {1<2 == 3} 9 operator == 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
-test parseExpr-8.8 {ParseEqualityExpr procedure, error in RHS subexpression} testexprparser {
- list [catch {testexprparser {1<2 == 3 != martha} -1} msg] $msg
-} {1 {syntax error in expression "1<2 == 3 != martha": variable references require preceding $}}
+test parseExpr-8.8 {ParseEqualityExpr procedure, error in RHS subexpression} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1<2 == 3 != martha} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1<2 == 3 != martha": * preceding $*}}
test parseExpr-9.1 {ParseRelationalExpr procedure, valid LHS shift subexpr} testexprparser {
testexprparser {1<<2 < 3} -1
} {- {} 0 subexpr {1<<2 < 3} 9 operator < 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
-test parseExpr-9.2 {ParseRelationalExpr procedure, error in LHS shift subexpr} testexprparser {
- list [catch {testexprparser {1>=foo < 3} -1} msg] $msg
-} {1 {syntax error in expression "1>=foo < 3": variable references require preceding $}}
+test parseExpr-9.2 {ParseRelationalExpr procedure, error in LHS shift subexpr} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1>=foo < 3} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1>=foo < 3": * preceding $*}}
test parseExpr-9.3 {ParseRelationalExpr procedure, next lexeme isn't relational op} testexprparser {
testexprparser {1<<2? 1 : 0} -1
} {- {} 0 subexpr {1<<2? 1 : 0} 11 operator ? 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
@@ -238,16 +330,20 @@ test parseExpr-9.8 {ParseRelationalExpr procedure, bad lexeme after relational o
test parseExpr-9.9 {ParseRelationalExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1<<2 < 3 < 4} -1
} {- {} 0 subexpr {1<<2 < 3 < 4} 13 operator < 0 subexpr {1<<2 < 3} 9 operator < 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
-test parseExpr-9.10 {ParseRelationalExpr procedure, error in RHS subexpression} testexprparser {
- list [catch {testexprparser {1<<2 < 3 > martha} -1} msg] $msg
-} {1 {syntax error in expression "1<<2 < 3 > martha": variable references require preceding $}}
+test parseExpr-9.10 {ParseRelationalExpr procedure, error in RHS subexpression} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1<<2 < 3 > martha} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1<<2 < 3 > martha": * preceding $*}}
test parseExpr-10.1 {ParseShiftExpr procedure, valid LHS add subexpr} testexprparser {
testexprparser {1+2 << 3} -1
} {- {} 0 subexpr {1+2 << 3} 9 operator << 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
-test parseExpr-10.2 {ParseShiftExpr procedure, error in LHS add subexpr} testexprparser {
- list [catch {testexprparser {1-foo << 3} -1} msg] $msg
-} {1 {syntax error in expression "1-foo << 3": variable references require preceding $}}
+test parseExpr-10.2 {ParseShiftExpr procedure, error in LHS add subexpr} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1-foo << 3} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1-foo << 3": * preceding $*}}
test parseExpr-10.3 {ParseShiftExpr procedure, next lexeme isn't "<<" or ">>"} testexprparser {
testexprparser {1+2? 1 : 0} -1
} {- {} 0 subexpr {1+2? 1 : 0} 11 operator ? 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
@@ -263,16 +359,20 @@ test parseExpr-10.6 {ParseShiftExpr procedure, bad lexeme after "<<" or ">>"} {t
test parseExpr-10.7 {ParseShiftExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1+2 << 3 << 4} -1
} {- {} 0 subexpr {1+2 << 3 << 4} 13 operator << 0 subexpr {1+2 << 3} 9 operator << 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
-test parseExpr-10.8 {ParseShiftExpr procedure, error in RHS subexpression} testexprparser {
- list [catch {testexprparser {1+2 << 3 >> martha} -1} msg] $msg
-} {1 {syntax error in expression "1+2 << 3 >> martha": variable references require preceding $}}
+test parseExpr-10.8 {ParseShiftExpr procedure, error in RHS subexpression} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1+2 << 3 >> martha} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1+2 << 3 >> martha": * preceding $*}}
test parseExpr-11.1 {ParseAddExpr procedure, valid LHS multiply subexpr} testexprparser {
testexprparser {1*2 + 3} -1
} {- {} 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
-test parseExpr-11.2 {ParseAddExpr procedure, error in LHS multiply subexpr} testexprparser {
- list [catch {testexprparser {1/foo + 3} -1} msg] $msg
-} {1 {syntax error in expression "1/foo + 3": variable references require preceding $}}
+test parseExpr-11.2 {ParseAddExpr procedure, error in LHS multiply subexpr} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1/foo + 3} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1/foo + 3": * preceding $*}}
test parseExpr-11.3 {ParseAddExpr procedure, next lexeme isn't "+" or "-"} testexprparser {
testexprparser {1*2? 1 : 0} -1
} {- {} 0 subexpr {1*2? 1 : 0} 11 operator ? 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
@@ -288,16 +388,20 @@ test parseExpr-11.6 {ParseAddExpr procedure, bad lexeme after "+" or "-"} {teste
test parseExpr-11.7 {ParseAddExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1*2 + 3 + 4} -1
} {- {} 0 subexpr {1*2 + 3 + 4} 13 operator + 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
-test parseExpr-11.8 {ParseAddExpr procedure, error in RHS subexpression} testexprparser {
- list [catch {testexprparser {1*2 + 3 - martha} -1} msg] $msg
-} {1 {syntax error in expression "1*2 + 3 - martha": variable references require preceding $}}
+test parseExpr-11.8 {ParseAddExpr procedure, error in RHS subexpression} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1*2 + 3 - martha} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1*2 + 3 - martha": * preceding $*}}
test parseExpr-12.1 {ParseAddExpr procedure, valid LHS multiply subexpr} testexprparser {
testexprparser {1*2 + 3} -1
} {- {} 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
-test parseExpr-12.2 {ParseAddExpr procedure, error in LHS multiply subexpr} testexprparser {
- list [catch {testexprparser {1/foo + 3} -1} msg] $msg
-} {1 {syntax error in expression "1/foo + 3": variable references require preceding $}}
+test parseExpr-12.2 {ParseAddExpr procedure, error in LHS multiply subexpr} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1/foo + 3} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1/foo + 3": * preceding $*}}
test parseExpr-12.3 {ParseAddExpr procedure, next lexeme isn't "+" or "-"} testexprparser {
testexprparser {1*2? 1 : 0} -1
} {- {} 0 subexpr {1*2? 1 : 0} 11 operator ? 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}}
@@ -313,9 +417,11 @@ test parseExpr-12.6 {ParseAddExpr procedure, bad lexeme after "+" or "-"} {teste
test parseExpr-12.7 {ParseAddExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {1*2 + 3 + 4} -1
} {- {} 0 subexpr {1*2 + 3 + 4} 13 operator + 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
-test parseExpr-12.8 {ParseAddExpr procedure, error in RHS subexpression} testexprparser {
- list [catch {testexprparser {1*2 + 3 - martha} -1} msg] $msg
-} {1 {syntax error in expression "1*2 + 3 - martha": variable references require preceding $}}
+test parseExpr-12.8 {ParseAddExpr procedure, error in RHS subexpression} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {1*2 + 3 - martha} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "1*2 + 3 - martha": * preceding $*}}
test parseExpr-13.1 {ParseMultiplyExpr procedure, valid LHS unary subexpr} testexprparser {
testexprparser {+2 * 3} -1
@@ -341,9 +447,11 @@ test parseExpr-13.7 {ParseMultiplyExpr procedure, bad lexeme after "*", "/", or
test parseExpr-13.8 {ParseMultiplyExpr procedure, valid RHS subexpression} testexprparser {
testexprparser {-2 / 3 % 4} -1
} {- {} 0 subexpr {-2 / 3 % 4} 11 operator % 0 subexpr {-2 / 3} 7 operator / 0 subexpr -2 3 operator - 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}}
-test parseExpr-13.9 {ParseMultiplyExpr procedure, error in RHS subexpression} testexprparser {
- list [catch {testexprparser {++2 / 3 * martha} -1} msg] $msg
-} {1 {syntax error in expression "++2 / 3 * martha": variable references require preceding $}}
+test parseExpr-13.9 {ParseMultiplyExpr procedure, error in RHS subexpression} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {++2 / 3 * martha} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "++2 / 3 * martha": * preceding $*}}
test parseExpr-14.1 {ParseUnaryExpr procedure, first token is unary operator} testexprparser {
testexprparser {+2} -1
@@ -452,9 +560,11 @@ test parseExpr-15.22 {ParsePrimaryExpr procedure, primary is function call} test
test parseExpr-15.23 {ParsePrimaryExpr procedure, bad lexeme after function name} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {foo 12345678901234567890 123)} -1} msg] $msg
} {1 {integer value too large to represent}}
-test parseExpr-15.24 {ParsePrimaryExpr procedure, lexeme after function name isn't "("} testexprparser {
- list [catch {testexprparser {foo 27.4 123)} -1} msg] $msg
-} {1 {syntax error in expression "foo 27.4 123)": variable references require preceding $}}
+test parseExpr-15.24 {ParsePrimaryExpr procedure, lexeme after function name isn't "("} \
+ -constraints testexprparser -body {
+ list [catch {testexprparser {foo 27.4 123)} -1} msg] $msg
+ } -match glob \
+ -result {1 {syntax error in expression "foo 27.4 123)": * preceding $*}}
test parseExpr-15.25 {ParsePrimaryExpr procedure, bad lexeme after "("} {testexprparser wideIntegerUnparsed} {
list [catch {testexprparser {foo(12345678901234567890)} -1} msg] $msg
} {1 {integer value too large to represent}}
@@ -525,9 +635,12 @@ test parseExpr-16.9 {GetLexeme procedure, double lexeme} {testexprparser nonPort
test parseExpr-16.10 {GetLexeme procedure, double lexeme} {testexprparser nonPortable unix} {
testexprparser {NaN} -1
} {- {} 0 subexpr NaN 1 text NaN 0 {}}
-test parseExpr-16.11 {GetLexeme procedure, bad double lexeme too big} testexprparser {
+test parseExpr-16.11a {GetLexeme procedure, bad double lexeme too big} {testexprparser && !ieeeFloatingPoint} {
list [catch {testexprparser {123.e+99999999999999} -1} msg] $msg
} {1 {floating-point value too large to represent}}
+test parseExpr-16.11b {GetLexeme procedure, bad double lexeme too big} {testexprparser && ieeeFloatingPoint} {
+ list [catch {testexprparser {123.e+99999999999999} -1} msg] $msg
+} {0 {- {} 0 subexpr 123.e+99999999999999 1 text 123.e+99999999999999 0 {}}}
test parseExpr-16.12 {GetLexeme procedure, bad double lexeme} testexprparser {
list [catch {testexprparser {123.4x56} -1} msg] $msg
} {1 {syntax error in expression "123.4x56": extra tokens at end of expression}}