1 | # This file contains a collection of tests for the procedures in the |
---|
2 | # file tclCompExpr.c. Sourcing this file into Tcl runs the tests and |
---|
3 | # generates output for errors. No output means no errors were found. |
---|
4 | # |
---|
5 | # Copyright (c) 1997 Sun Microsystems, Inc. |
---|
6 | # Copyright (c) 1998-1999 by Scriptics Corporation. |
---|
7 | # |
---|
8 | # See the file "license.terms" for information on usage and redistribution |
---|
9 | # of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
10 | # |
---|
11 | # RCS: @(#) $Id: parseExpr.test,v 1.29 2007/12/13 15:26:07 dgp Exp $ |
---|
12 | |
---|
13 | if {[lsearch [namespace children] ::tcltest] == -1} { |
---|
14 | package require tcltest 2 |
---|
15 | namespace import -force ::tcltest::* |
---|
16 | } |
---|
17 | |
---|
18 | # Note that the Tcl expression parser (tclCompExpr.c) does not check |
---|
19 | # the semantic validity of the expressions it parses. It does not check, |
---|
20 | # for example, that a math function actually exists, or that the operands |
---|
21 | # of "<<" are integers. |
---|
22 | |
---|
23 | testConstraint testexprparser [llength [info commands testexprparser]] |
---|
24 | |
---|
25 | # Big test for correct ordering of data in [expr] |
---|
26 | |
---|
27 | proc testIEEE {} { |
---|
28 | variable ieeeValues |
---|
29 | binary scan [binary format dd -1.0 1.0] c* c |
---|
30 | switch -exact -- $c { |
---|
31 | {0 0 0 0 0 0 -16 -65 0 0 0 0 0 0 -16 63} { |
---|
32 | # little endian |
---|
33 | binary scan \x00\x00\x00\x00\x00\x00\xf0\xff d \ |
---|
34 | ieeeValues(-Infinity) |
---|
35 | binary scan \x00\x00\x00\x00\x00\x00\xf0\xbf d \ |
---|
36 | ieeeValues(-Normal) |
---|
37 | binary scan \x00\x00\x00\x00\x00\x00\x08\x80 d \ |
---|
38 | ieeeValues(-Subnormal) |
---|
39 | binary scan \x00\x00\x00\x00\x00\x00\x00\x80 d \ |
---|
40 | ieeeValues(-0) |
---|
41 | binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \ |
---|
42 | ieeeValues(+0) |
---|
43 | binary scan \x00\x00\x00\x00\x00\x00\x08\x00 d \ |
---|
44 | ieeeValues(+Subnormal) |
---|
45 | binary scan \x00\x00\x00\x00\x00\x00\xf0\x3f d \ |
---|
46 | ieeeValues(+Normal) |
---|
47 | binary scan \x00\x00\x00\x00\x00\x00\xf0\x7f d \ |
---|
48 | ieeeValues(+Infinity) |
---|
49 | binary scan \x00\x00\x00\x00\x00\x00\xf8\x7f d \ |
---|
50 | ieeeValues(NaN) |
---|
51 | set ieeeValues(littleEndian) 1 |
---|
52 | return 1 |
---|
53 | } |
---|
54 | {-65 -16 0 0 0 0 0 0 63 -16 0 0 0 0 0 0} { |
---|
55 | binary scan \xff\xf0\x00\x00\x00\x00\x00\x00 d \ |
---|
56 | ieeeValues(-Infinity) |
---|
57 | binary scan \xbf\xf0\x00\x00\x00\x00\x00\x00 d \ |
---|
58 | ieeeValues(-Normal) |
---|
59 | binary scan \x80\x08\x00\x00\x00\x00\x00\x00 d \ |
---|
60 | ieeeValues(-Subnormal) |
---|
61 | binary scan \x80\x00\x00\x00\x00\x00\x00\x00 d \ |
---|
62 | ieeeValues(-0) |
---|
63 | binary scan \x00\x00\x00\x00\x00\x00\x00\x00 d \ |
---|
64 | ieeeValues(+0) |
---|
65 | binary scan \x00\x08\x00\x00\x00\x00\x00\x00 d \ |
---|
66 | ieeeValues(+Subnormal) |
---|
67 | binary scan \x3f\xf0\x00\x00\x00\x00\x00\x00 d \ |
---|
68 | ieeeValues(+Normal) |
---|
69 | binary scan \x7f\xf0\x00\x00\x00\x00\x00\x00 d \ |
---|
70 | ieeeValues(+Infinity) |
---|
71 | binary scan \x7f\xf8\x00\x00\x00\x00\x00\x00 d \ |
---|
72 | ieeeValues(NaN) |
---|
73 | set ieeeValues(littleEndian) 0 |
---|
74 | return 1 |
---|
75 | } |
---|
76 | default { |
---|
77 | return 0 |
---|
78 | } |
---|
79 | } |
---|
80 | } |
---|
81 | testConstraint ieeeFloatingPoint [testIEEE] |
---|
82 | |
---|
83 | ###################################################################### |
---|
84 | |
---|
85 | test parseExpr-1.1 {Tcl_ParseExpr procedure, computing string length} testexprparser { |
---|
86 | testexprparser [bytestring "1+2\0 +3"] -1 |
---|
87 | } {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}} |
---|
88 | test parseExpr-1.2 {Tcl_ParseExpr procedure, computing string length} testexprparser { |
---|
89 | testexprparser "1 + 2" -1 |
---|
90 | } {- {} 0 subexpr {1 + 2} 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}} |
---|
91 | test parseExpr-1.3 {Tcl_ParseExpr procedure, error getting initial lexeme} testexprparser { |
---|
92 | testexprparser 12345678901234567890 -1 |
---|
93 | } {- {} 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}} |
---|
94 | test parseExpr-1.4 {Tcl_ParseExpr procedure, error in conditional expression} \ |
---|
95 | -constraints testexprparser -body { |
---|
96 | testexprparser {foo+} -1 |
---|
97 | } -match glob -returnCodes error -result * |
---|
98 | test parseExpr-1.5 {Tcl_ParseExpr procedure, lexemes after the expression} -constraints testexprparser -body { |
---|
99 | testexprparser {1+2 345} -1 |
---|
100 | } -returnCodes error -match glob -result * |
---|
101 | |
---|
102 | test parseExpr-2.1 {ParseCondExpr procedure, valid test subexpr} testexprparser { |
---|
103 | testexprparser {2>3? 1 : 0} -1 |
---|
104 | } {- {} 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 {}} |
---|
105 | test parseExpr-2.2 {ParseCondExpr procedure, error in test subexpr} \ |
---|
106 | -constraints testexprparser -body { |
---|
107 | testexprparser {0 || foo} -1 |
---|
108 | } -match glob -returnCodes error -result * |
---|
109 | test parseExpr-2.3 {ParseCondExpr procedure, next lexeme isn't "?"} testexprparser { |
---|
110 | testexprparser {1+2} -1 |
---|
111 | } {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}} |
---|
112 | test parseExpr-2.4 {ParseCondExpr procedure, next lexeme is "?"} testexprparser { |
---|
113 | testexprparser {1+2 ? 3 : 4} -1 |
---|
114 | } {- {} 0 subexpr {1+2 ? 3 : 4} 11 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 {}} |
---|
115 | test parseExpr-2.5 {ParseCondExpr procedure, bad lexeme after "?"} testexprparser { |
---|
116 | testexprparser {1+2 ? 12345678901234567890 : 0} -1 |
---|
117 | } {- {} 0 subexpr {1+2 ? 12345678901234567890 : 0} 11 operator ? 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 subexpr 0 1 text 0 0 {}} |
---|
118 | test parseExpr-2.6 {ParseCondExpr procedure, valid "then" subexpression} testexprparser { |
---|
119 | testexprparser {1? 3 : 4} -1 |
---|
120 | } {- {} 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 {}} |
---|
121 | test parseExpr-2.7 {ParseCondExpr procedure, error in "then" subexpression} \ |
---|
122 | -constraints testexprparser -body { |
---|
123 | testexprparser {1? fred : martha} -1 |
---|
124 | } -match glob -returnCodes error -result * |
---|
125 | test parseExpr-2.8 {ParseCondExpr procedure, lexeme after "then" subexpr isn't ":"} -constraints testexprparser -body { |
---|
126 | testexprparser {1? 2 martha 3} -1 |
---|
127 | } -returnCodes error -match glob -result * |
---|
128 | test parseExpr-2.9 {ParseCondExpr procedure, valid "else" subexpression} testexprparser { |
---|
129 | testexprparser {27||3? 3 : 4&&9} -1 |
---|
130 | } {- {} 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 {}} |
---|
131 | test parseExpr-2.10 {ParseCondExpr procedure, error in "else" subexpression} \ |
---|
132 | -constraints testexprparser -body { |
---|
133 | testexprparser {1? 2 : martha} -1 |
---|
134 | } -match glob -returnCodes error -result * |
---|
135 | |
---|
136 | test parseExpr-3.1 {ParseLorExpr procedure, valid logical and subexpr} testexprparser { |
---|
137 | testexprparser {1&&2 || 3} -1 |
---|
138 | } {- {} 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 {}} |
---|
139 | test parseExpr-3.2 {ParseLorExpr procedure, error in logical and subexpr} \ |
---|
140 | -constraints testexprparser -body { |
---|
141 | testexprparser {1&&foo || 3} -1 |
---|
142 | } -match glob -returnCodes error -result * |
---|
143 | test parseExpr-3.3 {ParseLorExpr procedure, next lexeme isn't "||"} testexprparser { |
---|
144 | testexprparser {1&&2? 1 : 0} -1 |
---|
145 | } {- {} 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 {}} |
---|
146 | test parseExpr-3.4 {ParseLorExpr procedure, next lexeme is "||"} testexprparser { |
---|
147 | testexprparser {1&&2 || 3} -1 |
---|
148 | } {- {} 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 {}} |
---|
149 | test parseExpr-3.5 {ParseLorExpr procedure, bad lexeme after "||"} testexprparser { |
---|
150 | testexprparser {1&&2 || 12345678901234567890} -1 |
---|
151 | } {- {} 0 subexpr {1&&2 || 12345678901234567890} 9 operator || 0 subexpr 1&&2 5 operator && 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}} |
---|
152 | test parseExpr-3.6 {ParseLorExpr procedure, valid RHS subexpression} testexprparser { |
---|
153 | testexprparser {1&&2 || 3 || 4} -1 |
---|
154 | } {- {} 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 {}} |
---|
155 | test parseExpr-3.7 {ParseLorExpr procedure, error in RHS subexpression} \ |
---|
156 | -constraints testexprparser -body { |
---|
157 | testexprparser {1&&2 || 3 || martha} -1 |
---|
158 | } -match glob -returnCodes error -result * |
---|
159 | |
---|
160 | test parseExpr-4.1 {ParseLandExpr procedure, valid LHS "|" subexpr} testexprparser { |
---|
161 | testexprparser {1|2 && 3} -1 |
---|
162 | } {- {} 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 {}} |
---|
163 | test parseExpr-4.2 {ParseLandExpr procedure, error in LHS "|" subexpr} \ |
---|
164 | -constraints testexprparser -body { |
---|
165 | testexprparser {1&&foo && 3} -1 |
---|
166 | } -match glob -returnCodes error -result * |
---|
167 | test parseExpr-4.3 {ParseLandExpr procedure, next lexeme isn't "&&"} testexprparser { |
---|
168 | testexprparser {1|2? 1 : 0} -1 |
---|
169 | } {- {} 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 {}} |
---|
170 | test parseExpr-4.4 {ParseLandExpr procedure, next lexeme is "&&"} testexprparser { |
---|
171 | testexprparser {1|2 && 3} -1 |
---|
172 | } {- {} 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 {}} |
---|
173 | test parseExpr-4.5 {ParseLandExpr procedure, bad lexeme after "&&"} testexprparser { |
---|
174 | testexprparser {1|2 && 12345678901234567890} -1 |
---|
175 | } {- {} 0 subexpr {1|2 && 12345678901234567890} 9 operator && 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}} |
---|
176 | test parseExpr-4.6 {ParseLandExpr procedure, valid RHS subexpression} testexprparser { |
---|
177 | testexprparser {1|2 && 3 && 4} -1 |
---|
178 | } {- {} 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 {}} |
---|
179 | test parseExpr-4.7 {ParseLandExpr procedure, error in RHS subexpression} \ |
---|
180 | -constraints testexprparser -body { |
---|
181 | testexprparser {1|2 && 3 && martha} -1 |
---|
182 | } -match glob -returnCodes error -result * |
---|
183 | |
---|
184 | test parseExpr-5.1 {ParseBitOrExpr procedure, valid LHS "^" subexpr} testexprparser { |
---|
185 | testexprparser {1^2 | 3} -1 |
---|
186 | } {- {} 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 {}} |
---|
187 | test parseExpr-5.2 {ParseBitOrExpr procedure, error in LHS "^" subexpr} \ |
---|
188 | -constraints testexprparser -body { |
---|
189 | testexprparser {1|foo | 3} -1 |
---|
190 | } -match glob -returnCodes error -result * |
---|
191 | test parseExpr-5.3 {ParseBitOrExpr procedure, next lexeme isn't "|"} testexprparser { |
---|
192 | testexprparser {1^2? 1 : 0} -1 |
---|
193 | } {- {} 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 {}} |
---|
194 | test parseExpr-5.4 {ParseBitOrExpr procedure, next lexeme is "|"} testexprparser { |
---|
195 | testexprparser {1^2 | 3} -1 |
---|
196 | } {- {} 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 {}} |
---|
197 | test parseExpr-5.5 {ParseBitOrExpr procedure, bad lexeme after "|"} testexprparser { |
---|
198 | testexprparser {1^2 | 12345678901234567890} -1 |
---|
199 | } {- {} 0 subexpr {1^2 | 12345678901234567890} 9 operator | 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}} |
---|
200 | test parseExpr-5.6 {ParseBitOrExpr procedure, valid RHS subexpression} testexprparser { |
---|
201 | testexprparser {1^2 | 3 | 4} -1 |
---|
202 | } {- {} 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 {}} |
---|
203 | test parseExpr-5.7 {ParseBitOrExpr procedure, error in RHS subexpression} \ |
---|
204 | -constraints testexprparser -body { |
---|
205 | testexprparser {1^2 | 3 | martha} -1 |
---|
206 | } -match glob -returnCodes error -result * |
---|
207 | |
---|
208 | test parseExpr-6.1 {ParseBitXorExpr procedure, valid LHS "&" subexpr} testexprparser { |
---|
209 | testexprparser {1&2 ^ 3} -1 |
---|
210 | } {- {} 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 {}} |
---|
211 | test parseExpr-6.2 {ParseBitXorExpr procedure, error in LHS "&" subexpr} \ |
---|
212 | -constraints testexprparser -body { |
---|
213 | testexprparser {1^foo ^ 3} -1 |
---|
214 | } -match glob -returnCodes error -result * |
---|
215 | test parseExpr-6.3 {ParseBitXorExpr procedure, next lexeme isn't "^"} testexprparser { |
---|
216 | testexprparser {1&2? 1 : 0} -1 |
---|
217 | } {- {} 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 {}} |
---|
218 | test parseExpr-6.4 {ParseBitXorExpr procedure, next lexeme is "^"} testexprparser { |
---|
219 | testexprparser {1&2 ^ 3} -1 |
---|
220 | } {- {} 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 {}} |
---|
221 | test parseExpr-6.5 {ParseBitXorExpr procedure, bad lexeme after "^"} testexprparser { |
---|
222 | testexprparser {1&2 ^ 12345678901234567890} -1 |
---|
223 | } {- {} 0 subexpr {1&2 ^ 12345678901234567890} 9 operator ^ 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}} |
---|
224 | test parseExpr-6.6 {ParseBitXorExpr procedure, valid RHS subexpression} testexprparser { |
---|
225 | testexprparser {1&2 ^ 3 ^ 4} -1 |
---|
226 | } {- {} 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 {}} |
---|
227 | test parseExpr-6.7 {ParseBitXorExpr procedure, error in RHS subexpression} \ |
---|
228 | -constraints testexprparser -body { |
---|
229 | testexprparser {1&2 ^ 3 ^ martha} -1 |
---|
230 | } -match glob -returnCodes error -result * |
---|
231 | |
---|
232 | test parseExpr-7.1 {ParseBitAndExpr procedure, valid LHS equality subexpr} testexprparser { |
---|
233 | testexprparser {1==2 & 3} -1 |
---|
234 | } {- {} 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 {}} |
---|
235 | test parseExpr-7.2 {ParseBitAndExpr procedure, error in LHS equality subexpr} \ |
---|
236 | -constraints testexprparser -body { |
---|
237 | testexprparser {1!=foo & 3} -1 |
---|
238 | } -match glob -returnCodes error -result * |
---|
239 | test parseExpr-7.3 {ParseBitAndExpr procedure, next lexeme isn't "&"} testexprparser { |
---|
240 | testexprparser {1==2? 1 : 0} -1 |
---|
241 | } {- {} 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 {}} |
---|
242 | test parseExpr-7.4 {ParseBitAndExpr procedure, next lexeme is "&"} testexprparser { |
---|
243 | testexprparser {1>2 & 3} -1 |
---|
244 | } {- {} 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 {}} |
---|
245 | test parseExpr-7.5 {ParseBitAndExpr procedure, bad lexeme after "&"} {testexprparser} { |
---|
246 | testexprparser {1==2 & 12345678901234567890} -1 |
---|
247 | } {- {} 0 subexpr {1==2 & 12345678901234567890} 9 operator & 0 subexpr 1==2 5 operator == 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}} |
---|
248 | test parseExpr-7.6 {ParseBitAndExpr procedure, valid RHS subexpression} testexprparser { |
---|
249 | testexprparser {1<2 & 3 & 4} -1 |
---|
250 | } {- {} 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 {}} |
---|
251 | test parseExpr-7.7 {ParseBitAndExpr procedure, error in RHS subexpression} \ |
---|
252 | -constraints testexprparser -body { |
---|
253 | testexprparser {1==2 & 3>2 & martha} -1 |
---|
254 | } -match glob -returnCodes error -result * |
---|
255 | |
---|
256 | test parseExpr-8.1 {ParseEqualityExpr procedure, valid LHS relational subexpr} testexprparser { |
---|
257 | testexprparser {1<2 == 3} -1 |
---|
258 | } {- {} 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 {}} |
---|
259 | test parseExpr-8.2 {ParseEqualityExpr procedure, error in LHS relational subexpr} \ |
---|
260 | -constraints testexprparser -body { |
---|
261 | testexprparser {1>=foo == 3} -1 |
---|
262 | } -match glob -returnCodes error -result * |
---|
263 | test parseExpr-8.3 {ParseEqualityExpr procedure, next lexeme isn't "==" or "!="} testexprparser { |
---|
264 | testexprparser {1<2? 1 : 0} -1 |
---|
265 | } {- {} 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 {}} |
---|
266 | test parseExpr-8.4 {ParseEqualityExpr procedure, next lexeme is "==" or "!="} testexprparser { |
---|
267 | testexprparser {1<2 == 3} -1 |
---|
268 | } {- {} 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 {}} |
---|
269 | test parseExpr-8.5 {ParseEqualityExpr procedure, next lexeme is "==" or "!="} testexprparser { |
---|
270 | testexprparser {1<2 != 3} -1 |
---|
271 | } {- {} 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 {}} |
---|
272 | test parseExpr-8.6 {ParseEqualityExpr procedure, bad lexeme after "==" or "!="} testexprparser { |
---|
273 | testexprparser {1<2 == 12345678901234567890} -1 |
---|
274 | } {- {} 0 subexpr {1<2 == 12345678901234567890} 9 operator == 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}} |
---|
275 | test parseExpr-8.7 {ParseEqualityExpr procedure, valid RHS subexpression} testexprparser { |
---|
276 | testexprparser {1<2 == 3 == 4} -1 |
---|
277 | } {- {} 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 {}} |
---|
278 | test parseExpr-8.8 {ParseEqualityExpr procedure, error in RHS subexpression} \ |
---|
279 | -constraints testexprparser -body { |
---|
280 | testexprparser {1<2 == 3 != martha} -1 |
---|
281 | } -match glob -returnCodes error -result * |
---|
282 | |
---|
283 | test parseExpr-9.1 {ParseRelationalExpr procedure, valid LHS shift subexpr} testexprparser { |
---|
284 | testexprparser {1<<2 < 3} -1 |
---|
285 | } {- {} 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 {}} |
---|
286 | test parseExpr-9.2 {ParseRelationalExpr procedure, error in LHS shift subexpr} \ |
---|
287 | -constraints testexprparser -body { |
---|
288 | testexprparser {1>=foo < 3} -1 |
---|
289 | } -match glob -returnCodes error -result * |
---|
290 | test parseExpr-9.3 {ParseRelationalExpr procedure, next lexeme isn't relational op} testexprparser { |
---|
291 | testexprparser {1<<2? 1 : 0} -1 |
---|
292 | } {- {} 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 {}} |
---|
293 | test parseExpr-9.4 {ParseRelationalExpr procedure, next lexeme is relational op} testexprparser { |
---|
294 | testexprparser {1<<2 < 3} -1 |
---|
295 | } {- {} 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 {}} |
---|
296 | test parseExpr-9.5 {ParseRelationalExpr procedure, next lexeme is relational op} testexprparser { |
---|
297 | testexprparser {1>>2 > 3} -1 |
---|
298 | } {- {} 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 {}} |
---|
299 | test parseExpr-9.6 {ParseRelationalExpr procedure, next lexeme is relational op} testexprparser { |
---|
300 | testexprparser {1<<2 <= 3} -1 |
---|
301 | } {- {} 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 {}} |
---|
302 | test parseExpr-9.7 {ParseRelationalExpr procedure, next lexeme is relational op} testexprparser { |
---|
303 | testexprparser {1<<2 >= 3} -1 |
---|
304 | } {- {} 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 {}} |
---|
305 | test parseExpr-9.8 {ParseRelationalExpr procedure, bad lexeme after relational op} testexprparser { |
---|
306 | testexprparser {1<<2 < 12345678901234567890} -1 |
---|
307 | } {- {} 0 subexpr {1<<2 < 12345678901234567890} 9 operator < 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}} |
---|
308 | test parseExpr-9.9 {ParseRelationalExpr procedure, valid RHS subexpression} testexprparser { |
---|
309 | testexprparser {1<<2 < 3 < 4} -1 |
---|
310 | } {- {} 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 {}} |
---|
311 | test parseExpr-9.10 {ParseRelationalExpr procedure, error in RHS subexpression} \ |
---|
312 | -constraints testexprparser -body { |
---|
313 | testexprparser {1<<2 < 3 > martha} -1 |
---|
314 | } -match glob -returnCodes error -result * |
---|
315 | |
---|
316 | test parseExpr-10.1 {ParseShiftExpr procedure, valid LHS add subexpr} testexprparser { |
---|
317 | testexprparser {1+2 << 3} -1 |
---|
318 | } {- {} 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 {}} |
---|
319 | test parseExpr-10.2 {ParseShiftExpr procedure, error in LHS add subexpr} \ |
---|
320 | -constraints testexprparser -body { |
---|
321 | testexprparser {1-foo << 3} -1 |
---|
322 | } -match glob -returnCodes error -result * |
---|
323 | test parseExpr-10.3 {ParseShiftExpr procedure, next lexeme isn't "<<" or ">>"} testexprparser { |
---|
324 | testexprparser {1+2? 1 : 0} -1 |
---|
325 | } {- {} 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 {}} |
---|
326 | test parseExpr-10.4 {ParseShiftExpr procedure, next lexeme is "<<" or ">>"} testexprparser { |
---|
327 | testexprparser {1+2 << 3} -1 |
---|
328 | } {- {} 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 {}} |
---|
329 | test parseExpr-10.5 {ParseShiftExpr procedure, next lexeme is "<<" or ">>"} testexprparser { |
---|
330 | testexprparser {1+2 >> 3} -1 |
---|
331 | } {- {} 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 {}} |
---|
332 | test parseExpr-10.6 {ParseShiftExpr procedure, bad lexeme after "<<" or ">>"} testexprparser { |
---|
333 | testexprparser {1+2 << 12345678901234567890} -1 |
---|
334 | } {- {} 0 subexpr {1+2 << 12345678901234567890} 9 operator << 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}} |
---|
335 | test parseExpr-10.7 {ParseShiftExpr procedure, valid RHS subexpression} testexprparser { |
---|
336 | testexprparser {1+2 << 3 << 4} -1 |
---|
337 | } {- {} 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 {}} |
---|
338 | test parseExpr-10.8 {ParseShiftExpr procedure, error in RHS subexpression} \ |
---|
339 | -constraints testexprparser -body { |
---|
340 | testexprparser {1+2 << 3 >> martha} -1 |
---|
341 | } -match glob -returnCodes error -result * |
---|
342 | |
---|
343 | test parseExpr-11.1 {ParseAddExpr procedure, valid LHS multiply subexpr} testexprparser { |
---|
344 | testexprparser {1*2 + 3} -1 |
---|
345 | } {- {} 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 {}} |
---|
346 | test parseExpr-11.2 {ParseAddExpr procedure, error in LHS multiply subexpr} \ |
---|
347 | -constraints testexprparser -body { |
---|
348 | testexprparser {1/foo + 3} -1 |
---|
349 | } -match glob -returnCodes error -result * |
---|
350 | test parseExpr-11.3 {ParseAddExpr procedure, next lexeme isn't "+" or "-"} testexprparser { |
---|
351 | testexprparser {1*2? 1 : 0} -1 |
---|
352 | } {- {} 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 {}} |
---|
353 | test parseExpr-11.4 {ParseAddExpr procedure, next lexeme is "+" or "-"} testexprparser { |
---|
354 | testexprparser {1*2 + 3} -1 |
---|
355 | } {- {} 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 {}} |
---|
356 | test parseExpr-11.5 {ParseAddExpr procedure, next lexeme is "+" or "-"} testexprparser { |
---|
357 | testexprparser {1*2 - 3} -1 |
---|
358 | } {- {} 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 {}} |
---|
359 | test parseExpr-11.6 {ParseAddExpr procedure, bad lexeme after "+" or "-"} testexprparser { |
---|
360 | testexprparser {1*2 + 12345678901234567890} -1 |
---|
361 | } {- {} 0 subexpr {1*2 + 12345678901234567890} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}} |
---|
362 | test parseExpr-11.7 {ParseAddExpr procedure, valid RHS subexpression} testexprparser { |
---|
363 | testexprparser {1*2 + 3 + 4} -1 |
---|
364 | } {- {} 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 {}} |
---|
365 | test parseExpr-11.8 {ParseAddExpr procedure, error in RHS subexpression} \ |
---|
366 | -constraints testexprparser -body { |
---|
367 | testexprparser {1*2 + 3 - martha} -1 |
---|
368 | } -match glob -returnCodes error -result * |
---|
369 | |
---|
370 | test parseExpr-12.1 {ParseAddExpr procedure, valid LHS multiply subexpr} testexprparser { |
---|
371 | testexprparser {1*2 + 3} -1 |
---|
372 | } {- {} 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 {}} |
---|
373 | test parseExpr-12.2 {ParseAddExpr procedure, error in LHS multiply subexpr} \ |
---|
374 | -constraints testexprparser -body { |
---|
375 | testexprparser {1/foo + 3} -1 |
---|
376 | } -match glob -returnCodes error -result * |
---|
377 | test parseExpr-12.3 {ParseAddExpr procedure, next lexeme isn't "+" or "-"} testexprparser { |
---|
378 | testexprparser {1*2? 1 : 0} -1 |
---|
379 | } {- {} 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 {}} |
---|
380 | test parseExpr-12.4 {ParseAddExpr procedure, next lexeme is "+" or "-"} testexprparser { |
---|
381 | testexprparser {1*2 + 3} -1 |
---|
382 | } {- {} 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 {}} |
---|
383 | test parseExpr-12.5 {ParseAddExpr procedure, next lexeme is "+" or "-"} testexprparser { |
---|
384 | testexprparser {1*2 - 3} -1 |
---|
385 | } {- {} 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 {}} |
---|
386 | test parseExpr-12.6 {ParseAddExpr procedure, bad lexeme after "+" or "-"} testexprparser { |
---|
387 | testexprparser {1*2 + 12345678901234567890} -1 |
---|
388 | } {- {} 0 subexpr {1*2 + 12345678901234567890} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}} |
---|
389 | test parseExpr-12.7 {ParseAddExpr procedure, valid RHS subexpression} testexprparser { |
---|
390 | testexprparser {1*2 + 3 + 4} -1 |
---|
391 | } {- {} 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 {}} |
---|
392 | test parseExpr-12.8 {ParseAddExpr procedure, error in RHS subexpression} \ |
---|
393 | -constraints testexprparser -body { |
---|
394 | testexprparser {1*2 + 3 - martha} -1 |
---|
395 | } -match glob -returnCodes error -result * |
---|
396 | |
---|
397 | test parseExpr-13.1 {ParseMultiplyExpr procedure, valid LHS unary subexpr} testexprparser { |
---|
398 | testexprparser {+2 * 3} -1 |
---|
399 | } {- {} 0 subexpr {+2 * 3} 7 operator * 0 subexpr +2 3 operator + 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} |
---|
400 | test parseExpr-13.2 {ParseMultiplyExpr procedure, error in LHS unary subexpr} testexprparser { |
---|
401 | testexprparser {-12345678901234567890 * 3} -1 |
---|
402 | } {- {} 0 subexpr {-12345678901234567890 * 3} 7 operator * 0 subexpr -12345678901234567890 3 operator - 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 subexpr 3 1 text 3 0 {}} |
---|
403 | test parseExpr-13.3 {ParseMultiplyExpr procedure, next lexeme isn't "*", "/", or "%"} testexprparser { |
---|
404 | testexprparser {+2? 1 : 0} -1 |
---|
405 | } {- {} 0 subexpr {+2? 1 : 0} 9 operator ? 0 subexpr +2 3 operator + 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}} |
---|
406 | test parseExpr-13.4 {ParseMultiplyExpr procedure, next lexeme is "*", "/", or "%"} testexprparser { |
---|
407 | testexprparser {-123 * 3} -1 |
---|
408 | } {- {} 0 subexpr {-123 * 3} 7 operator * 0 subexpr -123 3 operator - 0 subexpr 123 1 text 123 0 subexpr 3 1 text 3 0 {}} |
---|
409 | test parseExpr-13.5 {ParseMultiplyExpr procedure, next lexeme is "*", "/", or "%"} testexprparser { |
---|
410 | testexprparser {+-456 / 3} -1 |
---|
411 | } {- {} 0 subexpr {+-456 / 3} 9 operator / 0 subexpr +-456 5 operator + 0 subexpr -456 3 operator - 0 subexpr 456 1 text 456 0 subexpr 3 1 text 3 0 {}} |
---|
412 | test parseExpr-13.6 {ParseMultiplyExpr procedure, next lexeme is "*", "/", or "%"} testexprparser { |
---|
413 | testexprparser {+-456 % 3} -1 |
---|
414 | } {- {} 0 subexpr {+-456 % 3} 9 operator % 0 subexpr +-456 5 operator + 0 subexpr -456 3 operator - 0 subexpr 456 1 text 456 0 subexpr 3 1 text 3 0 {}} |
---|
415 | test parseExpr-13.7 {ParseMultiplyExpr procedure, bad lexeme after "*", "/", or "%"} testexprparser { |
---|
416 | testexprparser {--++5 / 12345678901234567890} -1 |
---|
417 | } {- {} 0 subexpr {--++5 / 12345678901234567890} 13 operator / 0 subexpr --++5 9 operator - 0 subexpr -++5 7 operator - 0 subexpr ++5 5 operator + 0 subexpr +5 3 operator + 0 subexpr 5 1 text 5 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}} |
---|
418 | test parseExpr-13.8 {ParseMultiplyExpr procedure, valid RHS subexpression} testexprparser { |
---|
419 | testexprparser {-2 / 3 % 4} -1 |
---|
420 | } {- {} 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 {}} |
---|
421 | test parseExpr-13.9 {ParseMultiplyExpr procedure, error in RHS subexpression} \ |
---|
422 | -constraints testexprparser -body { |
---|
423 | testexprparser {++2 / 3 * martha} -1 |
---|
424 | } -match glob -returnCodes error -result * |
---|
425 | |
---|
426 | test parseExpr-14.1 {ParseUnaryExpr procedure, first token is unary operator} testexprparser { |
---|
427 | testexprparser {+2} -1 |
---|
428 | } {- {} 0 subexpr +2 3 operator + 0 subexpr 2 1 text 2 0 {}} |
---|
429 | test parseExpr-14.2 {ParseUnaryExpr procedure, first token is unary operator} testexprparser { |
---|
430 | testexprparser {-2} -1 |
---|
431 | } {- {} 0 subexpr -2 3 operator - 0 subexpr 2 1 text 2 0 {}} |
---|
432 | test parseExpr-14.3 {ParseUnaryExpr procedure, first token is unary operator} testexprparser { |
---|
433 | testexprparser {~2} -1 |
---|
434 | } {- {} 0 subexpr ~2 3 operator ~ 0 subexpr 2 1 text 2 0 {}} |
---|
435 | test parseExpr-14.4 {ParseUnaryExpr procedure, first token is unary operator} testexprparser { |
---|
436 | testexprparser {!2} -1 |
---|
437 | } {- {} 0 subexpr !2 3 operator ! 0 subexpr 2 1 text 2 0 {}} |
---|
438 | test parseExpr-14.5 {ParseUnaryExpr procedure, error in lexeme after unary op} testexprparser { |
---|
439 | testexprparser {-12345678901234567890} -1 |
---|
440 | } {- {} 0 subexpr -12345678901234567890 3 operator - 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}} |
---|
441 | test parseExpr-14.6 {ParseUnaryExpr procedure, simple unary expr after unary op} testexprparser { |
---|
442 | testexprparser {+"1234"} -1 |
---|
443 | } {- {} 0 subexpr +\"1234\" 3 operator + 0 subexpr {"1234"} 1 text 1234 0 {}} |
---|
444 | test parseExpr-14.7 {ParseUnaryExpr procedure, another unary expr after unary op} testexprparser { |
---|
445 | testexprparser {~!{fred}} -1 |
---|
446 | } {- {} 0 subexpr ~!{fred} 5 operator ~ 0 subexpr !{fred} 3 operator ! 0 subexpr {{fred}} 1 text fred 0 {}} |
---|
447 | test parseExpr-14.8 {ParseUnaryExpr procedure, error in unary expr after unary op} -constraints testexprparser -body { |
---|
448 | testexprparser {+-||27} -1 |
---|
449 | } -returnCodes error -match glob -result * |
---|
450 | test parseExpr-14.9 {ParseUnaryExpr procedure, error in unary expr after unary op} -constraints testexprparser -body { |
---|
451 | testexprparser {+-||27} -1 |
---|
452 | } -returnCodes error -match glob -result * |
---|
453 | test parseExpr-14.10 {ParseUnaryExpr procedure, first token is not unary op} testexprparser { |
---|
454 | testexprparser {123} -1 |
---|
455 | } {- {} 0 subexpr 123 1 text 123 0 {}} |
---|
456 | test parseExpr-14.11 {ParseUnaryExpr procedure, not unary expr, complex primary expr} testexprparser { |
---|
457 | testexprparser {(1+2)} -1 |
---|
458 | } {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}} |
---|
459 | test parseExpr-14.12 {ParseUnaryExpr procedure, not unary expr, error in primary expr} testexprparser { |
---|
460 | testexprparser {(12345678901234567890)} -1 |
---|
461 | } {- {} 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}} |
---|
462 | |
---|
463 | test parseExpr-15.1 {ParsePrimaryExpr procedure, just parenthesized subexpr} testexprparser { |
---|
464 | testexprparser {({abc}/{def})} -1 |
---|
465 | } {- {} 0 subexpr {{abc}/{def}} 5 operator / 0 subexpr {{abc}} 1 text abc 0 subexpr {{def}} 1 text def 0 {}} |
---|
466 | test parseExpr-15.2 {ParsePrimaryExpr procedure, bad lexeme after "("} {testexprparser} { |
---|
467 | testexprparser {(12345678901234567890)} -1 |
---|
468 | } {- {} 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}} |
---|
469 | test parseExpr-15.3 {ParsePrimaryExpr procedure, valid parenthesized subexpr} testexprparser { |
---|
470 | testexprparser {({abc}? 2*4 : -6)} -1 |
---|
471 | } {- {} 0 subexpr {{abc}? 2*4 : -6} 13 operator ? 0 subexpr {{abc}} 1 text abc 0 subexpr 2*4 5 operator * 0 subexpr 2 1 text 2 0 subexpr 4 1 text 4 0 subexpr -6 3 operator - 0 subexpr 6 1 text 6 0 {}} |
---|
472 | test parseExpr-15.4 {ParsePrimaryExpr procedure, error in parenthesized subexpr} -constraints testexprparser -body { |
---|
473 | testexprparser {(? 123 : 456)} -1 |
---|
474 | } -returnCodes error -match glob -result * |
---|
475 | test parseExpr-15.5 {ParsePrimaryExpr procedure, missing ")" after in parenthesized subexpr} -constraints testexprparser -body { |
---|
476 | testexprparser {({abc}/{def}} -1 |
---|
477 | } -returnCodes error -match glob -result * |
---|
478 | test parseExpr-15.6 {ParsePrimaryExpr procedure, primary is literal} testexprparser { |
---|
479 | testexprparser {12345} -1 |
---|
480 | } {- {} 0 subexpr 12345 1 text 12345 0 {}} |
---|
481 | test parseExpr-15.7 {ParsePrimaryExpr procedure, primary is literal} testexprparser { |
---|
482 | testexprparser {12345.6789} -1 |
---|
483 | } {- {} 0 subexpr 12345.6789 1 text 12345.6789 0 {}} |
---|
484 | test parseExpr-15.8 {ParsePrimaryExpr procedure, primary is var reference} testexprparser { |
---|
485 | testexprparser {$a} -1 |
---|
486 | } {- {} 0 subexpr {$a} 2 variable {$a} 1 text a 0 {}} |
---|
487 | test parseExpr-15.9 {ParsePrimaryExpr procedure, primary is var reference} testexprparser { |
---|
488 | testexprparser {$a(hello$there)} -1 |
---|
489 | } {- {} 0 subexpr {$a(hello$there)} 5 variable {$a(hello$there)} 4 text a 0 text hello 0 variable {$there} 1 text there 0 {}} |
---|
490 | test parseExpr-15.10 {ParsePrimaryExpr procedure, primary is var reference} testexprparser { |
---|
491 | testexprparser {$a()} -1 |
---|
492 | } {- {} 0 subexpr {$a()} 3 variable {$a()} 2 text a 0 text {} 0 {}} |
---|
493 | test parseExpr-15.11 {ParsePrimaryExpr procedure, error in var reference} -constraints testexprparser -body { |
---|
494 | testexprparser {$a(} -1 |
---|
495 | } -returnCodes error -match glob -result * |
---|
496 | test parseExpr-15.12 {ParsePrimaryExpr procedure, primary is quoted string} testexprparser { |
---|
497 | testexprparser {"abc $xyz def"} -1 |
---|
498 | } {- {} 0 subexpr {"abc $xyz def"} 5 word {"abc $xyz def"} 4 text {abc } 0 variable {$xyz} 1 text xyz 0 text { def} 0 {}} |
---|
499 | test parseExpr-15.13 {ParsePrimaryExpr procedure, error in quoted string} -constraints testexprparser -body { |
---|
500 | testexprparser {"$a(12"} -1 |
---|
501 | } -returnCodes error -match glob -result * |
---|
502 | test parseExpr-15.14 {ParsePrimaryExpr procedure, quoted string has multiple tokens} testexprparser { |
---|
503 | testexprparser {"abc [xyz] $def"} -1 |
---|
504 | } {- {} 0 subexpr {"abc [xyz] $def"} 6 word {"abc [xyz] $def"} 5 text {abc } 0 command {[xyz]} 0 text { } 0 variable {$def} 1 text def 0 {}} |
---|
505 | test parseExpr-15.15 {ParsePrimaryExpr procedure, primary is command} testexprparser { |
---|
506 | testexprparser {[def]} -1 |
---|
507 | } {- {} 0 subexpr {[def]} 1 command {[def]} 0 {}} |
---|
508 | test parseExpr-15.16 {ParsePrimaryExpr procedure, primary is multiple commands} testexprparser { |
---|
509 | testexprparser {[one; two; three; four;]} -1 |
---|
510 | } {- {} 0 subexpr {[one; two; three; four;]} 1 command {[one; two; three; four;]} 0 {}} |
---|
511 | test parseExpr-15.17 {ParsePrimaryExpr procedure, primary is multiple commands} testexprparser { |
---|
512 | testexprparser {[one; two; three; four;]} -1 |
---|
513 | } {- {} 0 subexpr {[one; two; three; four;]} 1 command {[one; two; three; four;]} 0 {}} |
---|
514 | test parseExpr-15.18 {ParsePrimaryExpr procedure, missing close bracket} -constraints testexprparser -body { |
---|
515 | testexprparser {[one} -1 |
---|
516 | } -returnCodes error -match glob -result * |
---|
517 | test parseExpr-15.19 {ParsePrimaryExpr procedure, primary is braced string} testexprparser { |
---|
518 | testexprparser {{hello world}} -1 |
---|
519 | } {- {} 0 subexpr {{hello world}} 1 text {hello world} 0 {}} |
---|
520 | test parseExpr-15.20 {ParsePrimaryExpr procedure, error in primary, which is braced string} -constraints testexprparser -body { |
---|
521 | testexprparser "\{abc\\\n" -1 |
---|
522 | } -returnCodes error -match glob -result * |
---|
523 | test parseExpr-15.21 {ParsePrimaryExpr procedure, primary is braced string with multiple tokens} testexprparser { |
---|
524 | testexprparser "\{ \\ |
---|
525 | +123 \}" -1 |
---|
526 | } {- {} 0 subexpr \{\ \ \\\n\ +123\ \} 4 word \{\ \ \\\n\ +123\ \} 3 text { } 0 backslash \\\n\ 0 text {+123 } 0 {}} |
---|
527 | test parseExpr-15.22 {ParsePrimaryExpr procedure, primary is function call} testexprparser { |
---|
528 | testexprparser {foo(123)} -1 |
---|
529 | } {- {} 0 subexpr foo(123) 3 operator foo 0 subexpr 123 1 text 123 0 {}} |
---|
530 | test parseExpr-15.23 {ParsePrimaryExpr procedure, bad lexeme after function name} -constraints testexprparser -body { |
---|
531 | testexprparser {foo 12345678901234567890 123)} -1 |
---|
532 | } -returnCodes error -match glob -result * |
---|
533 | test parseExpr-15.24 {ParsePrimaryExpr procedure, lexeme after function name isn't "("} \ |
---|
534 | -constraints testexprparser -body { |
---|
535 | testexprparser {foo 27.4 123)} -1 |
---|
536 | } -match glob -returnCodes error -result * |
---|
537 | test parseExpr-15.25 {ParsePrimaryExpr procedure, bad lexeme after "("} testexprparser { |
---|
538 | testexprparser {foo(12345678901234567890)} -1 |
---|
539 | } {- {} 0 subexpr foo(12345678901234567890) 3 operator foo 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}} |
---|
540 | test parseExpr-15.26 {ParsePrimaryExpr procedure, function call, one arg} testexprparser { |
---|
541 | testexprparser {foo(27*4)} -1 |
---|
542 | } {- {} 0 subexpr foo(27*4) 7 operator foo 0 subexpr 27*4 5 operator * 0 subexpr 27 1 text 27 0 subexpr 4 1 text 4 0 {}} |
---|
543 | test parseExpr-15.27 {ParsePrimaryExpr procedure, error in function arg} -constraints testexprparser -body { |
---|
544 | testexprparser {foo(*1-2)} -1 |
---|
545 | } -returnCodes error -match glob -result * |
---|
546 | test parseExpr-15.28 {ParsePrimaryExpr procedure, error in function arg} -constraints testexprparser -body { |
---|
547 | testexprparser {foo(*1-2)} -1 |
---|
548 | } -returnCodes error -match glob -result * |
---|
549 | test parseExpr-15.29 {ParsePrimaryExpr procedure, function call, comma after arg} testexprparser { |
---|
550 | testexprparser {foo(27-2, (-2*[foo]))} -1 |
---|
551 | } {- {} 0 subexpr {foo(27-2, (-2*[foo]))} 15 operator foo 0 subexpr 27-2 5 operator - 0 subexpr 27 1 text 27 0 subexpr 2 1 text 2 0 subexpr {-2*[foo]} 7 operator * 0 subexpr -2 3 operator - 0 subexpr 2 1 text 2 0 subexpr {[foo]} 1 command {[foo]} 0 {}} |
---|
552 | test parseExpr-15.30 {ParsePrimaryExpr procedure, bad lexeme after comma} testexprparser { |
---|
553 | testexprparser {foo(123, 12345678901234567890)} -1 |
---|
554 | } {- {} 0 subexpr {foo(123, 12345678901234567890)} 5 operator foo 0 subexpr 123 1 text 123 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}} |
---|
555 | test parseExpr-15.31 {ParsePrimaryExpr procedure, lexeme not "," or ")" after arg} -constraints testexprparser -body { |
---|
556 | testexprparser {foo(123 [foo])} -1 |
---|
557 | } -returnCodes error -match glob -result * |
---|
558 | test parseExpr-15.32 {ParsePrimaryExpr procedure, bad lexeme after primary} -constraints testexprparser -body { |
---|
559 | testexprparser {123 12345678901234567890} -1 |
---|
560 | } -returnCodes error -match glob -result * |
---|
561 | test parseExpr-15.33 {ParsePrimaryExpr procedure, comma-specific message} -constraints testexprparser -body { |
---|
562 | testexprparser {123+,456} -1 |
---|
563 | } -returnCodes error -match glob -result * |
---|
564 | test parseExpr-15.34 {ParsePrimaryExpr procedure, single equal-specific message} -constraints testexprparser -body { |
---|
565 | testexprparser {123+=456} -1 |
---|
566 | } -returnCodes error -match glob -result * |
---|
567 | test parseExpr-15.35 {ParsePrimaryExpr procedure, error in parenthesized subexpr} -constraints testexprparser -body { |
---|
568 | testexprparser {(: 123 : 456)} -1 |
---|
569 | } -returnCodes error -match glob -result * |
---|
570 | test parseExpr-15.36 {ParsePrimaryExpr procedure, missing close-bracket} -constraints testexprparser -body { |
---|
571 | # Test for Bug 681841 |
---|
572 | testexprparser {[set a [format bc]} -1 |
---|
573 | } -returnCodes error -match glob -result * |
---|
574 | |
---|
575 | test parseExpr-16.1 {GetLexeme procedure, whitespace before lexeme} testexprparser { |
---|
576 | testexprparser { 123} -1 |
---|
577 | } {- {} 0 subexpr 123 1 text 123 0 {}} |
---|
578 | test parseExpr-16.2 {GetLexeme procedure, whitespace before lexeme} testexprparser { |
---|
579 | testexprparser { \ |
---|
580 | 456} -1 |
---|
581 | } {- {} 0 subexpr 456 1 text 456 0 {}} |
---|
582 | test parseExpr-16.3 {GetLexeme procedure, no lexeme after whitespace} testexprparser { |
---|
583 | testexprparser { 123 \ |
---|
584 | } -1 |
---|
585 | } {- {} 0 subexpr 123 1 text 123 0 {}} |
---|
586 | test parseExpr-16.4 {GetLexeme procedure, integer lexeme} testexprparser { |
---|
587 | testexprparser {000} -1 |
---|
588 | } {- {} 0 subexpr 000 1 text 000 0 {}} |
---|
589 | test parseExpr-16.5 {GetLexeme procedure, integer lexeme too big} testexprparser { |
---|
590 | testexprparser {12345678901234567890} -1 |
---|
591 | } {- {} 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}} |
---|
592 | test parseExpr-16.6 {GetLexeme procedure, bad integer lexeme} -constraints testexprparser -body { |
---|
593 | testexprparser {0o999} -1 |
---|
594 | } -returnCodes error -match glob -result {*invalid octal number*} |
---|
595 | test parseExpr-16.7 {GetLexeme procedure, double lexeme} testexprparser { |
---|
596 | testexprparser {0.999} -1 |
---|
597 | } {- {} 0 subexpr 0.999 1 text 0.999 0 {}} |
---|
598 | test parseExpr-16.8 {GetLexeme procedure, double lexeme} testexprparser { |
---|
599 | testexprparser {.123} -1 |
---|
600 | } {- {} 0 subexpr .123 1 text .123 0 {}} |
---|
601 | test parseExpr-16.9 {GetLexeme procedure, double lexeme} {testexprparser unix} { |
---|
602 | testexprparser {nan} -1 |
---|
603 | } {- {} 0 subexpr nan 1 text nan 0 {}} |
---|
604 | test parseExpr-16.10 {GetLexeme procedure, double lexeme} {testexprparser unix} { |
---|
605 | testexprparser {NaN} -1 |
---|
606 | } {- {} 0 subexpr NaN 1 text NaN 0 {}} |
---|
607 | test parseExpr-16.11a {GetLexeme procedure, bad double lexeme too big} {testexprparser && !ieeeFloatingPoint} { |
---|
608 | list [catch {testexprparser {123.e+99999999999999} -1} msg] $msg |
---|
609 | } {1 {floating-point value too large to represent}} |
---|
610 | test parseExpr-16.11b {GetLexeme procedure, bad double lexeme too big} {testexprparser && ieeeFloatingPoint} { |
---|
611 | list [catch {testexprparser {123.e+99999999999999} -1} msg] $msg |
---|
612 | } {0 {- {} 0 subexpr 123.e+99999999999999 1 text 123.e+99999999999999 0 {}}} |
---|
613 | test parseExpr-16.12 {GetLexeme procedure, bad double lexeme} -constraints testexprparser -body { |
---|
614 | testexprparser {123.4x56} -1 |
---|
615 | } -returnCodes error -match glob -result * |
---|
616 | test parseExpr-16.13 {GetLexeme procedure, lexeme is "["} testexprparser { |
---|
617 | testexprparser {[foo]} -1 |
---|
618 | } {- {} 0 subexpr {[foo]} 1 command {[foo]} 0 {}} |
---|
619 | test parseExpr-16.14 {GetLexeme procedure, lexeme is open brace} testexprparser { |
---|
620 | testexprparser {{bar}} -1 |
---|
621 | } {- {} 0 subexpr {{bar}} 1 text bar 0 {}} |
---|
622 | test parseExpr-16.15 {GetLexeme procedure, lexeme is "("} testexprparser { |
---|
623 | testexprparser {(123)} -1 |
---|
624 | } {- {} 0 subexpr 123 1 text 123 0 {}} |
---|
625 | test parseExpr-16.16 {GetLexeme procedure, lexeme is ")"} testexprparser { |
---|
626 | testexprparser {(2*3)} -1 |
---|
627 | } {- {} 0 subexpr 2*3 5 operator * 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} |
---|
628 | test parseExpr-16.17 {GetLexeme procedure, lexeme is "$"} testexprparser { |
---|
629 | testexprparser {$wombat} -1 |
---|
630 | } {- {} 0 subexpr {$wombat} 2 variable {$wombat} 1 text wombat 0 {}} |
---|
631 | test parseExpr-16.18 "GetLexeme procedure, lexeme is '\"'" testexprparser { |
---|
632 | testexprparser {"fred"} -1 |
---|
633 | } {- {} 0 subexpr {"fred"} 1 text fred 0 {}} |
---|
634 | test parseExpr-16.19 {GetLexeme procedure, lexeme is ","} testexprparser { |
---|
635 | testexprparser {foo(1,2)} -1 |
---|
636 | } {- {} 0 subexpr foo(1,2) 5 operator foo 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}} |
---|
637 | test parseExpr-16.20 {GetLexeme procedure, lexeme is "*"} testexprparser { |
---|
638 | testexprparser {$a*$b} -1 |
---|
639 | } {- {} 0 subexpr {$a*$b} 7 operator * 0 subexpr {$a} 2 variable {$a} 1 text a 0 subexpr {$b} 2 variable {$b} 1 text b 0 {}} |
---|
640 | test parseExpr-16.21 {GetLexeme procedure, lexeme is "/"} testexprparser { |
---|
641 | testexprparser {5/6} -1 |
---|
642 | } {- {} 0 subexpr 5/6 5 operator / 0 subexpr 5 1 text 5 0 subexpr 6 1 text 6 0 {}} |
---|
643 | test parseExpr-16.22 {GetLexeme procedure, lexeme is "%"} testexprparser { |
---|
644 | testexprparser {5%[xxx]} -1 |
---|
645 | } {- {} 0 subexpr {5%[xxx]} 5 operator % 0 subexpr 5 1 text 5 0 subexpr {[xxx]} 1 command {[xxx]} 0 {}} |
---|
646 | test parseExpr-16.23 {GetLexeme procedure, lexeme is "+"} testexprparser { |
---|
647 | testexprparser {1+2} -1 |
---|
648 | } {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}} |
---|
649 | test parseExpr-16.24 {GetLexeme procedure, lexeme is "-"} testexprparser { |
---|
650 | testexprparser {.12-0e27} -1 |
---|
651 | } {- {} 0 subexpr .12-0e27 5 operator - 0 subexpr .12 1 text .12 0 subexpr 0e27 1 text 0e27 0 {}} |
---|
652 | test parseExpr-16.25 {GetLexeme procedure, lexeme is "?" or ":"} testexprparser { |
---|
653 | testexprparser {$b? 1 : 0} -1 |
---|
654 | } {- {} 0 subexpr {$b? 1 : 0} 8 operator ? 0 subexpr {$b} 2 variable {$b} 1 text b 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}} |
---|
655 | test parseExpr-16.26 {GetLexeme procedure, lexeme is "<"} testexprparser { |
---|
656 | testexprparser {2<3} -1 |
---|
657 | } {- {} 0 subexpr 2<3 5 operator < 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} |
---|
658 | test parseExpr-16.27 {GetLexeme procedure, lexeme is "<<"} testexprparser { |
---|
659 | testexprparser {2<<3} -1 |
---|
660 | } {- {} 0 subexpr 2<<3 5 operator << 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} |
---|
661 | test parseExpr-16.28 {GetLexeme procedure, lexeme is "<="} testexprparser { |
---|
662 | testexprparser {2<=3} -1 |
---|
663 | } {- {} 0 subexpr 2<=3 5 operator <= 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} |
---|
664 | test parseExpr-16.29 {GetLexeme procedure, lexeme is ">"} testexprparser { |
---|
665 | testexprparser {2>3} -1 |
---|
666 | } {- {} 0 subexpr 2>3 5 operator > 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} |
---|
667 | test parseExpr-16.30 {GetLexeme procedure, lexeme is ">>"} testexprparser { |
---|
668 | testexprparser {2>>3} -1 |
---|
669 | } {- {} 0 subexpr 2>>3 5 operator >> 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} |
---|
670 | test parseExpr-16.31 {GetLexeme procedure, lexeme is ">="} testexprparser { |
---|
671 | testexprparser {2>=3} -1 |
---|
672 | } {- {} 0 subexpr 2>=3 5 operator >= 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} |
---|
673 | test parseExpr-16.32 {GetLexeme procedure, lexeme is "=="} testexprparser { |
---|
674 | testexprparser {2==3} -1 |
---|
675 | } {- {} 0 subexpr 2==3 5 operator == 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} |
---|
676 | test parseExpr-16.33 {GetLexeme procedure, bad lexeme starting with "="} -constraints testexprparser -body { |
---|
677 | testexprparser {2=+3} -1 |
---|
678 | } -returnCodes error -match glob -result * |
---|
679 | test parseExpr-16.34 {GetLexeme procedure, lexeme is "!="} testexprparser { |
---|
680 | testexprparser {2!=3} -1 |
---|
681 | } {- {} 0 subexpr 2!=3 5 operator != 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} |
---|
682 | test parseExpr-16.35 {GetLexeme procedure, lexeme is "!"} testexprparser { |
---|
683 | testexprparser {!2} -1 |
---|
684 | } {- {} 0 subexpr !2 3 operator ! 0 subexpr 2 1 text 2 0 {}} |
---|
685 | test parseExpr-16.36 {GetLexeme procedure, lexeme is "&&"} testexprparser { |
---|
686 | testexprparser {2&&3} -1 |
---|
687 | } {- {} 0 subexpr 2&&3 5 operator && 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} |
---|
688 | test parseExpr-16.37 {GetLexeme procedure, lexeme is "&"} testexprparser { |
---|
689 | testexprparser {1&2} -1 |
---|
690 | } {- {} 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}} |
---|
691 | test parseExpr-16.38 {GetLexeme procedure, lexeme is "^"} testexprparser { |
---|
692 | testexprparser {1^2} -1 |
---|
693 | } {- {} 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}} |
---|
694 | test parseExpr-16.39 {GetLexeme procedure, lexeme is "||"} testexprparser { |
---|
695 | testexprparser {2||3} -1 |
---|
696 | } {- {} 0 subexpr 2||3 5 operator || 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} |
---|
697 | test parseExpr-16.40 {GetLexeme procedure, lexeme is "|"} testexprparser { |
---|
698 | testexprparser {1|2} -1 |
---|
699 | } {- {} 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}} |
---|
700 | test parseExpr-16.41 {GetLexeme procedure, lexeme is "~"} testexprparser { |
---|
701 | testexprparser {~2} -1 |
---|
702 | } {- {} 0 subexpr ~2 3 operator ~ 0 subexpr 2 1 text 2 0 {}} |
---|
703 | test parseExpr-16.42 {GetLexeme procedure, lexeme is func name} testexprparser { |
---|
704 | testexprparser {george()} -1 |
---|
705 | } {- {} 0 subexpr george() 1 operator george 0 {}} |
---|
706 | test parseExpr-16.43 {GetLexeme procedure, lexeme is func name} testexprparser { |
---|
707 | testexprparser {harmonic_ratio(2,3)} -1 |
---|
708 | } {- {} 0 subexpr harmonic_ratio(2,3) 5 operator harmonic_ratio 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} |
---|
709 | test parseExpr-16.44 {GetLexeme procedure, unknown lexeme} -constraints testexprparser -body { |
---|
710 | testexprparser {@27} -1 |
---|
711 | } -returnCodes error -match glob -result * |
---|
712 | |
---|
713 | test parseExpr-17.1 {PrependSubExprTokens procedure, expand token array} testexprparser { |
---|
714 | testexprparser {[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]} -1 |
---|
715 | } {- {} 0 subexpr {[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]} 13 operator && 0 subexpr {[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]} 9 operator && 0 subexpr {[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]} 5 operator && 0 subexpr {[string compare [format %c $i] [string index $a $i]]} 1 command {[string compare [format %c $i] [string index $a $i]]} 0 subexpr {[string compare [format %c $i] [string index $a $i]]} 1 command {[string compare [format %c $i] [string index $a $i]]} 0 subexpr {[string compare [format %c $i] [string index $a $i]]} 1 command {[string compare [format %c $i] [string index $a $i]]} 0 subexpr {[string compare [format %c $i] [string index $a $i]]} 1 command {[string compare [format %c $i] [string index $a $i]]} 0 {}} |
---|
716 | |
---|
717 | test parseExpr-18.1 {LogSyntaxError procedure, error in expr longer than 60 chars} -constraints testexprparser -body { |
---|
718 | testexprparser {(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)/} -1 |
---|
719 | } -returnCodes error -match glob -result * |
---|
720 | |
---|
721 | test parseExpr-19.1 {TclParseInteger: [Bug 648441]} -body { |
---|
722 | # Should see this as integer "0" followed by incomplete function "x" |
---|
723 | # Thus, syntax error. |
---|
724 | # If Bug 648441 is not fixed, "0x" will be seen as floating point 0.0 |
---|
725 | expr 0x |
---|
726 | } -returnCodes error -match glob -result * |
---|
727 | |
---|
728 | test parseExpr-20.1 {Bug 1451233} { |
---|
729 | expr 1000000000000000000042 |
---|
730 | } 1000000000000000000042 |
---|
731 | test parseExpr-20.2 {Bug 1451233} { |
---|
732 | expr 10000000000000000000420000000042 |
---|
733 | } 10000000000000000000420000000042 |
---|
734 | test parseExpr-20.3 {Bug 1451233} { |
---|
735 | expr 10000000000000000000020000000002 |
---|
736 | } 10000000000000000000020000000002 |
---|
737 | |
---|
738 | test parseExpr-21.1 {error messages} -body { |
---|
739 | expr @ |
---|
740 | } -returnCodes error -result {invalid character "@" |
---|
741 | in expression "@"} |
---|
742 | test parseExpr-21.2 {error messages} -body { |
---|
743 | expr = |
---|
744 | } -returnCodes error -result {incomplete operator "=" |
---|
745 | in expression "="} |
---|
746 | test parseExpr-21.3 {error messages} -body { |
---|
747 | expr x |
---|
748 | } -returnCodes error -result {invalid bareword "x" |
---|
749 | in expression "x"; |
---|
750 | should be "$x" or "{x}" or "x(...)" or ...} |
---|
751 | test parseExpr-21.4 {error messages} -body { |
---|
752 | expr abcdefghijklmnopqrstuvwxyz |
---|
753 | } -returnCodes error -result {invalid bareword "abcdefghijklmnopqrstuv..." |
---|
754 | in expression "abcdefghijklmnopqrstuv..."; |
---|
755 | should be "$abcdefghijklmnopqrstuv..." or "{abcdefghijklmnopqrstuv...}" or "abcdefghijklmnopqrstuv...(...)" or ...} |
---|
756 | test parseExpr-21.5 {error messages} -body { |
---|
757 | expr {[][]} |
---|
758 | } -returnCodes error -result {missing operator at _@_ |
---|
759 | in expression "[]_@_[]"} |
---|
760 | test parseExpr-21.6 {error messages} -body { |
---|
761 | expr {0 0} |
---|
762 | } -returnCodes error -result {missing operator at _@_ |
---|
763 | in expression "0 _@_0"} |
---|
764 | test parseExpr-21.7 {error messages} -body { |
---|
765 | expr {0o8} |
---|
766 | } -returnCodes error -match glob -result {*invalid octal number*} |
---|
767 | test parseExpr-21.8 {error messages} -body { |
---|
768 | expr {0o8x} |
---|
769 | } -returnCodes error -match glob -result {*invalid octal number*} |
---|
770 | test parseExpr-21.9 {error messages} -body { |
---|
771 | expr {"} |
---|
772 | } -returnCodes error -result {missing " |
---|
773 | in expression """} |
---|
774 | test parseExpr-21.10 {error messages} -body { |
---|
775 | expr \{ |
---|
776 | } -returnCodes error -result "missing close-brace |
---|
777 | in expression \"\{\"" |
---|
778 | test parseExpr-21.11 {error messages} -body { |
---|
779 | expr $ |
---|
780 | } -returnCodes error -result {invalid character "$" |
---|
781 | in expression "$"} |
---|
782 | test parseExpr-21.12 {error messages} -body { |
---|
783 | expr {$(} |
---|
784 | } -returnCodes error -result {missing ) |
---|
785 | in expression "$("} |
---|
786 | test parseExpr-21.13 {error messages} -body { |
---|
787 | expr {[""x]} |
---|
788 | } -returnCodes error -result {extra characters after close-quote |
---|
789 | in expression "[""x]"} |
---|
790 | test parseExpr-21.14 {error messages} -body { |
---|
791 | expr {[} |
---|
792 | } -returnCodes error -result {missing close-bracket |
---|
793 | in expression "["} |
---|
794 | test parseExpr-21.15 {error messages} -body { |
---|
795 | expr 0~0 |
---|
796 | } -returnCodes error -result {missing operator at _@_ |
---|
797 | in expression "0_@_~0"} |
---|
798 | test parseExpr-21.16 {error messages} -body { |
---|
799 | expr () |
---|
800 | } -returnCodes error -result {empty subexpression at _@_ |
---|
801 | in expression "(_@_)"} |
---|
802 | test parseExpr-21.17 {error messages} -body { |
---|
803 | expr ( |
---|
804 | } -returnCodes error -result {unbalanced open paren |
---|
805 | in expression "("} |
---|
806 | test parseExpr-21.18 {error messages} -body { |
---|
807 | expr a(0,) |
---|
808 | } -returnCodes error -result {missing function argument at _@_ |
---|
809 | in expression "a(0,_@_)"} |
---|
810 | test parseExpr-21.19 {error messages} -body { |
---|
811 | expr {} |
---|
812 | } -returnCodes error -result {empty expression |
---|
813 | in expression ""} |
---|
814 | test parseExpr-21.20 {error messages} -body { |
---|
815 | expr ) |
---|
816 | } -returnCodes error -result {unbalanced close paren |
---|
817 | in expression ")"} |
---|
818 | test parseExpr-21.21 {error messages} -body { |
---|
819 | expr a(,0) |
---|
820 | } -returnCodes error -result {missing function argument at _@_ |
---|
821 | in expression "a(_@_,0)"} |
---|
822 | test parseExpr-21.22 {error messages} -body { |
---|
823 | expr 0&|0 |
---|
824 | } -returnCodes error -result {missing operand at _@_ |
---|
825 | in expression "0&_@_|0"} |
---|
826 | test parseExpr-21.23 {error messages} -body { |
---|
827 | expr 0^^0 |
---|
828 | } -returnCodes error -result {missing operand at _@_ |
---|
829 | in expression "0^_@_^0"} |
---|
830 | test parseExpr-21.24 {error messages} -body { |
---|
831 | expr 0|&0 |
---|
832 | } -returnCodes error -result {missing operand at _@_ |
---|
833 | in expression "0|_@_&0"} |
---|
834 | test parseExpr-21.25 {error messages} -body { |
---|
835 | expr a(1+,0) |
---|
836 | } -returnCodes error -result {missing operand at _@_ |
---|
837 | in expression "a(1+_@_,0)"} |
---|
838 | test parseExpr-21.26 {error messages} -body { |
---|
839 | expr (0 |
---|
840 | } -returnCodes error -result {unbalanced open paren |
---|
841 | in expression "(0"} |
---|
842 | test parseExpr-21.27 {error messages} -body { |
---|
843 | expr 0?0 |
---|
844 | } -returnCodes error -result {missing operator ":" at _@_ |
---|
845 | in expression "0?0_@_"} |
---|
846 | test parseExpr-21.28 {error messages} -body { |
---|
847 | expr 0:0 |
---|
848 | } -returnCodes error -result {unexpected operator ":" without preceding "?" |
---|
849 | in expression "0:0"} |
---|
850 | test parseExpr-21.29 {error messages} -body { |
---|
851 | expr 0) |
---|
852 | } -returnCodes error -result {unbalanced close paren |
---|
853 | in expression "0)"} |
---|
854 | test parseExpr-21.30 {error messages} -body { |
---|
855 | expr 0, |
---|
856 | } -returnCodes error -result {unexpected "," outside function argument list |
---|
857 | in expression "0,"} |
---|
858 | test parseExpr-21.31 {error messages} -body { |
---|
859 | expr 0,0 |
---|
860 | } -returnCodes error -result {unexpected "," outside function argument list |
---|
861 | in expression "0,0"} |
---|
862 | test parseExpr-21.32 {error messages} -body { |
---|
863 | expr (0,0) |
---|
864 | } -returnCodes error -result {unexpected "," outside function argument list |
---|
865 | in expression "(0,0)"} |
---|
866 | test parseExpr-21.33 {error messages} -body { |
---|
867 | expr a(0:0,0) |
---|
868 | } -returnCodes error -result {unexpected operator ":" without preceding "?" |
---|
869 | in expression "a(0:0,0)"} |
---|
870 | test parseExpr-21.34 {error messages} -body { |
---|
871 | expr {"abcdefghijklmnopqrstuvwxyz"@0} |
---|
872 | } -returnCodes error -result {invalid character "@" |
---|
873 | in expression "...fghijklmnopqrstuvwxyz"@0"} |
---|
874 | test parseExpr-21.35 {error messages} -body { |
---|
875 | expr {0@"abcdefghijklmnopqrstuvwxyz"} |
---|
876 | } -returnCodes error -result {invalid character "@" |
---|
877 | in expression "0@"abcdefghijklmnopqrstu..."} |
---|
878 | test parseExpr-21.36 {error messages} -body { |
---|
879 | expr {"abcdefghijklmnopqrstuvwxyz"@"abcdefghijklmnopqrstuvwxyz"} |
---|
880 | } -returnCodes error -result {invalid character "@" |
---|
881 | in expression "...fghijklmnopqrstuvwxyz"@"abcdefghijklmnopqrstu..."} |
---|
882 | test parseExpr-21.37 {error messages} -body { |
---|
883 | expr [format {"%s" @ 0} [string repeat \u00a7 25]] |
---|
884 | } -returnCodes error -result [format {invalid character "@" |
---|
885 | in expression "...%s" @ 0"} [string repeat \u00a7 10]] |
---|
886 | test parseExpr-21.38 {error messages} -body { |
---|
887 | expr [format {0 @ "%s"} [string repeat \u00a7 25]] |
---|
888 | } -returnCodes error -result [format {invalid character "@" |
---|
889 | in expression "0 @ "%s..."} [string repeat \u00a7 10]] |
---|
890 | test parseExpr-21.39 {error messages} -body { |
---|
891 | expr [format {"%s" @ "%s"} [string repeat \u00a7 25] [string repeat \u00a7 25]] |
---|
892 | } -returnCodes error -result [format {invalid character "@" |
---|
893 | in expression "...%s" @ "%s..."} [string repeat \u00a7 10] [string repeat \u00a7 10]] |
---|
894 | test parseExpr-21.40 {error messages} -body { |
---|
895 | catch {expr {"abcdefghijklmnopqrstuvwxyz"@0}} m o |
---|
896 | dict get $o -errorinfo |
---|
897 | } -result {invalid character "@" |
---|
898 | in expression "...fghijklmnopqrstuvwxyz"@0" |
---|
899 | (parsing expression ""abcdefghijklmnopqrstu...") |
---|
900 | invoked from within |
---|
901 | "expr {"abcdefghijklmnopqrstuvwxyz"@0}"} |
---|
902 | test parseExpr-21.41 {error messages} -body { |
---|
903 | catch {expr [format {"%s" @ 0} [string repeat \u00a7 25]]} m o |
---|
904 | dict get $o -errorinfo |
---|
905 | } -result [format {invalid character "@" |
---|
906 | in expression "...%s" @ 0" |
---|
907 | (parsing expression ""%s...") |
---|
908 | invoked from within |
---|
909 | "expr [format {"%%s" @ 0} [string repeat \u00a7 25]]"} [string repeat \u00a7 10] [string repeat \u00a7 10]] |
---|
910 | test parseExpr-21.42 {error message} -body { |
---|
911 | expr {123456789012345678901234567890*"abcdefghijklmnopqrstuvwxyz} |
---|
912 | } -returnCodes error -result {missing " |
---|
913 | in expression "...012345678901234567890*"abcdefghijklmnopqrstuv..."} |
---|
914 | test parseExpr-21.43 {error message} -body { |
---|
915 | expr "123456789012345678901234567890*\"foobar\$\{abcdefghijklmnopqrstuvwxyz\"" |
---|
916 | } -returnCodes error -result "missing close-brace for variable name |
---|
917 | in expression \"...8901234567890*\"foobar\$\{abcdefghijklmnopqrstuv...\"" |
---|
918 | test parseExpr-21.44 {error message} -body { |
---|
919 | expr {123456789012345678901234567890*"foo$bar(abcdefghijklmnopqrstuvwxyz"} |
---|
920 | } -returnCodes error -result {missing ) |
---|
921 | in expression "...8901234567890*"foo$bar(abcdefghijklmnopqrstuv..."} |
---|
922 | test parseExpr-21.45 {error message} -body { |
---|
923 | expr {123456789012345678901234567890*"foo$bar([{}abcdefghijklmnopqrstuvwxyz])"} |
---|
924 | } -returnCodes error -result {extra characters after close-brace |
---|
925 | in expression "...234567890*"foo$bar([{}abcdefghijklmnopqrstuv..."} |
---|
926 | test parseExpr-21.46 {error message} -body { |
---|
927 | expr {123456789012345678901234567890*"foo$bar([""abcdefghijklmnopqrstuvwxyz])"} |
---|
928 | } -returnCodes error -result {extra characters after close-quote |
---|
929 | in expression "...234567890*"foo$bar([""abcdefghijklmnopqrstuv..."} |
---|
930 | test parseExpr-21.47 {error message} -body { |
---|
931 | expr {123456789012345678901234567890*"foo$bar([abcdefghijklmnopqrstuvwxyz)"} |
---|
932 | } -returnCodes error -result {missing close-bracket |
---|
933 | in expression "...901234567890*"foo$bar([abcdefghijklmnopqrstuv..."} |
---|
934 | test parseExpr-21.48 {error message} -body { |
---|
935 | expr "123456789012345678901234567890*\"foo\$bar(\[\{abcdefghijklmnopqrstuvwxyz])\"" |
---|
936 | } -returnCodes error -result "missing close-brace |
---|
937 | in expression \"...01234567890*\"foo\$bar(\[\{abcdefghijklmnopqrstuv...\"" |
---|
938 | |
---|
939 | test parseExpr-21.49 {error message} -body { |
---|
940 | expr "123456789012345678901234567890*\{abcdefghijklmnopqrstuvwxyz" |
---|
941 | } -returnCodes error -result "missing close-brace |
---|
942 | in expression \"...012345678901234567890*\{abcdefghijklmnopqrstuv...\"" |
---|
943 | |
---|
944 | test parseExpr-21.50 {error message} -body { |
---|
945 | expr {123456789012345678901234567890*$foo(["abcdefghijklmnopqrstuvwxyz])} |
---|
946 | } -returnCodes error -result {missing " |
---|
947 | in expression "...678901234567890*$foo(["abcdefghijklmnopqrstuv..."} |
---|
948 | test parseExpr-21.51 {error message} -body { |
---|
949 | expr "123456789012345678901234567890*\$\{abcdefghijklmnopqrstuvwxyz" |
---|
950 | } -returnCodes error -result "missing close-brace for variable name |
---|
951 | in expression \"...12345678901234567890*\$\{abcdefghijklmnopqrstuv...\"" |
---|
952 | test parseExpr-21.52 {error message} -body { |
---|
953 | expr {123456789012345678901234567890*$bar(abcdefghijklmnopqrstuvwxyz} |
---|
954 | } -returnCodes error -result {missing ) |
---|
955 | in expression "...45678901234567890*$bar(abcdefghijklmnopqrstuv..."} |
---|
956 | test parseExpr-21.53 {error message} -body { |
---|
957 | expr {123456789012345678901234567890*$bar([{}abcdefghijklmnopqrstuvwxyz])"} |
---|
958 | } -returnCodes error -result {extra characters after close-brace |
---|
959 | in expression "...8901234567890*$bar([{}abcdefghijklmnopqrstuv..."} |
---|
960 | test parseExpr-21.54 {error message} -body { |
---|
961 | expr {123456789012345678901234567890*$bar([""abcdefghijklmnopqrstuvwxyz])"} |
---|
962 | } -returnCodes error -result {extra characters after close-quote |
---|
963 | in expression "...8901234567890*$bar([""abcdefghijklmnopqrstuv..."} |
---|
964 | test parseExpr-21.55 {error message} -body { |
---|
965 | expr {123456789012345678901234567890*$bar([abcdefghijklmnopqrstuvwxyz)"} |
---|
966 | } -returnCodes error -result {missing close-bracket |
---|
967 | in expression "...5678901234567890*$bar([abcdefghijklmnopqrstuv..."} |
---|
968 | test parseExpr-21.56 {error message} -body { |
---|
969 | expr "123456789012345678901234567890*\$bar(\[\{abcdefghijklmnopqrstuvwxyz])" |
---|
970 | } -returnCodes error -result "missing close-brace |
---|
971 | in expression \"...678901234567890*\$bar(\[\{abcdefghijklmnopqrstuv...\"" |
---|
972 | |
---|
973 | test parseExpr-21.57 {error message} -body { |
---|
974 | expr {123456789012345678901234567890*["abcdefghijklmnopqrstuvwxyz]} |
---|
975 | } -returnCodes error -result {missing " |
---|
976 | in expression "...12345678901234567890*["abcdefghijklmnopqrstuv..."} |
---|
977 | test parseExpr-21.58 {error message} -body { |
---|
978 | expr "123456789012345678901234567890*\[\$\{abcdefghijklmnopqrstuvwxyz]" |
---|
979 | } -returnCodes error -result "missing close-brace for variable name |
---|
980 | in expression \"...2345678901234567890*\[\$\{abcdefghijklmnopqrstuv...\"" |
---|
981 | test parseExpr-21.59 {error message} -body { |
---|
982 | expr {123456789012345678901234567890*[$bar(abcdefghijklmnopqrstuvwxyz]} |
---|
983 | } -returnCodes error -result {missing ) |
---|
984 | in expression "...5678901234567890*[$bar(abcdefghijklmnopqrstuv..."} |
---|
985 | test parseExpr-21.60 {error message} -body { |
---|
986 | expr {123456789012345678901234567890*[{}abcdefghijklmnopqrstuvwxyz]"} |
---|
987 | } -returnCodes error -result {extra characters after close-brace |
---|
988 | in expression "...345678901234567890*[{}abcdefghijklmnopqrstuv..."} |
---|
989 | test parseExpr-21.61 {error message} -body { |
---|
990 | expr {123456789012345678901234567890*[""abcdefghijklmnopqrstuvwxyz]"} |
---|
991 | } -returnCodes error -result {extra characters after close-quote |
---|
992 | in expression "...345678901234567890*[""abcdefghijklmnopqrstuv..."} |
---|
993 | test parseExpr-21.62 {error message} -body { |
---|
994 | expr {123456789012345678901234567890*[abcdefghijklmnopqrstuvwxyz"} |
---|
995 | } -returnCodes error -result {missing close-bracket |
---|
996 | in expression "...012345678901234567890*[abcdefghijklmnopqrstuv..."} |
---|
997 | test parseExpr-21.63 {error message} -body { |
---|
998 | expr "123456789012345678901234567890*\[\{abcdefghijklmnopqrstuvwxyz]" |
---|
999 | } -returnCodes error -result "missing close-brace |
---|
1000 | in expression \"...12345678901234567890*\[\{abcdefghijklmnopqrstuv...\"" |
---|
1001 | |
---|
1002 | # cleanup |
---|
1003 | ::tcltest::cleanupTests |
---|
1004 | return |
---|