os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/parse.test
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/parse.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,852 @@
     1.4 +# This file contains a collection of tests for the procedures in the
     1.5 +# file tclParse.c.  Sourcing this file into Tcl runs the tests and
     1.6 +# generates output for errors.  No output means no errors were found.
     1.7 +#
     1.8 +# Copyright (c) 1997 Sun Microsystems, Inc.
     1.9 +# Copyright (c) 1998-1999 by Scriptics Corporation.
    1.10 +#
    1.11 +# See the file "license.terms" for information on usage and redistribution
    1.12 +# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    1.13 +#
    1.14 +# RCS: @(#) $Id: parse.test,v 1.11.2.5 2006/03/07 05:30:24 dgp Exp $
    1.15 +
    1.16 +if {[lsearch [namespace children] ::tcltest] == -1} {
    1.17 +    package require tcltest 2
    1.18 +    namespace import -force ::tcltest::*
    1.19 +}
    1.20 +
    1.21 +if {[info commands testparser] == {}} {
    1.22 +    puts "This application hasn't been compiled with the \"testparser\""
    1.23 +    puts "command, so I can't test the Tcl parser."
    1.24 +    ::tcltest::cleanupTests
    1.25 +    return 
    1.26 +}
    1.27 +
    1.28 +test parse-1.1 {Tcl_ParseCommand procedure, computing string length} {
    1.29 +    testparser [bytestring "foo\0 bar"] -1
    1.30 +} {- foo 1 simple foo 1 text foo 0 {}}
    1.31 +test parse-1.2 {Tcl_ParseCommand procedure, computing string length} {
    1.32 +    testparser "foo bar" -1
    1.33 +} {- {foo bar} 2 simple foo 1 text foo 0 simple bar 1 text bar 0 {}}
    1.34 +test parse-1.3 {Tcl_ParseCommand procedure, leading space} {
    1.35 +    testparser "  \n\t   foo" 0
    1.36 +} {- foo 1 simple foo 1 text foo 0 {}}
    1.37 +test parse-1.4 {Tcl_ParseCommand procedure, leading space} {
    1.38 +    testparser "\f\r\vfoo" 0
    1.39 +} {- foo 1 simple foo 1 text foo 0 {}}
    1.40 +test parse-1.5 {Tcl_ParseCommand procedure, backslash-newline in leading space} {
    1.41 +    testparser "  \\\n foo" 0
    1.42 +} {- foo 1 simple foo 1 text foo 0 {}}
    1.43 +test parse-1.6 {Tcl_ParseCommand procedure, backslash-newline in leading space} {
    1.44 +    testparser {  \a foo} 0
    1.45 +} {- {\a foo} 2 word {\a} 1 backslash {\a} 0 simple foo 1 text foo 0 {}}
    1.46 +test parse-1.7 {Tcl_ParseCommand procedure, missing continuation line in leading space} {
    1.47 +    testparser "   \\\n" 0
    1.48 +} {- {} 0 {}}
    1.49 +test parse-1.8 {Tcl_ParseCommand procedure, eof in leading space} {
    1.50 +    testparser "      foo" 3
    1.51 +} {- {} 0 {   foo}}
    1.52 +
    1.53 +test parse-2.1 {Tcl_ParseCommand procedure, comments} {
    1.54 +    testparser "# foo bar\n foo" 0
    1.55 +} {{# foo bar
    1.56 +} foo 1 simple foo 1 text foo 0 {}}
    1.57 +test parse-2.2 {Tcl_ParseCommand procedure, several comments} {
    1.58 +    testparser " # foo bar\n # another comment\n\n   foo" 0
    1.59 +} {{# foo bar
    1.60 + # another comment
    1.61 +} foo 1 simple foo 1 text foo 0 {}}
    1.62 +test parse-2.3 {Tcl_ParseCommand procedure, backslash-newline in comments} {
    1.63 +    testparser " # foo bar\\\ncomment on continuation line\nfoo" 0
    1.64 +} {#\ foo\ bar\\\ncomment\ on\ continuation\ line\n foo 1 simple foo 1 text foo 0 {}}
    1.65 +test parse-2.4 {Tcl_ParseCommand procedure, missing continuation line in comment} {
    1.66 +    testparser "#   \\\n" 0
    1.67 +} {#\ \ \ \\\n {} 0 {}}
    1.68 +test parse-2.5 {Tcl_ParseCommand procedure, eof in comment} {
    1.69 +    testparser " # foo bar\nfoo" 8
    1.70 +} {{# foo b} {} 0 {ar
    1.71 +foo}}
    1.72 +
    1.73 +test parse-3.1 {Tcl_ParseCommand procedure, parsing words, skipping space} {
    1.74 +    testparser "foo  bar\t\tx" 0
    1.75 +} {- {foo  bar		x} 3 simple foo 1 text foo 0 simple bar 1 text bar 0 simple x 1 text x 0 {}}
    1.76 +test parse-3.2 {Tcl_ParseCommand procedure, missing continuation line in leading space} {
    1.77 +    testparser "abc  \\\n" 0
    1.78 +} {- abc\ \ \\\n 1 simple abc 1 text abc 0 {}}
    1.79 +test parse-3.3 {Tcl_ParseCommand procedure, parsing words, command ends in space} {
    1.80 +    testparser "foo  ;  bar x" 0
    1.81 +} {- {foo  ;} 1 simple foo 1 text foo 0 {  bar x}}
    1.82 +test parse-3.4 {Tcl_ParseCommand procedure, parsing words, command ends in space} {
    1.83 +    testparser "foo       " 5
    1.84 +} {- {foo  } 1 simple foo 1 text foo 0 {     }}
    1.85 +test parse-3.5 {Tcl_ParseCommand procedure, quoted words} {
    1.86 +    testparser {foo "a b c" d "efg";} 0
    1.87 +} {- {foo "a b c" d "efg";} 4 simple foo 1 text foo 0 simple {"a b c"} 1 text {a b c} 0 simple d 1 text d 0 simple {"efg"} 1 text efg 0 {}}
    1.88 +test parse-3.6 {Tcl_ParseCommand procedure, words in braces} {
    1.89 +    testparser {foo {a $b [concat foo]} {c d}} 0
    1.90 +} {- {foo {a $b [concat foo]} {c d}} 3 simple foo 1 text foo 0 simple {{a $b [concat foo]}} 1 text {a $b [concat foo]} 0 simple {{c d}} 1 text {c d} 0 {}}
    1.91 +test parse-3.7 {Tcl_ParseCommand procedure, error in unquoted word} {
    1.92 +    list [catch {testparser "foo \$\{abc" 0} msg] $msg $errorInfo
    1.93 +} {1 {missing close-brace for variable name} missing\ close-brace\ for\ variable\ name\n\ \ \ \ (remainder\ of\ script:\ \"\{abc\")\n\ \ \ \ invoked\ from\ within\n\"testparser\ \"foo\ \\\$\\\{abc\"\ 0\"}
    1.94 +
    1.95 +test parse-4.1 {Tcl_ParseCommand procedure, simple words} {
    1.96 +    testparser {foo} 0
    1.97 +} {- foo 1 simple foo 1 text foo 0 {}}
    1.98 +test parse-4.2 {Tcl_ParseCommand procedure, simple words} {
    1.99 +    testparser {{abc}} 0
   1.100 +} {- {{abc}} 1 simple {{abc}} 1 text abc 0 {}}
   1.101 +test parse-4.3 {Tcl_ParseCommand procedure, simple words} {
   1.102 +    testparser {"c d"} 0
   1.103 +} {- {"c d"} 1 simple {"c d"} 1 text {c d} 0 {}}
   1.104 +test parse-4.4 {Tcl_ParseCommand procedure, simple words} {
   1.105 +    testparser {x$d} 0
   1.106 +} {- {x$d} 1 word {x$d} 3 text x 0 variable {$d} 1 text d 0 {}}
   1.107 +test parse-4.5 {Tcl_ParseCommand procedure, simple words} {
   1.108 +    testparser {"a [foo] b"} 0
   1.109 +} {- {"a [foo] b"} 1 word {"a [foo] b"} 3 text {a } 0 command {[foo]} 0 text { b} 0 {}}
   1.110 +test parse-4.6 {Tcl_ParseCommand procedure, simple words} {
   1.111 +    testparser {$x} 0
   1.112 +} {- {$x} 1 word {$x} 2 variable {$x} 1 text x 0 {}}
   1.113 +
   1.114 +test parse-5.1 {Tcl_ParseCommand procedure, backslash-newline terminates word} {
   1.115 +    testparser "{abc}\\\n" 0
   1.116 +} {- \{abc\}\\\n 1 simple {{abc}} 1 text abc 0 {}}
   1.117 +test parse-5.2 {Tcl_ParseCommand procedure, backslash-newline terminates word} {
   1.118 +    testparser "foo\\\nbar" 0
   1.119 +} {- foo\\\nbar 2 simple foo 1 text foo 0 simple bar 1 text bar 0 {}}
   1.120 +test parse-5.3 {Tcl_ParseCommand procedure, word terminator is command terminator} {
   1.121 +    testparser "foo\n bar" 0
   1.122 +} {- {foo
   1.123 +} 1 simple foo 1 text foo 0 { bar}}
   1.124 +test parse-5.4 {Tcl_ParseCommand procedure, word terminator is command terminator} {
   1.125 +    testparser "foo; bar" 0
   1.126 +} {- {foo;} 1 simple foo 1 text foo 0 { bar}}
   1.127 +test parse-5.5 {Tcl_ParseCommand procedure, word terminator is end of string} {
   1.128 +    testparser "\"foo\" bar" 5
   1.129 +} {- {"foo"} 1 simple {"foo"} 1 text foo 0 { bar}}
   1.130 +test parse-5.6 {Tcl_ParseCommand procedure, junk after close quote} {
   1.131 +    list [catch {testparser {foo "bar"x} 0} msg] $msg $errorInfo
   1.132 +} {1 {extra characters after close-quote} {extra characters after close-quote
   1.133 +    (remainder of script: "x")
   1.134 +    invoked from within
   1.135 +"testparser {foo "bar"x} 0"}}
   1.136 +test parse-5.7 {Tcl_ParseCommand procedure, backslash-newline after close quote} {
   1.137 +    testparser "foo \"bar\"\\\nx" 0
   1.138 +} {- foo\ \"bar\"\\\nx 3 simple foo 1 text foo 0 simple {"bar"} 1 text bar 0 simple x 1 text x 0 {}}
   1.139 +test parse-5.8 {Tcl_ParseCommand procedure, junk after close brace} {
   1.140 +    list [catch {testparser {foo {bar}x} 0} msg] $msg $errorInfo
   1.141 +} {1 {extra characters after close-brace} {extra characters after close-brace
   1.142 +    (remainder of script: "x")
   1.143 +    invoked from within
   1.144 +"testparser {foo {bar}x} 0"}}
   1.145 +test parse-5.9 {Tcl_ParseCommand procedure, backslash-newline after close brace} {
   1.146 +    testparser "foo {bar}\\\nx" 0
   1.147 +} {- foo\ \{bar\}\\\nx 3 simple foo 1 text foo 0 simple {{bar}} 1 text bar 0 simple x 1 text x 0 {}}
   1.148 +test parse-5.10 {Tcl_ParseCommand procedure, multiple deletion of non-static buffer} {
   1.149 +    # This test is designed to catch bug 1681.
   1.150 +    list [catch {testparser "a \"\\1\\2\\3\\4\\5\\6\\7\\8\\9\\1\\2\\3\\4\\5\\6\\7\\8" 0} msg] $msg $errorInfo
   1.151 +} "1 {missing \"} {missing \"
   1.152 +    (remainder of script: \"\"\\1\\2\\3\\4\\5\\6\\7\\8\\9\\1\\2\\3\\4\\5\\6\\7\\8\")
   1.153 +    invoked from within
   1.154 +\"testparser \"a \\\"\\\\1\\\\2\\\\3\\\\4\\\\5\\\\6\\\\7\\\\8\\\\9\\\\1\\\\2\\\\3\\\\4\\\\5\\\\6\\\\7\\\\8\" 0\"}"
   1.155 +
   1.156 +test parse-6.1 {ParseTokens procedure, empty word} {
   1.157 +    testparser {""} 0
   1.158 +} {- {""} 1 simple {""} 1 text {} 0 {}}
   1.159 +test parse-6.2 {ParseTokens procedure, simple range} {
   1.160 +    testparser {"abc$x.e"} 0
   1.161 +} {- {"abc$x.e"} 1 word {"abc$x.e"} 4 text abc 0 variable {$x} 1 text x 0 text .e 0 {}}
   1.162 +test parse-6.3 {ParseTokens procedure, variable reference} {
   1.163 +    testparser {abc$x.e $y(z)} 0
   1.164 +} {- {abc$x.e $y(z)} 2 word {abc$x.e} 4 text abc 0 variable {$x} 1 text x 0 text .e 0 word {$y(z)} 3 variable {$y(z)} 2 text y 0 text z 0 {}}
   1.165 +test parse-6.4 {ParseTokens procedure, variable reference} {
   1.166 +    list [catch {testparser {$x([a )} 0} msg] $msg
   1.167 +} {1 {missing close-bracket}}
   1.168 +test parse-6.5 {ParseTokens procedure, command substitution} {
   1.169 +    testparser {[foo $x bar]z} 0
   1.170 +} {- {[foo $x bar]z} 1 word {[foo $x bar]z} 2 command {[foo $x bar]} 0 text z 0 {}}
   1.171 +test parse-6.6 {ParseTokens procedure, command substitution} {
   1.172 +    testparser {[foo \] [a b]]} 0
   1.173 +} {- {[foo \] [a b]]} 1 word {[foo \] [a b]]} 1 command {[foo \] [a b]]} 0 {}}
   1.174 +test parse-6.7 {ParseTokens procedure, error in command substitution} {
   1.175 +    list [catch {testparser {a [b {}c d] e} 0} msg] $msg $errorInfo
   1.176 +} {1 {extra characters after close-brace} {extra characters after close-brace
   1.177 +    (remainder of script: "c d] e")
   1.178 +    invoked from within
   1.179 +"testparser {a [b {}c d] e} 0"}}
   1.180 +test parse-6.8 {ParseTokens procedure, error in command substitution} {
   1.181 +    info complete {a [b {}c d]}
   1.182 +} {1}
   1.183 +test parse-6.9 {ParseTokens procedure, error in command substitution} {
   1.184 +    info complete {a [b "c d}
   1.185 +} {0}
   1.186 +test parse-6.10 {ParseTokens procedure, incomplete sub-command} {
   1.187 +    info complete {puts [
   1.188 +	expr 1+1
   1.189 +	#this is a comment ]}
   1.190 +} {0}
   1.191 +test parse-6.11 {ParseTokens procedure, memory allocation for big nested command} {
   1.192 +    testparser {[$a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b)]} 0
   1.193 +} {- {[$a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b)]} 1 word {[$a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b)]} 1 command {[$a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b)]} 0 {}}
   1.194 +test parse-6.12 {ParseTokens procedure, missing close bracket} {
   1.195 +    list [catch {testparser {[foo $x bar} 0} msg] $msg $errorInfo
   1.196 +} {1 {missing close-bracket} {missing close-bracket
   1.197 +    (remainder of script: "[foo $x bar")
   1.198 +    invoked from within
   1.199 +"testparser {[foo $x bar} 0"}}
   1.200 +test parse-6.13 {ParseTokens procedure, backslash-newline without continuation line} {
   1.201 +    list [catch {testparser "\"a b\\\n" 0} msg] $msg $errorInfo
   1.202 +} {1 {missing "} missing\ \"\n\ \ \ \ (remainder\ of\ script:\ \"\"a\ b\\\n\")\n\ \ \ \ invoked\ from\ within\n\"testparser\ \"\\\"a\ b\\\\\\n\"\ 0\"}
   1.203 +test parse-6.14 {ParseTokens procedure, backslash-newline} {
   1.204 +    testparser "b\\\nc" 0
   1.205 +} {- b\\\nc 2 simple b 1 text b 0 simple c 1 text c 0 {}}
   1.206 +test parse-6.15 {ParseTokens procedure, backslash-newline} {
   1.207 +    testparser "\"b\\\nc\"" 0
   1.208 +} {- \"b\\\nc\" 1 word \"b\\\nc\" 3 text b 0 backslash \\\n 0 text c 0 {}}
   1.209 +test parse-6.16 {ParseTokens procedure, backslash substitution} {
   1.210 +    testparser {\n\a\x7f} 0
   1.211 +} {- {\n\a\x7f} 1 word {\n\a\x7f} 3 backslash {\n} 0 backslash {\a} 0 backslash {\x7f} 0 {}}
   1.212 +test parse-6.17 {ParseTokens procedure, null characters} {
   1.213 +    testparser [bytestring "foo\0zz"] 0
   1.214 +} "- [bytestring foo\0zz] 1 word [bytestring foo\0zz] 3 text foo 0 text [bytestring \0] 0 text zz 0 {}"
   1.215 +test parse-6.18 {ParseTokens procedure, seek past numBytes for close-bracket} {
   1.216 +    # Test for Bug 681841
   1.217 +    list [catch {testparser {[a]} 2} msg] $msg
   1.218 +} {1 {missing close-bracket}}
   1.219 +
   1.220 +test parse-7.1 {Tcl_FreeParse and ExpandTokenArray procedures} {
   1.221 +    testparser {$a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) } 0
   1.222 +} {- {$a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) $a(b) } 16 word {$a(b)} 3 variable {$a(b)} 2 text a 0 text b 0 word {$a(b)} 3 variable {$a(b)} 2 text a 0 text b 0 word {$a(b)} 3 variable {$a(b)} 2 text a 0 text b 0 word {$a(b)} 3 variable {$a(b)} 2 text a 0 text b 0 word {$a(b)} 3 variable {$a(b)} 2 text a 0 text b 0 word {$a(b)} 3 variable {$a(b)} 2 text a 0 text b 0 word {$a(b)} 3 variable {$a(b)} 2 text a 0 text b 0 word {$a(b)} 3 variable {$a(b)} 2 text a 0 text b 0 word {$a(b)} 3 variable {$a(b)} 2 text a 0 text b 0 word {$a(b)} 3 variable {$a(b)} 2 text a 0 text b 0 word {$a(b)} 3 variable {$a(b)} 2 text a 0 text b 0 word {$a(b)} 3 variable {$a(b)} 2 text a 0 text b 0 word {$a(b)} 3 variable {$a(b)} 2 text a 0 text b 0 word {$a(b)} 3 variable {$a(b)} 2 text a 0 text b 0 word {$a(b)} 3 variable {$a(b)} 2 text a 0 text b 0 word {$a(b)} 3 variable {$a(b)} 2 text a 0 text b 0 {}}
   1.223 +
   1.224 +testConstraint testevalobjv [llength [info commands testevalobjv]]
   1.225 +testConstraint testevalex [llength [info commands testevalex]]
   1.226 +test parse-8.1 {Tcl_EvalObjv procedure} testevalobjv {
   1.227 +    testevalobjv 0 concat this is a test
   1.228 +} {this is a test}
   1.229 +test parse-8.2 {Tcl_EvalObjv procedure, unknown commands} testevalobjv {
   1.230 +    rename unknown unknown.old
   1.231 +    set x [catch {testevalobjv 10 asdf poiu} msg]
   1.232 +    rename unknown.old unknown
   1.233 +    list $x $msg
   1.234 +} {1 {invalid command name "asdf"}}
   1.235 +test parse-8.3 {Tcl_EvalObjv procedure, unknown commands} testevalobjv {
   1.236 +    rename unknown unknown.old
   1.237 +    proc unknown args {
   1.238 +	return "unknown $args"
   1.239 +    }
   1.240 +    set x [catch {testevalobjv 0 asdf poiu} msg]
   1.241 +    rename unknown {}
   1.242 +    rename unknown.old unknown
   1.243 +    list $x $msg
   1.244 +} {0 {unknown asdf poiu}}
   1.245 +test parse-8.4 {Tcl_EvalObjv procedure, unknown commands} testevalobjv {
   1.246 +    rename unknown unknown.old
   1.247 +    proc unknown args {
   1.248 +	error "I don't like that command"
   1.249 +    }
   1.250 +    set x [catch {testevalobjv 0 asdf poiu} msg]
   1.251 +    rename unknown {}
   1.252 +    rename unknown.old unknown
   1.253 +    list $x $msg
   1.254 +} {1 {I don't like that command}}
   1.255 +test parse-8.5 {Tcl_EvalObjv procedure, command traces} testevalobjv {
   1.256 +    testevalobjv 0 set x 123
   1.257 +    testcmdtrace tracetest {testevalobjv 0 set x $x}
   1.258 +} {{testevalobjv 0 set x $x} {testevalobjv 0 set x 123} {set x 123} {set x 123}}
   1.259 +test parse-8.7 {Tcl_EvalObjv procedure, TCL_EVAL_GLOBAL flag} testevalobjv {
   1.260 +    proc x {} {
   1.261 +	set y 23
   1.262 +	set z [testevalobjv 1 set y]
   1.263 +	return [list $z $y]
   1.264 +    }
   1.265 +    catch {unset y}
   1.266 +    set y 16
   1.267 +    x
   1.268 +} {16 23}
   1.269 +test parse-8.8 {Tcl_EvalObjv procedure, async handlers} testevalobjv {
   1.270 +    proc async1 {result code} {
   1.271 +	global aresult acode
   1.272 +	set aresult $result
   1.273 +	set acode $code
   1.274 +	return "new result"
   1.275 +    }
   1.276 +    set handler1 [testasync create async1]
   1.277 +    set aresult xxx
   1.278 +    set acode yyy
   1.279 +    set x [list [catch [list testevalobjv 0 testasync mark $handler1 original 0] msg] $msg $acode $aresult]
   1.280 +    testasync delete
   1.281 +    set x
   1.282 +} {0 {new result} 0 original}
   1.283 +test parse-8.9 {Tcl_EvalObjv procedure, exceptional return} testevalobjv {
   1.284 +    list [catch {testevalobjv 0 error message} msg] $msg
   1.285 +} {1 message}
   1.286 +test parse-8.10 {Tcl_EvalObjv procedure, TCL_EVAL_GLOBAL} testevalobjv {
   1.287 +    rename ::unknown unknown.save
   1.288 +    proc ::unknown args {lappend ::info [info level]}
   1.289 +    catch {rename ::noSuchCommand {}}
   1.290 +    set ::info {}
   1.291 +    namespace eval test_ns_1 {
   1.292 +	testevalobjv 1 noSuchCommand
   1.293 +	uplevel #0 noSuchCommand
   1.294 +    }
   1.295 +    namespace delete test_ns_1
   1.296 +    rename ::unknown {}
   1.297 +    rename unknown.save ::unknown
   1.298 +    set ::info
   1.299 +} {1 1}
   1.300 +test parse-8.11 {Tcl_EvalObjv procedure, TCL_EVAL_INVOKE} testevalobjv {
   1.301 +    rename ::unknown unknown.save
   1.302 +    proc ::unknown args {lappend ::info [info level]; uplevel 1 foo}
   1.303 +    proc ::foo args {lappend ::info global}
   1.304 +    catch {rename ::noSuchCommand {}}
   1.305 +    set ::slave [interp create]
   1.306 +    $::slave alias bar noSuchCommand
   1.307 +    set ::info {}
   1.308 +    namespace eval test_ns_1 {
   1.309 +	proc foo args {lappend ::info namespace}
   1.310 +	$::slave eval bar
   1.311 +	testevalobjv 1 [list $::slave eval bar]
   1.312 +	uplevel #0 [list $::slave eval bar]
   1.313 +    }
   1.314 +    namespace delete test_ns_1
   1.315 +    rename ::foo {}
   1.316 +    rename ::unknown {}
   1.317 +    rename unknown.save ::unknown
   1.318 +    set ::info
   1.319 +} [subst {[set level 2; incr level [info level]] global 1 global 1 global}]
   1.320 +test parse-8.12 {Tcl_EvalObjv procedure, TCL_EVAL_INVOKE} {
   1.321 +    set ::auto_index(noSuchCommand) {
   1.322 +	proc noSuchCommand {} {lappend ::info global}
   1.323 +    }
   1.324 +    set ::auto_index(::[string trimleft [namespace current]::test_ns_1::noSuchCommand :]) [list \
   1.325 +	proc [namespace current]::test_ns_1::noSuchCommand {} {
   1.326 +	    lappend ::info ns
   1.327 +	}]
   1.328 +    catch {rename ::noSuchCommand {}}
   1.329 +    set ::slave [interp create]
   1.330 +    $::slave alias bar noSuchCommand
   1.331 +    set ::info {}
   1.332 +    namespace eval test_ns_1 {
   1.333 +	$::slave eval bar
   1.334 +    }
   1.335 +    namespace delete test_ns_1
   1.336 +    interp delete $::slave
   1.337 +    catch {rename ::noSuchCommand {}}
   1.338 +    set ::info
   1.339 +} global
   1.340 +
   1.341 +test parse-9.1 {Tcl_LogCommandInfo, line numbers} {
   1.342 +    catch {unset x}
   1.343 +    list [catch {testevalex {for {} 1 {} {
   1.344 +
   1.345 +
   1.346 +	# asdf
   1.347 +	set x
   1.348 +    }}}] $errorInfo
   1.349 +} {1 {can't read "x": no such variable
   1.350 +    while executing
   1.351 +"set x"
   1.352 +    ("for" body line 5)
   1.353 +    invoked from within
   1.354 +"for {} 1 {} {
   1.355 +
   1.356 +
   1.357 +	# asdf
   1.358 +	set x
   1.359 +    }"
   1.360 +    invoked from within
   1.361 +"testevalex {for {} 1 {} {
   1.362 +
   1.363 +
   1.364 +	# asdf
   1.365 +	set x
   1.366 +    }}"}}
   1.367 +test parse-9.2 {Tcl_LogCommandInfo, truncating long commands} {
   1.368 +    list [testevalex {catch {set a b 111111111 222222222 333333333 444444444 555555555 666666666 777777777 888888888 999999999 000000000 aaaaaaaaa bbbbbbbbb ccccccccc ddddddddd eeeeeeeee fffffffff ggggggggg}}] $errorInfo
   1.369 +} {1 {wrong # args: should be "set varName ?newValue?"
   1.370 +    while executing
   1.371 +"set a b 111111111 222222222 333333333 444444444 555555555 666666666 777777777 888888888 999999999 000000000 aaaaaaaaa bbbbbbbbb ccccccccc ddddddddd ee..."}}
   1.372 +
   1.373 +test parse-10.1 {Tcl_EvalTokens, simple text} {
   1.374 +    testevalex {concat test}
   1.375 +} {test}
   1.376 +test parse-10.2 {Tcl_EvalTokens, backslash sequences} {
   1.377 +    testevalex {concat test\063\062test}
   1.378 +} {test32test}
   1.379 +test parse-10.3 {Tcl_EvalTokens, nested commands} {
   1.380 +    testevalex {concat [expr 2 + 6]}
   1.381 +} {8}
   1.382 +test parse-10.4 {Tcl_EvalTokens, nested commands} {
   1.383 +    catch {unset a}
   1.384 +    list [catch {testevalex {concat xxx[expr $a]}} msg] $msg
   1.385 +} {1 {can't read "a": no such variable}}
   1.386 +test parse-10.5 {Tcl_EvalTokens, simple variables} {
   1.387 +    set a hello
   1.388 +    testevalex {concat $a}
   1.389 +} {hello}
   1.390 +test parse-10.6 {Tcl_EvalTokens, array variables} {
   1.391 +    catch {unset a}
   1.392 +    set a(12) 46
   1.393 +    testevalex {concat $a(12)}
   1.394 +} {46}
   1.395 +test parse-10.7 {Tcl_EvalTokens, array variables} {
   1.396 +    catch {unset a}
   1.397 +    set a(12) 46
   1.398 +    testevalex {concat $a(1[expr 3 - 1])}
   1.399 +} {46}
   1.400 +test parse-10.8 {Tcl_EvalTokens, array variables} {
   1.401 +    catch {unset a}
   1.402 +    list [catch {testevalex {concat $x($a)}} msg] $msg
   1.403 +} {1 {can't read "a": no such variable}}
   1.404 +test parse-10.9 {Tcl_EvalTokens, array variables} {
   1.405 +    catch {unset a}
   1.406 +    list [catch {testevalex {concat xyz$a(1)}} msg] $msg
   1.407 +} {1 {can't read "a(1)": no such variable}}
   1.408 +test parse-10.10 {Tcl_EvalTokens, object values} {
   1.409 +    set a 123
   1.410 +    testevalex {concat $a}
   1.411 +} {123}
   1.412 +test parse-10.11 {Tcl_EvalTokens, object values} {
   1.413 +    set a 123
   1.414 +    testevalex {concat $a$a$a}
   1.415 +} {123123123}
   1.416 +test parse-10.12 {Tcl_EvalTokens, object values} {
   1.417 +    testevalex {concat [expr 2][expr 4][expr 6]}
   1.418 +} {246}
   1.419 +test parse-10.13 {Tcl_EvalTokens, string values} {
   1.420 +    testevalex {concat {a" b"}}
   1.421 +} {a" b"}
   1.422 +test parse-10.14 {Tcl_EvalTokens, string values} {
   1.423 +    set a 111
   1.424 +    testevalex {concat x$a.$a.$a}
   1.425 +} {x111.111.111}
   1.426 +
   1.427 +test parse-11.1 {Tcl_EvalEx, TCL_EVAL_GLOBAL flag} {
   1.428 +    proc x {} {
   1.429 +	set y 777
   1.430 +	set z [testevalex "set y" global]
   1.431 +	return [list $z $y]
   1.432 +    }
   1.433 +    catch {unset y}
   1.434 +    set y 321
   1.435 +    x
   1.436 +} {321 777}
   1.437 +test parse-11.2 {Tcl_EvalEx, error while parsing} {
   1.438 +    list [catch {testevalex {concat "abc}} msg] $msg
   1.439 +} {1 {missing "}}
   1.440 +test parse-11.3 {Tcl_EvalEx, error while collecting words} {
   1.441 +    catch {unset a}
   1.442 +    list [catch {testevalex {concat xyz $a}} msg] $msg
   1.443 +} {1 {can't read "a": no such variable}}
   1.444 +test parse-11.4 {Tcl_EvalEx, error in Tcl_EvalObjv call} {
   1.445 +    catch {unset a}
   1.446 +    list [catch {testevalex {_bogus_ a b c d}} msg] $msg
   1.447 +} {1 {invalid command name "_bogus_"}}
   1.448 +test parse-11.5 {Tcl_EvalEx, exceptional return} {
   1.449 +    list [catch {testevalex {break}} msg] $msg
   1.450 +} {3 {}}
   1.451 +test parse-11.6 {Tcl_EvalEx, freeing memory} {
   1.452 +    testevalex {concat a b c d e f g h i j k l m n o p q r s t u v w x y z}
   1.453 +} {a b c d e f g h i j k l m n o p q r s t u v w x y z}
   1.454 +test parse-11.7 {Tcl_EvalEx, multiple commands in script} {
   1.455 +    list [testevalex {set a b; set c d}] $a $c
   1.456 +} {d b d}
   1.457 +test parse-11.8 {Tcl_EvalEx, multiple commands in script} {
   1.458 +    list [testevalex {
   1.459 +	set a b
   1.460 +	set c d
   1.461 +    }] $a $c
   1.462 +} {d b d}
   1.463 +test parse-11.9 {Tcl_EvalEx, freeing memory after error} {
   1.464 +    catch {unset a}
   1.465 +    list [catch {testevalex {concat a b c d e f g h i j k l m n o p q r s t u v w x y z $a}} msg] $msg
   1.466 +} {1 {can't read "a": no such variable}}
   1.467 +test parse-11.10 {Tcl_EvalTokens, empty commands} {
   1.468 +    testevalex {concat xyz;   }
   1.469 +} {xyz}
   1.470 +test parse-11.11 {Tcl_EvalTokens, empty commands} {
   1.471 +    testevalex "concat abc; ; # this is a comment\n"
   1.472 +} {abc}
   1.473 +test parse-11.12 {Tcl_EvalTokens, empty commands} {
   1.474 +    testevalex {}
   1.475 +} {}
   1.476 +
   1.477 +test parse-12.1 {Tcl_ParseVarName procedure, initialization} {
   1.478 +    list [catch {testparsevarname {$a([first second])} 8 0} msg] $msg
   1.479 +} {1 {missing close-bracket}}
   1.480 +test parse-12.2 {Tcl_ParseVarName procedure, initialization} {
   1.481 +    testparsevarname {$a([first second])} 0 0
   1.482 +} {- {} 0 variable {$a([first second])} 2 text a 0 command {[first second]} 0 {}}
   1.483 +test parse-12.3 {Tcl_ParseVarName procedure, initialization} {
   1.484 +    list [catch {testparsevarname {$abcd} 3 0} msg] $msg
   1.485 +} {0 {- {} 0 variable {$ab} 1 text ab 0 cd}}
   1.486 +test parse-12.4 {Tcl_ParseVarName procedure, initialization} {
   1.487 +    testparsevarname {$abcd} 0 0
   1.488 +} {- {} 0 variable {$abcd} 1 text abcd 0 {}}
   1.489 +test parse-12.5 {Tcl_ParseVarName procedure, just a dollar sign} {
   1.490 +    testparsevarname {$abcd} 1 0
   1.491 +} {- {} 0 text {$} 0 abcd}
   1.492 +test parse-12.6 {Tcl_ParseVarName procedure, braced variable name} {
   1.493 +    testparser {${..[]b}cd} 0
   1.494 +} {- {${..[]b}cd} 1 word {${..[]b}cd} 3 variable {${..[]b}} 1 text {..[]b} 0 text cd 0 {}}
   1.495 +test parse-12.7 {Tcl_ParseVarName procedure, braced variable name} {
   1.496 +    testparser "\$\{\{\} " 0
   1.497 +} {- \$\{\{\}\  1 word \$\{\{\} 2 variable \$\{\{\} 1 text \{ 0 {}}
   1.498 +test parse-12.8 {Tcl_ParseVarName procedure, missing close brace} {
   1.499 +    list [catch {testparser "$\{abc" 0} msg] $msg $errorInfo
   1.500 +} {1 {missing close-brace for variable name} missing\ close-brace\ for\ variable\ name\n\ \ \ \ (remainder\ of\ script:\ \"\{abc\")\n\ \ \ \ invoked\ from\ within\n\"testparser\ \"\$\\\{abc\"\ 0\"}
   1.501 +test parse-12.9 {Tcl_ParseVarName procedure, missing close brace} {
   1.502 +    list [catch {testparsevarname {${bcd}} 4 0} msg] $msg
   1.503 +} {1 {missing close-brace for variable name}}
   1.504 +test parse-12.10 {Tcl_ParseVarName procedure, missing close brace} {
   1.505 +    list [catch {testparsevarname {${bc}} 4 0} msg] $msg
   1.506 +} {1 {missing close-brace for variable name}}
   1.507 +test parse-12.11 {Tcl_ParseVarName procedure, simple variable name} {
   1.508 +    testparser {$az_AZ.} 0
   1.509 +} {- {$az_AZ.} 1 word {$az_AZ.} 3 variable {$az_AZ} 1 text az_AZ 0 text . 0 {}}
   1.510 +test parse-12.12 {Tcl_ParseVarName procedure, simple variable name} {
   1.511 +    testparser {$abcdefg} 4
   1.512 +} {- {$abc} 1 word {$abc} 2 variable {$abc} 1 text abc 0 defg}
   1.513 +test parse-12.13 {Tcl_ParseVarName procedure, simple variable name with ::} {
   1.514 +    testparser {$xyz::ab:c} 0
   1.515 +} {- {$xyz::ab:c} 1 word {$xyz::ab:c} 3 variable {$xyz::ab} 1 text xyz::ab 0 text :c 0 {}}
   1.516 +test parse-12.14 {Tcl_ParseVarName procedure, variable names with many colons} {
   1.517 +    testparser {$xyz:::::c} 0
   1.518 +} {- {$xyz:::::c} 1 word {$xyz:::::c} 2 variable {$xyz:::::c} 1 text xyz:::::c 0 {}}
   1.519 +test parse-12.15 {Tcl_ParseVarName procedure, : vs. ::} {
   1.520 +    testparsevarname {$ab:cd} 0 0
   1.521 +} {- {} 0 variable {$ab} 1 text ab 0 :cd}
   1.522 +test parse-12.16 {Tcl_ParseVarName procedure, eof in ::} {
   1.523 +    testparsevarname {$ab::cd} 4 0
   1.524 +} {- {} 0 variable {$ab} 1 text ab 0 ::cd}
   1.525 +test parse-12.17 {Tcl_ParseVarName procedure, eof in ::} {
   1.526 +    testparsevarname {$ab:::cd} 5 0
   1.527 +} {- {} 0 variable {$ab::} 1 text ab:: 0 :cd}
   1.528 +test parse-12.18 {Tcl_ParseVarName procedure, no variable name} {
   1.529 +    testparser {$$ $.} 0
   1.530 +} {- {$$ $.} 2 word {$$} 2 text {$} 0 text {$} 0 word {$.} 2 text {$} 0 text . 0 {}}
   1.531 +test parse-12.19 {Tcl_ParseVarName procedure, EOF before (} {
   1.532 +    testparsevarname {$ab(cd)} 3 0
   1.533 +} {- {} 0 variable {$ab} 1 text ab 0 (cd)}
   1.534 +test parse-12.20 {Tcl_ParseVarName procedure, array reference} {
   1.535 +    testparser {$x(abc)} 0
   1.536 +} {- {$x(abc)} 1 word {$x(abc)} 3 variable {$x(abc)} 2 text x 0 text abc 0 {}}
   1.537 +test parse-12.21 {Tcl_ParseVarName procedure, array reference} {
   1.538 +    testparser {$x(ab$cde[foo bar])} 0
   1.539 +} {- {$x(ab$cde[foo bar])} 1 word {$x(ab$cde[foo bar])} 6 variable {$x(ab$cde[foo bar])} 5 text x 0 text ab 0 variable {$cde} 1 text cde 0 command {[foo bar]} 0 {}}
   1.540 +test parse-12.22 {Tcl_ParseVarName procedure, array reference} {
   1.541 +    testparser {$x([cmd arg]zz)} 0
   1.542 +} {- {$x([cmd arg]zz)} 1 word {$x([cmd arg]zz)} 4 variable {$x([cmd arg]zz)} 3 text x 0 command {[cmd arg]} 0 text zz 0 {}}
   1.543 +test parse-12.23 {Tcl_ParseVarName procedure, missing close paren in array reference} {
   1.544 +    list [catch {testparser {$x(poiu} 0} msg] $msg $errorInfo
   1.545 +} {1 {missing )} {missing )
   1.546 +    (remainder of script: "(poiu")
   1.547 +    invoked from within
   1.548 +"testparser {$x(poiu} 0"}}
   1.549 +test parse-12.24 {Tcl_ParseVarName procedure, missing close paren in array reference} {
   1.550 +    list [catch {testparsevarname {$ab(cd)} 6 0} msg] $msg $errorInfo
   1.551 +} {1 {missing )} {missing )
   1.552 +    (remainder of script: "(cd)")
   1.553 +    invoked from within
   1.554 +"testparsevarname {$ab(cd)} 6 0"}}
   1.555 +test parse-12.25 {Tcl_ParseVarName procedure, nested array reference} {
   1.556 +    testparser {$x(a$y(b$z))} 0
   1.557 +} {- {$x(a$y(b$z))} 1 word {$x(a$y(b$z))} 8 variable {$x(a$y(b$z))} 7 text x 0 text a 0 variable {$y(b$z)} 4 text y 0 text b 0 variable {$z} 1 text z 0 {}}
   1.558 +
   1.559 +test parse-13.1 {Tcl_ParseVar procedure} {
   1.560 +    set abc 24
   1.561 +    testparsevar {$abc.fg}
   1.562 +} {24 .fg}
   1.563 +test parse-13.2 {Tcl_ParseVar procedure, no variable name} {
   1.564 +    testparsevar {$}
   1.565 +} {{$} {}}
   1.566 +test parse-13.3 {Tcl_ParseVar procedure, no variable name} {
   1.567 +    testparsevar {$.123}
   1.568 +} {{$} .123}
   1.569 +test parse-13.4 {Tcl_ParseVar procedure, error looking up variable} {
   1.570 +    catch {unset abc}
   1.571 +    list [catch {testparsevar {$abc}} msg] $msg
   1.572 +} {1 {can't read "abc": no such variable}}
   1.573 +test parse-13.5 {Tcl_ParseVar procedure, error looking up variable} {
   1.574 +    catch {unset abc}
   1.575 +    list [catch {testparsevar {$abc([bogus x y z])}} msg] $msg
   1.576 +} {1 {invalid command name "bogus"}}
   1.577 +
   1.578 +test parse-14.1 {Tcl_ParseBraces procedure, computing string length} {
   1.579 +    testparser [bytestring "foo\0 bar"] -1
   1.580 +} {- foo 1 simple foo 1 text foo 0 {}}
   1.581 +test parse-14.2 {Tcl_ParseBraces procedure, computing string length} {
   1.582 +    testparser "foo bar" -1
   1.583 +} {- {foo bar} 2 simple foo 1 text foo 0 simple bar 1 text bar 0 {}}
   1.584 +test parse-14.3 {Tcl_ParseBraces procedure, words in braces} {
   1.585 +    testparser {foo {a $b [concat foo]} {c d}} 0
   1.586 +} {- {foo {a $b [concat foo]} {c d}} 3 simple foo 1 text foo 0 simple {{a $b [concat foo]}} 1 text {a $b [concat foo]} 0 simple {{c d}} 1 text {c d} 0 {}}
   1.587 +test parse-14.4 {Tcl_ParseBraces procedure, empty nested braces} {
   1.588 +    testparser {foo {{}}} 0
   1.589 +} {- {foo {{}}} 2 simple foo 1 text foo 0 simple {{{}}} 1 text {{}} 0 {}}
   1.590 +test parse-14.5 {Tcl_ParseBraces procedure, nested braces} {
   1.591 +    testparser {foo {{a {b} c} {} {d e}}} 0
   1.592 +} {- {foo {{a {b} c} {} {d e}}} 2 simple foo 1 text foo 0 simple {{{a {b} c} {} {d e}}} 1 text {{a {b} c} {} {d e}} 0 {}}
   1.593 +test parse-14.6 {Tcl_ParseBraces procedure, backslashes in words in braces} {
   1.594 +    testparser "foo {a \\n\\\{}" 0
   1.595 +} {- {foo {a \n\{}} 2 simple foo 1 text foo 0 simple {{a \n\{}} 1 text {a \n\{} 0 {}}
   1.596 +test parse-14.7 {Tcl_ParseBraces procedure, missing continuation line in braces} {
   1.597 +    list [catch {testparser "\{abc\\\n" 0} msg] $msg $errorInfo
   1.598 +} {1 {missing close-brace} missing\ close-brace\n\ \ \ \ (remainder\ of\ script:\ \"\{abc\\\n\")\n\ \ \ \ invoked\ from\ within\n\"testparser\ \"\\\{abc\\\\\\n\"\ 0\"}
   1.599 +test parse-14.8 {Tcl_ParseBraces procedure, backslash-newline in braces} {
   1.600 +    testparser "foo {\\\nx}" 0
   1.601 +} {- foo\ \{\\\nx\} 2 simple foo 1 text foo 0 word \{\\\nx\} 2 backslash \\\n 0 text x 0 {}}
   1.602 +test parse-14.9 {Tcl_ParseBraces procedure, backslash-newline in braces} {
   1.603 +    testparser "foo {a \\\n   b}" 0
   1.604 +} {- foo\ \{a\ \\\n\ \ \ b\} 2 simple foo 1 text foo 0 word \{a\ \\\n\ \ \ b\} 3 text {a } 0 backslash \\\n\ \ \  0 text b 0 {}}
   1.605 +test parse-14.10 {Tcl_ParseBraces procedure, backslash-newline in braces} {
   1.606 +    testparser "foo {xyz\\\n }" 0
   1.607 +} {- foo\ \{xyz\\\n\ \} 2 simple foo 1 text foo 0 word \{xyz\\\n\ \} 2 text xyz 0 backslash \\\n\  0 {}}
   1.608 +test parse-14.11 {Tcl_ParseBraces procedure, empty braced string} {
   1.609 +    testparser {foo {}} 0
   1.610 +} {- {foo {}} 2 simple foo 1 text foo 0 simple {{}} 1 text {} 0 {}}
   1.611 +test parse-14.12 {Tcl_ParseBraces procedure, missing close brace} {
   1.612 +    list [catch {testparser "foo \{xy\\\nz" 0} msg] $msg $errorInfo
   1.613 +} {1 {missing close-brace} missing\ close-brace\n\ \ \ \ (remainder\ of\ script:\ \"\{xy\\\nz\")\n\ \ \ \ invoked\ from\ within\n\"testparser\ \"foo\ \\\{xy\\\\\\nz\"\ 0\"}
   1.614 +
   1.615 +test parse-15.1 {Tcl_ParseQuotedString procedure, computing string length} {
   1.616 +    testparser [bytestring "foo\0 bar"] -1
   1.617 +} {- foo 1 simple foo 1 text foo 0 {}}
   1.618 +test parse-15.2 {Tcl_ParseQuotedString procedure, computing string length} {
   1.619 +    testparser "foo bar" -1
   1.620 +} {- {foo bar} 2 simple foo 1 text foo 0 simple bar 1 text bar 0 {}}
   1.621 +test parse-15.3 {Tcl_ParseQuotedString procedure, word is quoted string} {
   1.622 +    testparser {foo "a b c" d "efg";} 0
   1.623 +} {- {foo "a b c" d "efg";} 4 simple foo 1 text foo 0 simple {"a b c"} 1 text {a b c} 0 simple d 1 text d 0 simple {"efg"} 1 text efg 0 {}}
   1.624 +test parse-15.4 {Tcl_ParseQuotedString procedure, garbage after quoted string} {
   1.625 +    list [catch {testparser {foo "a b c"d} 0} msg] $msg $errorInfo
   1.626 +} {1 {extra characters after close-quote} {extra characters after close-quote
   1.627 +    (remainder of script: "d")
   1.628 +    invoked from within
   1.629 +"testparser {foo "a b c"d} 0"}}
   1.630 +
   1.631 +test parse-15.5 {CommandComplete procedure} {
   1.632 +    info complete ""
   1.633 +} 1
   1.634 +test parse-15.6 {CommandComplete procedure} {
   1.635 +    info complete "  \n"
   1.636 +} 1
   1.637 +test parse-15.7 {CommandComplete procedure} {
   1.638 +    info complete "abc def"
   1.639 +} 1
   1.640 +test parse-15.8 {CommandComplete procedure} {
   1.641 +    info complete "a b c d e f \t\n"
   1.642 +} 1
   1.643 +test parse-15.9 {CommandComplete procedure} {
   1.644 +    info complete {a b c"d}
   1.645 +} 1
   1.646 +test parse-15.10 {CommandComplete procedure} {
   1.647 +    info complete {a b "c d" e}
   1.648 +} 1
   1.649 +test parse-15.11 {CommandComplete procedure} {
   1.650 +    info complete {a b "c d"}
   1.651 +} 1
   1.652 +test parse-15.12 {CommandComplete procedure} {
   1.653 +    info complete {a b "c d"}
   1.654 +} 1
   1.655 +test parse-15.13 {CommandComplete procedure} {
   1.656 +    info complete {a b "c d}
   1.657 +} 0
   1.658 +test parse-15.14 {CommandComplete procedure} {
   1.659 +    info complete {a b "}
   1.660 +} 0
   1.661 +test parse-15.15 {CommandComplete procedure} {
   1.662 +    info complete {a b "cd"xyz}
   1.663 +} 1
   1.664 +test parse-15.16 {CommandComplete procedure} {
   1.665 +    info complete {a b "c $d() d"}
   1.666 +} 1
   1.667 +test parse-15.17 {CommandComplete procedure} {
   1.668 +    info complete {a b "c $dd("}
   1.669 +} 0
   1.670 +test parse-15.18 {CommandComplete procedure} {
   1.671 +    info complete {a b "c \"}
   1.672 +} 0
   1.673 +test parse-15.19 {CommandComplete procedure} {
   1.674 +    info complete {a b "c [d e f]"}
   1.675 +} 1
   1.676 +test parse-15.20 {CommandComplete procedure} {
   1.677 +    info complete {a b "c [d e f] g"}
   1.678 +} 1
   1.679 +test parse-15.21 {CommandComplete procedure} {
   1.680 +    info complete {a b "c [d e f"}
   1.681 +} 0
   1.682 +test parse-15.22 {CommandComplete procedure} {
   1.683 +    info complete {a {b c d} e}
   1.684 +} 1
   1.685 +test parse-15.23 {CommandComplete procedure} {
   1.686 +    info complete {a {b c d}}
   1.687 +} 1
   1.688 +test parse-15.24 {CommandComplete procedure} {
   1.689 +    info complete "a b\{c d"
   1.690 +} 1
   1.691 +test parse-15.25 {CommandComplete procedure} {
   1.692 +    info complete "a b \{c"
   1.693 +} 0
   1.694 +test parse-15.26 {CommandComplete procedure} {
   1.695 +    info complete "a b \{c{ }"
   1.696 +} 0
   1.697 +test parse-15.27 {CommandComplete procedure} {
   1.698 +    info complete "a b {c d e}xxx"
   1.699 +} 1
   1.700 +test parse-15.28 {CommandComplete procedure} {
   1.701 +    info complete "a b {c \\\{d e}xxx"
   1.702 +} 1
   1.703 +test parse-15.29 {CommandComplete procedure} {
   1.704 +    info complete {a b [ab cd ef]}
   1.705 +} 1
   1.706 +test parse-15.30 {CommandComplete procedure} {
   1.707 +    info complete {a b x[ab][cd][ef] gh}
   1.708 +} 1
   1.709 +test parse-15.31 {CommandComplete procedure} {
   1.710 +    info complete {a b x[ab][cd[ef] gh}
   1.711 +} 0
   1.712 +test parse-15.32 {CommandComplete procedure} {
   1.713 +    info complete {a b x[ gh}
   1.714 +} 0
   1.715 +test parse-15.33 {CommandComplete procedure} {
   1.716 +    info complete {[]]]}
   1.717 +} 1
   1.718 +test parse-15.34 {CommandComplete procedure} {
   1.719 +    info complete {abc x$yyy}
   1.720 +} 1
   1.721 +test parse-15.35 {CommandComplete procedure} {
   1.722 +    info complete "abc x\${abc\[\\d} xyz"
   1.723 +} 1
   1.724 +test parse-15.36 {CommandComplete procedure} {
   1.725 +    info complete "abc x\$\{ xyz"
   1.726 +} 0
   1.727 +test parse-15.37 {CommandComplete procedure} {
   1.728 +    info complete {word $a(xyz)}
   1.729 +} 1
   1.730 +test parse-15.38 {CommandComplete procedure} {
   1.731 +    info complete {word $a(}
   1.732 +} 0
   1.733 +test parse-15.39 {CommandComplete procedure} {
   1.734 +    info complete "set a \\\n"
   1.735 +} 0
   1.736 +test parse-15.40 {CommandComplete procedure} {
   1.737 +    info complete "set a \\\\\n"
   1.738 +} 1
   1.739 +test parse-15.41 {CommandComplete procedure} {
   1.740 +    info complete "set a \\n "
   1.741 +} 1
   1.742 +test parse-15.42 {CommandComplete procedure} {
   1.743 +    info complete "set a \\"
   1.744 +} 1
   1.745 +test parse-15.43 {CommandComplete procedure} {
   1.746 +    info complete "foo \\\n\{"
   1.747 +} 0
   1.748 +test parse-15.44 {CommandComplete procedure} {
   1.749 +    info complete "a\nb\n# \{\n# \{\nc\n"
   1.750 +} 1
   1.751 +test parse-15.45 {CommandComplete procedure} {
   1.752 +    info complete "#Incomplete comment\\\n"
   1.753 +} 0
   1.754 +test parse-15.46 {CommandComplete procedure} {
   1.755 +    info complete "#Incomplete comment\\\nBut now it's complete.\n"
   1.756 +} 1
   1.757 +test parse-15.47 {CommandComplete procedure} {
   1.758 +    info complete "# Complete comment\\\\\n"
   1.759 +} 1
   1.760 +test parse-15.48 {CommandComplete procedure} {
   1.761 +    info complete "abc\\\n def"
   1.762 +} 1
   1.763 +test parse-15.49 {CommandComplete procedure} {
   1.764 +    info complete "abc\\\n "
   1.765 +} 1
   1.766 +test parse-15.50 {CommandComplete procedure} {
   1.767 +    info complete "abc\\\n"
   1.768 +} 0
   1.769 +test parse-15.51 {CommandComplete procedure} "
   1.770 +    info complete \"\\{abc\\}\\{\"
   1.771 +" 1
   1.772 +test parse-15.52 {CommandComplete procedure} {
   1.773 +    info complete "\"abc\"("
   1.774 +} 1
   1.775 +test parse-15.53 {CommandComplete procedure} "
   1.776 +    info complete \" # {\"
   1.777 +" 1
   1.778 +test parse-15.54 {CommandComplete procedure} "
   1.779 +    info complete \"foo bar;# {\"
   1.780 +" 1
   1.781 +test parse-15.55 {CommandComplete procedure} {
   1.782 +    info complete "set x [bytestring \0]; puts hi"
   1.783 +} 1
   1.784 +test parse-15.56 {CommandComplete procedure} {
   1.785 +    info complete "set x [bytestring \0]; \{"
   1.786 +} 0
   1.787 +test parse-15.57 {CommandComplete procedure} {
   1.788 +    info complete "# Comment should be complete command"
   1.789 +} 1
   1.790 +test parse-15.58 {CommandComplete procedure, memory leaks} {
   1.791 +    info complete "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22"
   1.792 +} 1
   1.793 +test parse-15.59 {CommandComplete procedure} {
   1.794 +    # Test for Tcl Bug 684744
   1.795 +    info complete [encoding convertfrom identity "\x00;if 1 \{"]
   1.796 +} 0
   1.797 +
   1.798 +test parse-16.1 {Tcl_EvalEx, check termOffset is set correctly for non TCL_OK cases, bug 2535} {
   1.799 +    subst {[eval {return foo}]bar}
   1.800 +} foobar
   1.801 +
   1.802 +test parse-17.1 {Correct return codes from errors during substitution} {
   1.803 +    catch {eval {w[continue]}}
   1.804 +} 4
   1.805 +
   1.806 +test parse-19.1 {Bug 1115904: recursion limit in Tcl_EvalEx} -constraints {
   1.807 +    testevalex
   1.808 +} -setup {
   1.809 +    interp create i
   1.810 +    load {} Tcltest i
   1.811 +    i eval {proc {} args {}}
   1.812 +    interp recursionlimit i 3
   1.813 +} -body {
   1.814 +    i eval {testevalex {[]}}
   1.815 +} -cleanup {
   1.816 +    interp delete i
   1.817 +}
   1.818 +
   1.819 +test parse-19.2 {Bug 1115904: recursion limit in Tcl_EvalEx} -constraints {
   1.820 +    testevalex
   1.821 +} -setup {
   1.822 +    interp create i
   1.823 +    load {} Tcltest i
   1.824 +    i eval {proc {} args {}}
   1.825 +    interp recursionlimit i 3
   1.826 +} -body {
   1.827 +    i eval {testevalex {[[]]}}
   1.828 +} -cleanup {
   1.829 +    interp delete i
   1.830 +} -returnCodes error -match glob -result {too many nested*}
   1.831 +
   1.832 +test parse-19.3 {Bug 1115904: recursion limit in Tcl_EvalEx} -setup {
   1.833 +    interp create i
   1.834 +    i eval {proc {} args {}}
   1.835 +    interp recursionlimit i 3
   1.836 +} -body {
   1.837 +    i eval {subst {[]}}
   1.838 +} -cleanup {
   1.839 +    interp delete i
   1.840 +}
   1.841 +
   1.842 +test parse-19.4 {Bug 1115904: recursion limit in Tcl_EvalEx} -setup {
   1.843 +    interp create i
   1.844 +    i eval {proc {} args {}}
   1.845 +    interp recursionlimit i 3
   1.846 +} -body {
   1.847 +    i eval {subst {[[]]}}
   1.848 +} -cleanup {
   1.849 +    interp delete i
   1.850 +} -returnCodes error -match glob -result {too many nested*}
   1.851 +
   1.852 +# cleanup
   1.853 +catch {unset a}
   1.854 +::tcltest::cleanupTests
   1.855 +return