Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/tests/parseExpr.test @ 47

Last change on this file since 47 was 25, checked in by landauf, 17 years ago

added tcl to libs

File size: 61.4 KB
Line 
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
13if {[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
23testConstraint testexprparser [llength [info commands testexprparser]]
24
25# Big test for correct ordering of data in [expr]
26
27proc 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}
81testConstraint ieeeFloatingPoint [testIEEE]
82
83######################################################################
84
85test 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 {}}
88test 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 {}}
91test parseExpr-1.3 {Tcl_ParseExpr procedure, error getting initial lexeme} testexprparser {
92    testexprparser 12345678901234567890 -1
93} {- {} 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
94test parseExpr-1.4 {Tcl_ParseExpr procedure, error in conditional expression} \
95    -constraints testexprparser -body {
96        testexprparser {foo+} -1
97    } -match glob -returnCodes error -result *
98test 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
102test 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 {}}
105test parseExpr-2.2 {ParseCondExpr procedure, error in test subexpr} \
106        -constraints testexprparser -body {
107            testexprparser {0 || foo} -1
108    } -match glob -returnCodes error -result *
109test 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 {}}
112test 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 {}}
115test 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 {}}
118test 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 {}}
121test 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 *
125test 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 *
128test 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 {}}
131test 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
136test 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 {}}
139test 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 *
143test 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 {}}
146test 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 {}}
149test 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 {}}
152test 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 {}}
155test 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
160test 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 {}}
163test 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 *
167test 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 {}}
170test 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 {}}
173test 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 {}}
176test 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 {}}
179test 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
184test 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 {}}
187test 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 *
191test 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 {}}
194test 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 {}}
197test 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 {}}
200test 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 {}}
203test 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
208test 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 {}}
211test 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 *
215test 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 {}}
218test 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 {}}
221test 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 {}}
224test 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 {}}
227test 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
232test 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 {}}
235test 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 *
239test 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 {}}
242test 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 {}}
245test 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 {}}
248test 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 {}}
251test 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
256test 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 {}}
259test 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 *
263test 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 {}}
266test 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 {}}
269test 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 {}}
272test 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 {}}
275test 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 {}}
278test 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
283test 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 {}}
286test 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 *
290test 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 {}}
293test 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 {}}
296test 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 {}}
299test 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 {}}
302test 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 {}}
305test 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 {}}
308test 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 {}}
311test 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
316test 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 {}}
319test 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 *
323test 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 {}}
326test 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 {}}
329test 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 {}}
332test 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 {}}
335test 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 {}}
338test 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
343test 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 {}}
346test 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 *
350test 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 {}}
353test 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 {}}
356test 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 {}}
359test 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 {}}
362test 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 {}}
365test 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
370test 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 {}}
373test 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 *
377test 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 {}}
380test 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 {}}
383test 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 {}}
386test 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 {}}
389test 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 {}}
392test 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
397test 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 {}}
400test 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 {}}
403test 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 {}}
406test 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 {}}
409test 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 {}}
412test 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 {}}
415test 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 {}}
418test 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 {}}
421test 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
426test 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 {}}
429test 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 {}}
432test 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 {}}
435test 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 {}}
438test 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 {}}
441test 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 {}}
444test 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 {}}
447test 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 *
450test 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 *
453test parseExpr-14.10 {ParseUnaryExpr procedure, first token is not unary op} testexprparser {
454    testexprparser {123} -1
455} {- {} 0 subexpr 123 1 text 123 0 {}}
456test 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 {}}
459test 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
463test 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 {}}
466test parseExpr-15.2 {ParsePrimaryExpr procedure, bad lexeme after "("} {testexprparser} {
467    testexprparser {(12345678901234567890)} -1
468} {- {} 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
469test 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 {}}
472test parseExpr-15.4 {ParsePrimaryExpr procedure, error in parenthesized subexpr} -constraints testexprparser -body {
473    testexprparser {(? 123 : 456)} -1
474} -returnCodes error -match glob -result *
475test parseExpr-15.5 {ParsePrimaryExpr procedure, missing ")" after in parenthesized subexpr} -constraints testexprparser -body {
476    testexprparser {({abc}/{def}} -1
477} -returnCodes error -match glob -result *
478test parseExpr-15.6 {ParsePrimaryExpr procedure, primary is literal} testexprparser {
479    testexprparser {12345} -1
480} {- {} 0 subexpr 12345 1 text 12345 0 {}}
481test parseExpr-15.7 {ParsePrimaryExpr procedure, primary is literal} testexprparser {
482    testexprparser {12345.6789} -1
483} {- {} 0 subexpr 12345.6789 1 text 12345.6789 0 {}}
484test 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 {}}
487test 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 {}}
490test 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 {}}
493test parseExpr-15.11 {ParsePrimaryExpr procedure, error in var reference} -constraints testexprparser -body {
494    testexprparser {$a(} -1
495} -returnCodes error -match glob -result *
496test 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 {}}
499test parseExpr-15.13 {ParsePrimaryExpr procedure, error in quoted string} -constraints testexprparser -body {
500    testexprparser {"$a(12"} -1
501} -returnCodes error -match glob -result *
502test 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 {}}
505test parseExpr-15.15 {ParsePrimaryExpr procedure, primary is command} testexprparser {
506    testexprparser {[def]} -1
507} {- {} 0 subexpr {[def]} 1 command {[def]} 0 {}}
508test 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 {}}
511test 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 {}}
514test parseExpr-15.18 {ParsePrimaryExpr procedure, missing close bracket} -constraints testexprparser -body {
515    testexprparser {[one} -1
516} -returnCodes error -match glob -result *
517test 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 {}}
520test 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 *
523test 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 {}}
527test 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 {}}
530test 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 *
533test 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 *
537test 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 {}}
540test 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 {}}
543test parseExpr-15.27 {ParsePrimaryExpr procedure, error in function arg} -constraints testexprparser -body {
544    testexprparser {foo(*1-2)} -1
545} -returnCodes error -match glob -result *
546test parseExpr-15.28 {ParsePrimaryExpr procedure, error in function arg} -constraints testexprparser -body {
547    testexprparser {foo(*1-2)} -1
548} -returnCodes error -match glob -result *
549test 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 {}}
552test 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 {}}
555test 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 *
558test parseExpr-15.32 {ParsePrimaryExpr procedure, bad lexeme after primary} -constraints testexprparser -body {
559    testexprparser {123 12345678901234567890} -1
560} -returnCodes error -match glob -result *
561test parseExpr-15.33 {ParsePrimaryExpr procedure, comma-specific message} -constraints testexprparser -body {
562    testexprparser {123+,456} -1
563} -returnCodes error -match glob -result *
564test parseExpr-15.34 {ParsePrimaryExpr procedure, single equal-specific message} -constraints testexprparser -body {
565    testexprparser {123+=456} -1
566} -returnCodes error -match glob -result *
567test parseExpr-15.35 {ParsePrimaryExpr procedure, error in parenthesized subexpr} -constraints testexprparser -body {
568    testexprparser {(: 123 : 456)} -1
569} -returnCodes error -match glob -result *
570test 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
575test parseExpr-16.1 {GetLexeme procedure, whitespace before lexeme} testexprparser {
576    testexprparser {   123} -1
577} {- {} 0 subexpr 123 1 text 123 0 {}}
578test parseExpr-16.2 {GetLexeme procedure, whitespace before lexeme} testexprparser {
579    testexprparser {  \
580456} -1
581} {- {} 0 subexpr 456 1 text 456 0 {}}
582test parseExpr-16.3 {GetLexeme procedure, no lexeme after whitespace} testexprparser {
583    testexprparser { 123 \
584   } -1
585} {- {} 0 subexpr 123 1 text 123 0 {}}
586test parseExpr-16.4 {GetLexeme procedure, integer lexeme} testexprparser {
587    testexprparser {000} -1
588} {- {} 0 subexpr 000 1 text 000 0 {}}
589test parseExpr-16.5 {GetLexeme procedure, integer lexeme too big} testexprparser {
590    testexprparser {12345678901234567890} -1
591} {- {} 0 subexpr 12345678901234567890 1 text 12345678901234567890 0 {}}
592test parseExpr-16.6 {GetLexeme procedure, bad integer lexeme} -constraints testexprparser -body {
593    testexprparser {0o999} -1
594} -returnCodes error -match glob -result {*invalid octal number*}
595test parseExpr-16.7 {GetLexeme procedure, double lexeme} testexprparser {
596    testexprparser {0.999} -1
597} {- {} 0 subexpr 0.999 1 text 0.999 0 {}}
598test parseExpr-16.8 {GetLexeme procedure, double lexeme} testexprparser {
599    testexprparser {.123} -1
600} {- {} 0 subexpr .123 1 text .123 0 {}}
601test parseExpr-16.9 {GetLexeme procedure, double lexeme} {testexprparser unix} {
602    testexprparser {nan} -1
603} {- {} 0 subexpr nan 1 text nan 0 {}}
604test parseExpr-16.10 {GetLexeme procedure, double lexeme} {testexprparser unix} {
605    testexprparser {NaN} -1
606} {- {} 0 subexpr NaN 1 text NaN 0 {}}
607test 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}}
610test 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 {}}}
613test parseExpr-16.12 {GetLexeme procedure, bad double lexeme} -constraints testexprparser -body {
614    testexprparser {123.4x56} -1
615} -returnCodes error -match glob -result *
616test parseExpr-16.13 {GetLexeme procedure, lexeme is "["} testexprparser {
617    testexprparser {[foo]} -1
618} {- {} 0 subexpr {[foo]} 1 command {[foo]} 0 {}}
619test parseExpr-16.14 {GetLexeme procedure, lexeme is open brace} testexprparser {
620    testexprparser {{bar}} -1
621} {- {} 0 subexpr {{bar}} 1 text bar 0 {}}
622test parseExpr-16.15 {GetLexeme procedure, lexeme is "("} testexprparser {
623    testexprparser {(123)} -1
624} {- {} 0 subexpr 123 1 text 123 0 {}}
625test 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 {}}
628test parseExpr-16.17 {GetLexeme procedure, lexeme is "$"} testexprparser {
629    testexprparser {$wombat} -1
630} {- {} 0 subexpr {$wombat} 2 variable {$wombat} 1 text wombat 0 {}}
631test parseExpr-16.18 "GetLexeme procedure, lexeme is '\"'" testexprparser {
632    testexprparser {"fred"} -1
633} {- {} 0 subexpr {"fred"} 1 text fred 0 {}}
634test 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 {}}
637test 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 {}}
640test 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 {}}
643test 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 {}}
646test 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 {}}
649test 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 {}}
652test 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 {}}
655test 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 {}}
658test 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 {}}
661test 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 {}}
664test 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 {}}
667test 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 {}}
670test 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 {}}
673test 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 {}}
676test parseExpr-16.33 {GetLexeme procedure, bad lexeme starting with "="} -constraints testexprparser -body {
677    testexprparser {2=+3} -1
678} -returnCodes error -match glob -result *
679test 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 {}}
682test 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 {}}
685test 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 {}}
688test 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 {}}
691test 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 {}}
694test 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 {}}
697test 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 {}}
700test 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 {}}
703test parseExpr-16.42 {GetLexeme procedure, lexeme is func name} testexprparser {
704    testexprparser {george()} -1
705} {- {} 0 subexpr george() 1 operator george 0 {}}
706test 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 {}}
709test parseExpr-16.44 {GetLexeme procedure, unknown lexeme} -constraints testexprparser -body {
710    testexprparser {@27} -1
711} -returnCodes error -match glob -result *
712
713test 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
717test 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
721test 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
728test parseExpr-20.1 {Bug 1451233} {
729    expr 1000000000000000000042
730} 1000000000000000000042
731test parseExpr-20.2 {Bug 1451233} {
732    expr 10000000000000000000420000000042
733} 10000000000000000000420000000042
734test parseExpr-20.3 {Bug 1451233} {
735    expr 10000000000000000000020000000002
736} 10000000000000000000020000000002
737
738test parseExpr-21.1 {error messages} -body {
739    expr @
740} -returnCodes error -result {invalid character "@"
741in expression "@"}
742test parseExpr-21.2 {error messages} -body {
743    expr =
744} -returnCodes error -result {incomplete operator "="
745in expression "="}
746test parseExpr-21.3 {error messages} -body {
747    expr x
748} -returnCodes error -result {invalid bareword "x"
749in expression "x";
750should be "$x" or "{x}" or "x(...)" or ...}
751test parseExpr-21.4 {error messages} -body {
752    expr abcdefghijklmnopqrstuvwxyz
753} -returnCodes error -result {invalid bareword "abcdefghijklmnopqrstuv..."
754in expression "abcdefghijklmnopqrstuv...";
755should be "$abcdefghijklmnopqrstuv..." or "{abcdefghijklmnopqrstuv...}" or "abcdefghijklmnopqrstuv...(...)" or ...}
756test parseExpr-21.5 {error messages} -body {
757    expr {[][]}
758} -returnCodes error -result {missing operator at _@_
759in expression "[]_@_[]"}
760test parseExpr-21.6 {error messages} -body {
761    expr {0 0}
762} -returnCodes error -result {missing operator at _@_
763in expression "0 _@_0"}
764test parseExpr-21.7 {error messages} -body {
765    expr {0o8}
766} -returnCodes error -match glob -result {*invalid octal number*}
767test parseExpr-21.8 {error messages} -body {
768    expr {0o8x}
769} -returnCodes error -match glob -result {*invalid octal number*}
770test parseExpr-21.9 {error messages} -body {
771    expr {"}
772} -returnCodes error -result {missing "
773in expression """}
774test parseExpr-21.10 {error messages} -body {
775    expr \{
776} -returnCodes error -result "missing close-brace
777in expression \"\{\""
778test parseExpr-21.11 {error messages} -body {
779    expr $
780} -returnCodes error -result {invalid character "$"
781in expression "$"}
782test parseExpr-21.12 {error messages} -body {
783    expr {$(}
784} -returnCodes error -result {missing )
785in expression "$("}
786test parseExpr-21.13 {error messages} -body {
787    expr {[""x]}
788} -returnCodes error -result {extra characters after close-quote
789in expression "[""x]"}
790test parseExpr-21.14 {error messages} -body {
791    expr {[}
792} -returnCodes error -result {missing close-bracket
793in expression "["}
794test parseExpr-21.15 {error messages} -body {
795    expr 0~0
796} -returnCodes error -result {missing operator at _@_
797in expression "0_@_~0"}
798test parseExpr-21.16 {error messages} -body {
799    expr ()
800} -returnCodes error -result {empty subexpression at _@_
801in expression "(_@_)"}
802test parseExpr-21.17 {error messages} -body {
803    expr (
804} -returnCodes error -result {unbalanced open paren
805in expression "("}
806test parseExpr-21.18 {error messages} -body {
807    expr a(0,)
808} -returnCodes error -result {missing function argument at _@_
809in expression "a(0,_@_)"}
810test parseExpr-21.19 {error messages} -body {
811    expr {}
812} -returnCodes error -result {empty expression
813in expression ""}
814test parseExpr-21.20 {error messages} -body {
815    expr )
816} -returnCodes error -result {unbalanced close paren
817in expression ")"}
818test parseExpr-21.21 {error messages} -body {
819    expr a(,0)
820} -returnCodes error -result {missing function argument at _@_
821in expression "a(_@_,0)"}
822test parseExpr-21.22 {error messages} -body {
823    expr 0&|0
824} -returnCodes error -result {missing operand at _@_
825in expression "0&_@_|0"}
826test parseExpr-21.23 {error messages} -body {
827    expr 0^^0
828} -returnCodes error -result {missing operand at _@_
829in expression "0^_@_^0"}
830test parseExpr-21.24 {error messages} -body {
831    expr 0|&0
832} -returnCodes error -result {missing operand at _@_
833in expression "0|_@_&0"}
834test parseExpr-21.25 {error messages} -body {
835    expr a(1+,0)
836} -returnCodes error -result {missing operand at _@_
837in expression "a(1+_@_,0)"}
838test parseExpr-21.26 {error messages} -body {
839    expr (0
840} -returnCodes error -result {unbalanced open paren
841in expression "(0"}
842test parseExpr-21.27 {error messages} -body {
843    expr 0?0
844} -returnCodes error -result {missing operator ":" at _@_
845in expression "0?0_@_"}
846test parseExpr-21.28 {error messages} -body {
847    expr 0:0
848} -returnCodes error -result {unexpected operator ":" without preceding "?"
849in expression "0:0"}
850test parseExpr-21.29 {error messages} -body {
851    expr 0)
852} -returnCodes error -result {unbalanced close paren
853in expression "0)"}
854test parseExpr-21.30 {error messages} -body {
855    expr 0,
856} -returnCodes error -result {unexpected "," outside function argument list
857in expression "0,"}
858test parseExpr-21.31 {error messages} -body {
859    expr 0,0
860} -returnCodes error -result {unexpected "," outside function argument list
861in expression "0,0"}
862test parseExpr-21.32 {error messages} -body {
863    expr (0,0)
864} -returnCodes error -result {unexpected "," outside function argument list
865in expression "(0,0)"}
866test parseExpr-21.33 {error messages} -body {
867    expr a(0:0,0)
868} -returnCodes error -result {unexpected operator ":" without preceding "?"
869in expression "a(0:0,0)"}
870test parseExpr-21.34 {error messages} -body {
871    expr {"abcdefghijklmnopqrstuvwxyz"@0}
872} -returnCodes error -result {invalid character "@"
873in expression "...fghijklmnopqrstuvwxyz"@0"}
874test parseExpr-21.35 {error messages} -body {
875    expr {0@"abcdefghijklmnopqrstuvwxyz"}
876} -returnCodes error -result {invalid character "@"
877in expression "0@"abcdefghijklmnopqrstu..."}
878test parseExpr-21.36 {error messages} -body {
879    expr {"abcdefghijklmnopqrstuvwxyz"@"abcdefghijklmnopqrstuvwxyz"}
880} -returnCodes error -result {invalid character "@"
881in expression "...fghijklmnopqrstuvwxyz"@"abcdefghijklmnopqrstu..."}
882test parseExpr-21.37 {error messages} -body {
883    expr [format {"%s" @ 0} [string repeat \u00a7 25]]
884} -returnCodes error -result [format {invalid character "@"
885in expression "...%s" @ 0"} [string repeat \u00a7 10]]
886test parseExpr-21.38 {error messages} -body {
887    expr [format {0 @ "%s"} [string repeat \u00a7 25]]
888} -returnCodes error -result [format {invalid character "@"
889in expression "0 @ "%s..."} [string repeat \u00a7 10]]
890test 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 "@"
893in expression "...%s" @ "%s..."} [string repeat \u00a7 10] [string repeat \u00a7 10]]
894test parseExpr-21.40 {error messages} -body {
895    catch {expr {"abcdefghijklmnopqrstuvwxyz"@0}} m o
896    dict get $o -errorinfo
897} -result {invalid character "@"
898in expression "...fghijklmnopqrstuvwxyz"@0"
899    (parsing expression ""abcdefghijklmnopqrstu...")
900    invoked from within
901"expr {"abcdefghijklmnopqrstuvwxyz"@0}"}
902test 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 "@"
906in 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]]
910test parseExpr-21.42 {error message} -body {
911    expr {123456789012345678901234567890*"abcdefghijklmnopqrstuvwxyz}
912} -returnCodes error -result {missing "
913in expression "...012345678901234567890*"abcdefghijklmnopqrstuv..."}
914test parseExpr-21.43 {error message} -body {
915    expr "123456789012345678901234567890*\"foobar\$\{abcdefghijklmnopqrstuvwxyz\""
916} -returnCodes error -result "missing close-brace for variable name
917in expression \"...8901234567890*\"foobar\$\{abcdefghijklmnopqrstuv...\""
918test parseExpr-21.44 {error message} -body {
919    expr {123456789012345678901234567890*"foo$bar(abcdefghijklmnopqrstuvwxyz"}
920} -returnCodes error -result {missing )
921in expression "...8901234567890*"foo$bar(abcdefghijklmnopqrstuv..."}
922test parseExpr-21.45 {error message} -body {
923    expr {123456789012345678901234567890*"foo$bar([{}abcdefghijklmnopqrstuvwxyz])"}
924} -returnCodes error -result {extra characters after close-brace
925in expression "...234567890*"foo$bar([{}abcdefghijklmnopqrstuv..."}
926test parseExpr-21.46 {error message} -body {
927    expr {123456789012345678901234567890*"foo$bar([""abcdefghijklmnopqrstuvwxyz])"}
928} -returnCodes error -result {extra characters after close-quote
929in expression "...234567890*"foo$bar([""abcdefghijklmnopqrstuv..."}
930test parseExpr-21.47 {error message} -body {
931    expr {123456789012345678901234567890*"foo$bar([abcdefghijklmnopqrstuvwxyz)"}
932} -returnCodes error -result {missing close-bracket
933in expression "...901234567890*"foo$bar([abcdefghijklmnopqrstuv..."}
934test parseExpr-21.48 {error message} -body {
935    expr "123456789012345678901234567890*\"foo\$bar(\[\{abcdefghijklmnopqrstuvwxyz])\""
936} -returnCodes error -result "missing close-brace
937in expression \"...01234567890*\"foo\$bar(\[\{abcdefghijklmnopqrstuv...\""
938
939test parseExpr-21.49 {error message} -body {
940    expr "123456789012345678901234567890*\{abcdefghijklmnopqrstuvwxyz"
941} -returnCodes error -result "missing close-brace
942in expression \"...012345678901234567890*\{abcdefghijklmnopqrstuv...\""
943
944test parseExpr-21.50 {error message} -body {
945    expr {123456789012345678901234567890*$foo(["abcdefghijklmnopqrstuvwxyz])}
946} -returnCodes error -result {missing "
947in expression "...678901234567890*$foo(["abcdefghijklmnopqrstuv..."}
948test parseExpr-21.51 {error message} -body {
949    expr "123456789012345678901234567890*\$\{abcdefghijklmnopqrstuvwxyz"
950} -returnCodes error -result "missing close-brace for variable name
951in expression \"...12345678901234567890*\$\{abcdefghijklmnopqrstuv...\""
952test parseExpr-21.52 {error message} -body {
953    expr {123456789012345678901234567890*$bar(abcdefghijklmnopqrstuvwxyz}
954} -returnCodes error -result {missing )
955in expression "...45678901234567890*$bar(abcdefghijklmnopqrstuv..."}
956test parseExpr-21.53 {error message} -body {
957    expr {123456789012345678901234567890*$bar([{}abcdefghijklmnopqrstuvwxyz])"}
958} -returnCodes error -result {extra characters after close-brace
959in expression "...8901234567890*$bar([{}abcdefghijklmnopqrstuv..."}
960test parseExpr-21.54 {error message} -body {
961    expr {123456789012345678901234567890*$bar([""abcdefghijklmnopqrstuvwxyz])"}
962} -returnCodes error -result {extra characters after close-quote
963in expression "...8901234567890*$bar([""abcdefghijklmnopqrstuv..."}
964test parseExpr-21.55 {error message} -body {
965    expr {123456789012345678901234567890*$bar([abcdefghijklmnopqrstuvwxyz)"}
966} -returnCodes error -result {missing close-bracket
967in expression "...5678901234567890*$bar([abcdefghijklmnopqrstuv..."}
968test parseExpr-21.56 {error message} -body {
969    expr "123456789012345678901234567890*\$bar(\[\{abcdefghijklmnopqrstuvwxyz])"
970} -returnCodes error -result "missing close-brace
971in expression \"...678901234567890*\$bar(\[\{abcdefghijklmnopqrstuv...\""
972
973test parseExpr-21.57 {error message} -body {
974    expr {123456789012345678901234567890*["abcdefghijklmnopqrstuvwxyz]}
975} -returnCodes error -result {missing "
976in expression "...12345678901234567890*["abcdefghijklmnopqrstuv..."}
977test parseExpr-21.58 {error message} -body {
978    expr "123456789012345678901234567890*\[\$\{abcdefghijklmnopqrstuvwxyz]"
979} -returnCodes error -result "missing close-brace for variable name
980in expression \"...2345678901234567890*\[\$\{abcdefghijklmnopqrstuv...\""
981test parseExpr-21.59 {error message} -body {
982    expr {123456789012345678901234567890*[$bar(abcdefghijklmnopqrstuvwxyz]}
983} -returnCodes error -result {missing )
984in expression "...5678901234567890*[$bar(abcdefghijklmnopqrstuv..."}
985test parseExpr-21.60 {error message} -body {
986    expr {123456789012345678901234567890*[{}abcdefghijklmnopqrstuvwxyz]"}
987} -returnCodes error -result {extra characters after close-brace
988in expression "...345678901234567890*[{}abcdefghijklmnopqrstuv..."}
989test parseExpr-21.61 {error message} -body {
990    expr {123456789012345678901234567890*[""abcdefghijklmnopqrstuvwxyz]"}
991} -returnCodes error -result {extra characters after close-quote
992in expression "...345678901234567890*[""abcdefghijklmnopqrstuv..."}
993test parseExpr-21.62 {error message} -body {
994    expr {123456789012345678901234567890*[abcdefghijklmnopqrstuvwxyz"}
995} -returnCodes error -result {missing close-bracket
996in expression "...012345678901234567890*[abcdefghijklmnopqrstuv..."}
997test parseExpr-21.63 {error message} -body {
998    expr "123456789012345678901234567890*\[\{abcdefghijklmnopqrstuvwxyz]"
999} -returnCodes error -result "missing close-brace
1000in expression \"...12345678901234567890*\[\{abcdefghijklmnopqrstuv...\""
1001
1002# cleanup
1003::tcltest::cleanupTests
1004return
Note: See TracBrowser for help on using the repository browser.