1 source [file dirname [info script]]/testing.tcl
3 test parse-1.1 "Quoted closing bracket" {
4 set x [string length "]"]
7 test parse-1.2 "Quoted opening bracket" {
8 set x [string length "\["]
11 test parse-1.3 "Quoted open brace" {
12 set x [string length "\{"]
15 test parse-1.4 "Quoted open brace via var" {
17 set x [string length "$lb"]
20 test parse-1.5 "Braced bracket" {
21 set x [string length {]}]
24 test parse-1.6 "Dict sugar" -body {
26 array set a {a 1 b 2 c 3}
28 } -returnCodes error -match glob -result "*"
30 test parse-1.8 "Dict sugar" {
32 array set a {a 1 b 2 c 3}
36 test parse-1.9 "Backslash newline" {
42 test parse-1.10 "Backslash newline in quotes" {
47 test parse-1.11 "Backslash newline in quotes after var" {
53 test parse-1.12 "Backslash newline in quotes after var" {
59 test parse-1.13 "Newline in quotes" {
65 test parse-1.14 "Newline in quotes after var" {
71 test parse-1.15 "Space in quotes" {
76 test parse-1.16 "Space in quotes after var" {
81 test parse-1.17 "Command and var in quotes" {
83 set x "[set z 2][set y]"
86 test parse-1.18 "Command and var in bare context" {
88 set x [set z 2][set y]
91 test parse-1.19 "Lone dollar sign in quotes" {
96 test parse-1.20 "Command and var in bare context" {
101 test parse-1.21 "Comment" {
103 # A comment one a line
104 set x [set y] ;# comment after semicolon
107 test parse-1.22 "# char" {
113 test parse-1.23 "newline in command" {
121 test parse-1.24 "semicolon in command" {
122 set x [list a; list b c; list d e f]
125 # Note that Tcl complains about the missing brace here
126 # while Jim ignores it
127 test parse-1.25 "missing brace in var" jim {
131 set x [subst \$${brace}a]
134 test parse-1.26 "newline in braced var" {
140 test parse-1.27 "backslash escape in dict sugar" {
146 test parse-1.28 "nested dict sugar" {
147 unset -nocomplain a b
154 set script "set x ${dq}hello"
156 test parse-1.29 "missing quote" -constraints jim -body {
158 } -returnCodes error -match glob -result {missing quote}
160 test parse-1.30 "missing quote" {
161 info complete $script
164 test parse-1.31 "backslash newline in bare context" {
169 test parse-1.32 "comment as last line of script" {
170 set script {set x 3; # this is a comment}
174 test parse-1.33 "upper case hex escapes" {
178 test parse-1.34 "octal escapes" {
182 test parse-1.35 "invalid hex escape" {
186 test parse-1.36 "unicode escape" jim {
190 test parse-1.37 "invalid unicode escape after unicode" jim {
194 test parse-1.38 "invalid unicode escape" {
198 test parse-1.39 "octal escape followed by invalid" {
202 test parse-1.40 "list containing quoted trailing backslash" jim {
207 test parse-1.41 "list containing quoted newline" {
213 test parse-1.42 "list containing missing quote" jim {
218 test parse-1.43 "list containing trailing backslash" {
223 test parse-1.44 "list creation" {
227 test parse-1.45 "spaces before expr function args" {
231 test parse-1.46 "expr function missing paren" {
232 catch {expr {round 3.2}}
235 test parse-1.47 "backslash newline in quotes" {
241 test parse-1.48 "backslash newline in quotes" {
247 test parse-1.49 "backslash newline in quotes" {
254 test parse-1.50 "backslash newline in quotes" {
260 test parse-1.51 "special chars in dict sugar" {
266 test parse-1.52 "special chars in dict sugar" {
270 test parse-1.53 "special chars in dict sugar" {
276 test parse-1.54 "special chars in dict sugar" {
280 test parse-1.55 "special chars in dict sugar" {
286 test parse-1.56 "special chars in dict sugar" {
290 test parse-1.57 "special chars in dict sugar" {
296 test parse-1.58 "special chars in dict sugar" {
300 test parse-1.59 "special chars in dict sugar" {
303 lindex [array names a] 0
306 test parse-1.60 "special chars in dict sugar" {
310 test parse-1.61 "quote in command" {
315 test parse-1.62 "quoted orphan dollar sign" {
319 test parse-1.63 "unquoted dollar sign" {
323 test parse-1.64 "backslash in comment" {
330 test parse-1.65 "double backslash in comment" {