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