os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/set.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/set.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,520 @@
     1.4 +# Commands covered:  set
     1.5 +#
     1.6 +# This file contains a collection of tests for one or more of the Tcl
     1.7 +# built-in commands.  Sourcing this file into Tcl runs the tests and
     1.8 +# generates output for errors.  No output means no errors were found.
     1.9 +#
    1.10 +# Copyright (c) 1996 Sun Microsystems, Inc.
    1.11 +# Copyright (c) 1998-1999 by Scriptics Corporation.
    1.12 +#
    1.13 +# See the file "license.terms" for information on usage and redistribution
    1.14 +# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    1.15 +#
    1.16 +# RCS: @(#) $Id: set.test,v 1.8 2000/04/10 17:19:04 ericm Exp $
    1.17 +
    1.18 +if {[lsearch [namespace children] ::tcltest] == -1} {
    1.19 +    package require tcltest
    1.20 +    namespace import -force ::tcltest::*
    1.21 +}
    1.22 +
    1.23 +catch {unset x}
    1.24 +catch {unset i}
    1.25 +
    1.26 +test set-1.1 {TclCompileSetCmd: missing variable name} {
    1.27 +    list [catch {set} msg] $msg
    1.28 +} {1 {wrong # args: should be "set varName ?newValue?"}}
    1.29 +test set-1.2 {TclCompileSetCmd: simple variable name} {
    1.30 +    set i 10
    1.31 +    list [set i] $i
    1.32 +} {10 10}
    1.33 +test set-1.3 {TclCompileSetCmd: error compiling variable name} {
    1.34 +    set i 10
    1.35 +    catch {set "i"xxx} msg
    1.36 +    set msg
    1.37 +} {extra characters after close-quote}
    1.38 +test set-1.4 {TclCompileSetCmd: simple variable name in quotes} {
    1.39 +    set i 17
    1.40 +    list [set "i"] $i
    1.41 +} {17 17}
    1.42 +test set-1.5 {TclCompileSetCmd: simple variable name in braces} {
    1.43 +    catch {unset {a simple var}}
    1.44 +    set {a simple var} 27
    1.45 +    list [set {a simple var}] ${a simple var}
    1.46 +} {27 27}
    1.47 +test set-1.6 {TclCompileSetCmd: simple array variable name} {
    1.48 +    catch {unset a}
    1.49 +    set a(foo) 37
    1.50 +    list [set a(foo)] $a(foo)
    1.51 +} {37 37}
    1.52 +test set-1.7 {TclCompileSetCmd: non-simple (computed) variable name} {
    1.53 +    set x "i"
    1.54 +    set i 77
    1.55 +    list [set $x] $i
    1.56 +} {77 77}
    1.57 +test set-1.8 {TclCompileSetCmd: non-simple (computed) variable name} {
    1.58 +    set x "i"
    1.59 +    set i 77
    1.60 +    list [set [set x] 2] $i
    1.61 +} {2 2}
    1.62 +
    1.63 +test set-1.9 {TclCompileSetCmd: 3rd arg => assignment} {
    1.64 +    set i "abcdef"
    1.65 +    list [set i] $i
    1.66 +} {abcdef abcdef}
    1.67 +test set-1.10 {TclCompileSetCmd: only two args => just getting value} {
    1.68 +    set i {one two}
    1.69 +    set i
    1.70 +} {one two}
    1.71 +
    1.72 +test set-1.11 {TclCompileSetCmd: simple global name} {
    1.73 +    proc p {} {
    1.74 +        global i
    1.75 +        set i 54
    1.76 +        set i
    1.77 +    }
    1.78 +    p
    1.79 +} {54}
    1.80 +test set-1.12 {TclCompileSetCmd: simple local name} {
    1.81 +    proc p {bar} {
    1.82 +        set foo $bar
    1.83 +        set foo
    1.84 +    }
    1.85 +    p 999
    1.86 +} {999}
    1.87 +test set-1.13 {TclCompileSetCmd: simple but new (unknown) local name} {
    1.88 +    proc p {} {
    1.89 +        set bar
    1.90 +    }
    1.91 +    catch {p} msg
    1.92 +    set msg
    1.93 +} {can't read "bar": no such variable}
    1.94 +test set-1.14 {TclCompileSetCmd: simple local name, >255 locals} {
    1.95 +    proc 260locals {} {
    1.96 +        # create 260 locals (the last ones with index > 255)
    1.97 +        set a0 0; set a1 0; set a2 0; set a3 0; set a4 0
    1.98 +        set a5 0; set a6 0; set a7 0; set a8 0; set a9 0
    1.99 +        set b0 0; set b1 0; set b2 0; set b3 0; set b4 0
   1.100 +        set b5 0; set b6 0; set b7 0; set b8 0; set b9 0
   1.101 +        set c0 0; set c1 0; set c2 0; set c3 0; set c4 0
   1.102 +        set c5 0; set c6 0; set c7 0; set c8 0; set c9 0
   1.103 +        set d0 0; set d1 0; set d2 0; set d3 0; set d4 0
   1.104 +        set d5 0; set d6 0; set d7 0; set d8 0; set d9 0
   1.105 +        set e0 0; set e1 0; set e2 0; set e3 0; set e4 0
   1.106 +        set e5 0; set e6 0; set e7 0; set e8 0; set e9 0
   1.107 +        set f0 0; set f1 0; set f2 0; set f3 0; set f4 0
   1.108 +        set f5 0; set f6 0; set f7 0; set f8 0; set f9 0
   1.109 +        set g0 0; set g1 0; set g2 0; set g3 0; set g4 0
   1.110 +        set g5 0; set g6 0; set g7 0; set g8 0; set g9 0
   1.111 +        set h0 0; set h1 0; set h2 0; set h3 0; set h4 0
   1.112 +        set h5 0; set h6 0; set h7 0; set h8 0; set h9 0
   1.113 +        set i0 0; set i1 0; set i2 0; set i3 0; set i4 0
   1.114 +        set i5 0; set i6 0; set i7 0; set i8 0; set i9 0
   1.115 +        set j0 0; set j1 0; set j2 0; set j3 0; set j4 0
   1.116 +        set j5 0; set j6 0; set j7 0; set j8 0; set j9 0
   1.117 +        set k0 0; set k1 0; set k2 0; set k3 0; set k4 0
   1.118 +        set k5 0; set k6 0; set k7 0; set k8 0; set k9 0
   1.119 +        set l0 0; set l1 0; set l2 0; set l3 0; set l4 0
   1.120 +        set l5 0; set l6 0; set l7 0; set l8 0; set l9 0
   1.121 +        set m0 0; set m1 0; set m2 0; set m3 0; set m4 0
   1.122 +        set m5 0; set m6 0; set m7 0; set m8 0; set m9 0
   1.123 +        set n0 0; set n1 0; set n2 0; set n3 0; set n4 0
   1.124 +        set n5 0; set n6 0; set n7 0; set n8 0; set n9 0
   1.125 +        set o0 0; set o1 0; set o2 0; set o3 0; set o4 0
   1.126 +        set o5 0; set o6 0; set o7 0; set o8 0; set o9 0
   1.127 +        set p0 0; set p1 0; set p2 0; set p3 0; set p4 0
   1.128 +        set p5 0; set p6 0; set p7 0; set p8 0; set p9 0
   1.129 +        set q0 0; set q1 0; set q2 0; set q3 0; set q4 0
   1.130 +        set q5 0; set q6 0; set q7 0; set q8 0; set q9 0
   1.131 +        set r0 0; set r1 0; set r2 0; set r3 0; set r4 0
   1.132 +        set r5 0; set r6 0; set r7 0; set r8 0; set r9 0
   1.133 +        set s0 0; set s1 0; set s2 0; set s3 0; set s4 0
   1.134 +        set s5 0; set s6 0; set s7 0; set s8 0; set s9 0
   1.135 +        set t0 0; set t1 0; set t2 0; set t3 0; set t4 0
   1.136 +        set t5 0; set t6 0; set t7 0; set t8 0; set t9 0
   1.137 +        set u0 0; set u1 0; set u2 0; set u3 0; set u4 0
   1.138 +        set u5 0; set u6 0; set u7 0; set u8 0; set u9 0
   1.139 +        set v0 0; set v1 0; set v2 0; set v3 0; set v4 0
   1.140 +        set v5 0; set v6 0; set v7 0; set v8 0; set v9 0
   1.141 +        set w0 0; set w1 0; set w2 0; set w3 0; set w4 0
   1.142 +        set w5 0; set w6 0; set w7 0; set w8 0; set w9 0
   1.143 +        set x0 0; set x1 0; set x2 0; set x3 0; set x4 0
   1.144 +        set x5 0; set x6 0; set x7 0; set x8 0; set x9 0
   1.145 +        set y0 0; set y1 0; set y2 0; set y3 0; set y4 0
   1.146 +        set y5 0; set y6 0; set y7 0; set y8 0; set y9 0
   1.147 +        set z0 0; set z1 0; set z2 0; set z3 0; set z4 0
   1.148 +        set z5 0; set z6 0; set z7 0; set z8 0; set z9 1234
   1.149 +    }
   1.150 +    260locals
   1.151 +} {1234}
   1.152 +test set-1.15 {TclCompileSetCmd: variable is array} {
   1.153 +    catch {unset a}
   1.154 +    set x 27
   1.155 +    set x [set a(foo) 11]
   1.156 +    catch {unset a}
   1.157 +    set x
   1.158 +} 11
   1.159 +test set-1.16 {TclCompileSetCmd: variable is array, elem substitutions} {
   1.160 +    catch {unset a}
   1.161 +    set i 5
   1.162 +    set x 789
   1.163 +    set a(foo5) 27
   1.164 +    set x [set a(foo$i)]
   1.165 +    catch {unset a}
   1.166 +    set x
   1.167 +} 27
   1.168 +
   1.169 +test set-1.17 {TclCompileSetCmd: doing assignment, simple int} {
   1.170 +    set i 5
   1.171 +    set i 123
   1.172 +} 123
   1.173 +test set-1.18 {TclCompileSetCmd: doing assignment, simple int} {
   1.174 +    set i 5
   1.175 +    set i -100
   1.176 +} -100
   1.177 +test set-1.19 {TclCompileSetCmd: doing assignment, simple but not int} {
   1.178 +    set i 5
   1.179 +    set i 0x12MNOP
   1.180 +    set i
   1.181 +} {0x12MNOP}
   1.182 +test set-1.20 {TclCompileSetCmd: doing assignment, in quotes} {
   1.183 +    set i 25
   1.184 +    set i "-100"
   1.185 +} -100
   1.186 +test set-1.21 {TclCompileSetCmd: doing assignment, in braces} {
   1.187 +    set i 24
   1.188 +    set i {126}
   1.189 +} 126
   1.190 +test set-1.22 {TclCompileSetCmd: doing assignment, large int} {
   1.191 +    set i 5
   1.192 +    set i 200000
   1.193 +} 200000
   1.194 +test set-1.23 {TclCompileSetCmd: doing assignment, formatted int != int} {
   1.195 +    set i 25
   1.196 +    set i 000012345     ;# an octal literal == 5349 decimal
   1.197 +    list $i [incr i]
   1.198 +} {000012345 5350}
   1.199 +
   1.200 +test set-1.24 {TclCompileSetCmd: too many arguments} {
   1.201 +    set i 10
   1.202 +    catch {set i 20 30} msg
   1.203 +    set msg
   1.204 +} {wrong # args: should be "set varName ?newValue?"}
   1.205 +
   1.206 +test set-1.25 {TclCompileSetCmd: var is array, braced (no subs)} {
   1.207 +    # This was a known error in 8.1a* - 8.2.1
   1.208 +    catch {unset array}
   1.209 +    set {array($foo)} 5
   1.210 +} 5
   1.211 +test set-1.26 {TclCompileSetCmd: various array constructs} {
   1.212 +    # Test all kinds of array constructs that TclCompileSetCmd
   1.213 +    # may feel inclined to tamper with.
   1.214 +    proc p {} {
   1.215 +	set a x
   1.216 +	set be(hej) 1					; # hej
   1.217 +	set be($a) 1					; # x
   1.218 +	set {be($a)} 1					; # $a
   1.219 +	set be($a,hej) 1				; # x,hej
   1.220 +	set be($a,$a) 5					; # x,x
   1.221 +	set be(c($a) 1					; # c(x
   1.222 +	set be(\w\w) 1					; # ww
   1.223 +	set be(a:$a) [set be(x,$a)]			; # a:x
   1.224 +	set be(hej,$be($a,hej),hej) 1			; # hej,1,hej
   1.225 +	set be([string range hugge 0 2]) 1		; # hug
   1.226 +	set be(a\ a) 1					; # a a
   1.227 +	set be($a\ ,[string range hugge 1 3],hej) 1	; # x ,ugg,hej
   1.228 +	set be($a,h"ej) 1				; # x,h"ej
   1.229 +	set be([string range "a b c" 2 end]) 1		; # b c
   1.230 +	set [string range bet 0 1](foo) 1		; # foo
   1.231 +	set be([set be(a:$a)][set b\e($a)]) 1		; # 51
   1.232 +	return [lsort [array names be]]
   1.233 +    }
   1.234 +    p
   1.235 +} [lsort {hej x $a x,hej x,x c(x ww a:x hej,1,hej hug {a a} {x ,ugg,hej} x,h"ej
   1.236 +{b c} foo 51}]; # " just a matching end quote
   1.237 +
   1.238 +test set-2.1 {set command: runtime error, bad variable name} {
   1.239 +    list [catch {set {"foo}} msg] $msg $errorInfo
   1.240 +} {1 {can't read ""foo": no such variable} {can't read ""foo": no such variable
   1.241 +    while executing
   1.242 +"set {"foo}"}}
   1.243 +test set-2.2 {set command: runtime error, not array variable} {
   1.244 +    catch {unset b}
   1.245 +    set b 44
   1.246 +    list [catch {set b(123)} msg] $msg
   1.247 +} {1 {can't read "b(123)": variable isn't array}}
   1.248 +test set-2.3 {set command: runtime error, errors in reading variables} {
   1.249 +    catch {unset a}
   1.250 +    set a(6) 44
   1.251 +    list [catch {set a(18)} msg] $msg
   1.252 +} {1 {can't read "a(18)": no such element in array}}
   1.253 +test set-2.4 {set command: runtime error, readonly variable} {
   1.254 +    proc readonly args {error "variable is read-only"}
   1.255 +    set x 123
   1.256 +    trace var x w readonly
   1.257 +    list [catch {set x 1} msg] $msg $errorInfo
   1.258 +} {1 {can't set "x": variable is read-only} {can't set "x": variable is read-only
   1.259 +    while executing
   1.260 +"set x 1"}}
   1.261 +test set-2.5 {set command: runtime error, basic array operations} {
   1.262 +    list [catch {set a(other)} msg] $msg
   1.263 +} {1 {can't read "a(other)": no such element in array}}
   1.264 +test set-2.6 {set command: runtime error, basic array operations} {
   1.265 +    list [catch {set a} msg] $msg
   1.266 +} {1 {can't read "a": variable is array}}
   1.267 +
   1.268 +# Test the uncompiled version of set
   1.269 +
   1.270 +catch {unset a}
   1.271 +catch {unset b}
   1.272 +catch {unset i}
   1.273 +catch {unset x}
   1.274 +
   1.275 +test set-3.1 {uncompiled set command: missing variable name} {
   1.276 +    set z set
   1.277 +    list [catch {$z} msg] $msg
   1.278 +} {1 {wrong # args: should be "set varName ?newValue?"}}
   1.279 +test set-3.2 {uncompiled set command: simple variable name} {
   1.280 +    set z set
   1.281 +    $z i 10
   1.282 +    list [$z i] $i
   1.283 +} {10 10}
   1.284 +test set-3.3 {uncompiled set command: error compiling variable name} {
   1.285 +    set z set
   1.286 +    $z i 10
   1.287 +    catch {$z "i"xxx} msg
   1.288 +    $z msg
   1.289 +} {extra characters after close-quote}
   1.290 +test set-3.4 {uncompiled set command: simple variable name in quotes} {
   1.291 +    set z set
   1.292 +    $z i 17
   1.293 +    list [$z "i"] $i
   1.294 +} {17 17}
   1.295 +test set-3.5 {uncompiled set command: simple variable name in braces} {
   1.296 +    set z set
   1.297 +    catch {unset {a simple var}}
   1.298 +    $z {a simple var} 27
   1.299 +    list [$z {a simple var}] ${a simple var}
   1.300 +} {27 27}
   1.301 +test set-3.6 {uncompiled set command: simple array variable name} {
   1.302 +    set z set
   1.303 +    catch {unset a}
   1.304 +    $z a(foo) 37
   1.305 +    list [$z a(foo)] $a(foo)
   1.306 +} {37 37}
   1.307 +test set-3.7 {uncompiled set command: non-simple (computed) variable name} {
   1.308 +    set z set
   1.309 +    $z x "i"
   1.310 +    $z i 77
   1.311 +    list [$z $x] $i
   1.312 +} {77 77}
   1.313 +test set-3.8 {uncompiled set command: non-simple (computed) variable name} {
   1.314 +    set z set
   1.315 +    $z x "i"
   1.316 +    $z i 77
   1.317 +    list [$z [$z x] 2] $i
   1.318 +} {2 2}
   1.319 +
   1.320 +test set-3.9 {uncompiled set command: 3rd arg => assignment} {
   1.321 +    set z set
   1.322 +    $z i "abcdef"
   1.323 +    list [$z i] $i
   1.324 +} {abcdef abcdef}
   1.325 +test set-3.10 {uncompiled set command: only two args => just getting value} {
   1.326 +    set z set
   1.327 +    $z i {one two}
   1.328 +    $z i
   1.329 +} {one two}
   1.330 +
   1.331 +test set-3.11 {uncompiled set command: simple global name} {
   1.332 +    proc p {} {
   1.333 +	set z set
   1.334 +        global i
   1.335 +        $z i 54
   1.336 +        $z i
   1.337 +    }
   1.338 +    p
   1.339 +} {54}
   1.340 +test set-3.12 {uncompiled set command: simple local name} {
   1.341 +    proc p {bar} {
   1.342 +	set z set
   1.343 +        $z foo $bar
   1.344 +        $z foo
   1.345 +    }
   1.346 +    p 999
   1.347 +} {999}
   1.348 +test set-3.13 {uncompiled set command: simple but new (unknown) local name} {
   1.349 +    set z set
   1.350 +    proc p {} {
   1.351 +	set z set
   1.352 +        $z bar
   1.353 +    }
   1.354 +    catch {p} msg
   1.355 +    $z msg
   1.356 +} {can't read "bar": no such variable}
   1.357 +test set-3.14 {uncompiled set command: simple local name, >255 locals} {
   1.358 +    proc 260locals {} {
   1.359 +	set z set
   1.360 +        # create 260 locals (the last ones with index > 255)
   1.361 +        $z a0 0; $z a1 0; $z a2 0; $z a3 0; $z a4 0
   1.362 +        $z a5 0; $z a6 0; $z a7 0; $z a8 0; $z a9 0
   1.363 +        $z b0 0; $z b1 0; $z b2 0; $z b3 0; $z b4 0
   1.364 +        $z b5 0; $z b6 0; $z b7 0; $z b8 0; $z b9 0
   1.365 +        $z c0 0; $z c1 0; $z c2 0; $z c3 0; $z c4 0
   1.366 +        $z c5 0; $z c6 0; $z c7 0; $z c8 0; $z c9 0
   1.367 +        $z d0 0; $z d1 0; $z d2 0; $z d3 0; $z d4 0
   1.368 +        $z d5 0; $z d6 0; $z d7 0; $z d8 0; $z d9 0
   1.369 +        $z e0 0; $z e1 0; $z e2 0; $z e3 0; $z e4 0
   1.370 +        $z e5 0; $z e6 0; $z e7 0; $z e8 0; $z e9 0
   1.371 +        $z f0 0; $z f1 0; $z f2 0; $z f3 0; $z f4 0
   1.372 +        $z f5 0; $z f6 0; $z f7 0; $z f8 0; $z f9 0
   1.373 +        $z g0 0; $z g1 0; $z g2 0; $z g3 0; $z g4 0
   1.374 +        $z g5 0; $z g6 0; $z g7 0; $z g8 0; $z g9 0
   1.375 +        $z h0 0; $z h1 0; $z h2 0; $z h3 0; $z h4 0
   1.376 +        $z h5 0; $z h6 0; $z h7 0; $z h8 0; $z h9 0
   1.377 +        $z i0 0; $z i1 0; $z i2 0; $z i3 0; $z i4 0
   1.378 +        $z i5 0; $z i6 0; $z i7 0; $z i8 0; $z i9 0
   1.379 +        $z j0 0; $z j1 0; $z j2 0; $z j3 0; $z j4 0
   1.380 +        $z j5 0; $z j6 0; $z j7 0; $z j8 0; $z j9 0
   1.381 +        $z k0 0; $z k1 0; $z k2 0; $z k3 0; $z k4 0
   1.382 +        $z k5 0; $z k6 0; $z k7 0; $z k8 0; $z k9 0
   1.383 +        $z l0 0; $z l1 0; $z l2 0; $z l3 0; $z l4 0
   1.384 +        $z l5 0; $z l6 0; $z l7 0; $z l8 0; $z l9 0
   1.385 +        $z m0 0; $z m1 0; $z m2 0; $z m3 0; $z m4 0
   1.386 +        $z m5 0; $z m6 0; $z m7 0; $z m8 0; $z m9 0
   1.387 +        $z n0 0; $z n1 0; $z n2 0; $z n3 0; $z n4 0
   1.388 +        $z n5 0; $z n6 0; $z n7 0; $z n8 0; $z n9 0
   1.389 +        $z o0 0; $z o1 0; $z o2 0; $z o3 0; $z o4 0
   1.390 +        $z o5 0; $z o6 0; $z o7 0; $z o8 0; $z o9 0
   1.391 +        $z p0 0; $z p1 0; $z p2 0; $z p3 0; $z p4 0
   1.392 +        $z p5 0; $z p6 0; $z p7 0; $z p8 0; $z p9 0
   1.393 +        $z q0 0; $z q1 0; $z q2 0; $z q3 0; $z q4 0
   1.394 +        $z q5 0; $z q6 0; $z q7 0; $z q8 0; $z q9 0
   1.395 +        $z r0 0; $z r1 0; $z r2 0; $z r3 0; $z r4 0
   1.396 +        $z r5 0; $z r6 0; $z r7 0; $z r8 0; $z r9 0
   1.397 +        $z s0 0; $z s1 0; $z s2 0; $z s3 0; $z s4 0
   1.398 +        $z s5 0; $z s6 0; $z s7 0; $z s8 0; $z s9 0
   1.399 +        $z t0 0; $z t1 0; $z t2 0; $z t3 0; $z t4 0
   1.400 +        $z t5 0; $z t6 0; $z t7 0; $z t8 0; $z t9 0
   1.401 +        $z u0 0; $z u1 0; $z u2 0; $z u3 0; $z u4 0
   1.402 +        $z u5 0; $z u6 0; $z u7 0; $z u8 0; $z u9 0
   1.403 +        $z v0 0; $z v1 0; $z v2 0; $z v3 0; $z v4 0
   1.404 +        $z v5 0; $z v6 0; $z v7 0; $z v8 0; $z v9 0
   1.405 +        $z w0 0; $z w1 0; $z w2 0; $z w3 0; $z w4 0
   1.406 +        $z w5 0; $z w6 0; $z w7 0; $z w8 0; $z w9 0
   1.407 +        $z x0 0; $z x1 0; $z x2 0; $z x3 0; $z x4 0
   1.408 +        $z x5 0; $z x6 0; $z x7 0; $z x8 0; $z x9 0
   1.409 +        $z y0 0; $z y1 0; $z y2 0; $z y3 0; $z y4 0
   1.410 +        $z y5 0; $z y6 0; $z y7 0; $z y8 0; $z y9 0
   1.411 +        $z z0 0; $z z1 0; $z z2 0; $z z3 0; $z z4 0
   1.412 +        $z z5 0; $z z6 0; $z z7 0; $z z8 0; $z z9 1234
   1.413 +    }
   1.414 +    260locals
   1.415 +} {1234}
   1.416 +test set-3.15 {uncompiled set command: variable is array} {
   1.417 +    set z set
   1.418 +    catch {unset a}
   1.419 +    $z x 27
   1.420 +    $z x [$z a(foo) 11]
   1.421 +    catch {unset a}
   1.422 +    $z x
   1.423 +} 11
   1.424 +test set-3.16 {uncompiled set command: variable is array, elem substitutions} {
   1.425 +    set z set
   1.426 +    catch {unset a}
   1.427 +    $z i 5
   1.428 +    $z x 789
   1.429 +    $z a(foo5) 27
   1.430 +    $z x [$z a(foo$i)]
   1.431 +    catch {unset a}
   1.432 +    $z x
   1.433 +} 27
   1.434 +
   1.435 +test set-3.17 {uncompiled set command: doing assignment, simple int} {
   1.436 +    set z set
   1.437 +    $z i 5
   1.438 +    $z i 123
   1.439 +} 123
   1.440 +test set-3.18 {uncompiled set command: doing assignment, simple int} {
   1.441 +    set z set
   1.442 +    $z i 5
   1.443 +    $z i -100
   1.444 +} -100
   1.445 +test set-3.19 {uncompiled set command: doing assignment, simple but not int} {
   1.446 +    set z set
   1.447 +    $z i 5
   1.448 +    $z i 0x12MNOP
   1.449 +    $z i
   1.450 +} {0x12MNOP}
   1.451 +test set-3.20 {uncompiled set command: doing assignment, in quotes} {
   1.452 +    set z set
   1.453 +    $z i 25
   1.454 +    $z i "-100"
   1.455 +} -100
   1.456 +test set-3.21 {uncompiled set command: doing assignment, in braces} {
   1.457 +    set z set
   1.458 +    $z i 24
   1.459 +    $z i {126}
   1.460 +} 126
   1.461 +test set-3.22 {uncompiled set command: doing assignment, large int} {
   1.462 +    set z set
   1.463 +    $z i 5
   1.464 +    $z i 200000
   1.465 +} 200000
   1.466 +test set-3.23 {uncompiled set command: doing assignment, formatted int != int} {
   1.467 +    set z set
   1.468 +    $z i 25
   1.469 +    $z i 000012345     ;# an octal literal == 5349 decimal
   1.470 +    list $i [incr i]
   1.471 +} {000012345 5350}
   1.472 +
   1.473 +test set-3.24 {uncompiled set command: too many arguments} {
   1.474 +    set z set
   1.475 +    $z i 10
   1.476 +    catch {$z i 20 30} msg
   1.477 +    $z msg
   1.478 +} {wrong # args: should be "set varName ?newValue?"}
   1.479 +
   1.480 +test set-4.1 {uncompiled set command: runtime error, bad variable name} {
   1.481 +    set z set
   1.482 +    list [catch {$z {"foo}} msg] $msg $errorInfo
   1.483 +} {1 {can't read ""foo": no such variable} {can't read ""foo": no such variable
   1.484 +    while executing
   1.485 +"$z {"foo}"}}
   1.486 +test set-4.2 {uncompiled set command: runtime error, not array variable} {
   1.487 +    set z set
   1.488 +    catch {unset b}
   1.489 +    $z b 44
   1.490 +    list [catch {$z b(123)} msg] $msg
   1.491 +} {1 {can't read "b(123)": variable isn't array}}
   1.492 +test set-4.3 {uncompiled set command: runtime error, errors in reading variables} {
   1.493 +     set z set
   1.494 +   catch {unset a}
   1.495 +    $z a(6) 44
   1.496 +    list [catch {$z a(18)} msg] $msg
   1.497 +} {1 {can't read "a(18)": no such element in array}}
   1.498 +test set-4.4 {uncompiled set command: runtime error, readonly variable} {
   1.499 +    set z set
   1.500 +    proc readonly args {error "variable is read-only"}
   1.501 +    $z x 123
   1.502 +    trace var x w readonly
   1.503 +    list [catch {$z x 1} msg] $msg $errorInfo
   1.504 +} {1 {can't set "x": variable is read-only} {can't set "x": variable is read-only
   1.505 +    while executing
   1.506 +"$z x 1"}}
   1.507 +test set-4.5 {uncompiled set command: runtime error, basic array operations} {
   1.508 +    set z set
   1.509 +    list [catch {$z a(other)} msg] $msg
   1.510 +} {1 {can't read "a(other)": no such element in array}}
   1.511 +test set-4.6 {set command: runtime error, basic array operations} {
   1.512 +    set z set
   1.513 +    list [catch {$z a} msg] $msg
   1.514 +} {1 {can't read "a": variable is array}}
   1.515 +
   1.516 +# cleanup
   1.517 +catch {unset a}
   1.518 +catch {unset b}
   1.519 +catch {unset i}
   1.520 +catch {unset x}
   1.521 +catch {unset z}
   1.522 +::tcltest::cleanupTests
   1.523 +return