1 # Commands covered: set, unset, array
3 # This file includes the original set of tests for Tcl's set command.
4 # Since the set command is now compiled, a new set of tests covering
5 # the new implementation is in the file "set.test". Sourcing this file
6 # into Tcl runs the tests and generates output for errors.
7 # No output means no errors were found.
9 # Copyright (c) 1991-1993 The Regents of the University of California.
10 # Copyright (c) 1994-1997 Sun Microsystems, Inc.
11 # Copyright (c) 1998-1999 by Scriptics Corporation.
13 # See the file "license.terms" for information on usage and redistribution
14 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
16 if {"::tcltest" ni [namespace children]} {
17 package require tcltest 2.5
18 namespace import -force ::tcltest::*
23 # Simple variable operations.
26 test set-old-1.1 {basic variable setting and unsetting} {
29 test set-old-1.2 {basic variable setting and unsetting} {
33 test set-old-1.3 {basic variable setting and unsetting} {
37 test set-old-1.4 {basic variable setting and unsetting} {
40 list [catch {set a} msg] $msg
41 } {1 {can't read "a": no such variable}}
43 # Basic array operations.
48 set {a(a long name)} test
49 test set-old-2.1 {basic array operations} {
51 } {44 {a long name} xyz}
52 test set-old-2.2 {basic array operations} {
55 test set-old-2.3 {basic array operations} {
58 test set-old-2.4 {basic array operations} {
61 test set-old-2.5 {basic array operations} {
62 list [catch {set a(other)} msg] $msg
63 } {1 {can't read "a(other)": no such element in array}}
64 test set-old-2.6 {basic array operations} {
65 list [catch {set a} msg] $msg
66 } {1 {can't read "a": variable is array}}
67 test set-old-2.7 {basic array operations} {
70 test set-old-2.8 {basic array operations} {
71 format %s $a(a long name)
74 test set-old-2.9 {basic array operations} {
77 test set-old-2.10 {basic array operations} {
79 list [catch {set b(123)} msg] $msg
80 } {1 {can't read "b(123)": no such variable}}
81 test set-old-2.11 {basic array operations} {
84 list [catch {set b(123)} msg] $msg
85 } {1 {can't read "b(123)": variable isn't array}}
86 test set-old-2.12 {basic array operations} {
87 list [catch {set a 14} msg] $msg
88 } {1 {can't set "a": variable is array}}
90 test set-old-2.13 {basic array operations} {
91 list [catch {set a(xyz)} msg] $msg
92 } {1 {can't read "a(xyz)": no such variable}}
94 # Test the set commands, and exercise the corner cases of the code
95 # that parses array references into two parts.
97 test set-old-3.1 {set command} {
98 list [catch {set} msg] $msg
99 } {1 {wrong # args: should be "set varName ?newValue?"}}
100 test set-old-3.2 {set command} {
101 list [catch {set x y z} msg] $msg
102 } {1 {wrong # args: should be "set varName ?newValue?"}}
103 test set-old-3.3 {set command} {
105 list [catch {set a} msg] $msg
106 } {1 {can't read "a": no such variable}}
107 test set-old-3.4 {set command} {
110 list [catch {set a 22} msg] $msg
111 } {1 {can't set "a": variable is array}}
113 # Test the corner-cases of parsing array names, using set and unset.
115 test set-old-4.1 {parsing array names} {
118 list [catch {array names a} msg] $msg
120 test set-old-4.2 {parsing array names} {
121 catch {unset a a(abcd}
125 test set-old-4.3 {parsing array names} {
126 catch {unset a a(abcd}
128 list [catch {array names a} msg] $msg
130 test set-old-4.4 {parsing array names} {
131 catch {unset a abcd)}
135 test set-old-4.5 {parsing array names} {
138 list [catch {set a(bcd} msg] $msg
140 test set-old-4.6 {parsing array names} {
143 list [catch {set a(bcd test} msg] $msg
146 # Errors in reading variables
148 test set-old-5.1 {errors in reading variables} {
150 list [catch {set a} msg] $msg
151 } {1 {can't read "a": no such variable}}
152 test set-old-5.2 {errors in reading variables} {
155 list [catch {set a(18)} msg] $msg
156 } {1 {can't read "a(18)": variable isn't array}}
157 test set-old-5.3 {errors in reading variables} {
160 list [catch {set a(18)} msg] $msg
161 } {1 {can't read "a(18)": no such element in array}}
162 test set-old-5.4 {errors in reading variables} {
165 list [catch {set a} msg] $msg
166 } {1 {can't read "a": variable is array}}
168 # Errors and other special cases in writing variables
170 test set-old-6.1 {creating array during write} {
172 trace var a rwu ignore
173 list [catch {set a(14) 186} msg] $msg [array names a]
175 test set-old-6.2 {errors in writing variables} {
178 list [catch {set a(14) 186} msg] $msg
179 } {1 {can't set "a(14)": variable isn't array}}
180 test set-old-6.3 {errors in writing variables} {
183 list [catch {set a 2} msg] $msg
184 } {1 {can't set "a": variable is array}}
185 test set-old-6.4 {expanding variable size} {
187 list [set a short] [set a "longer name"] [set a "even longer name"] \
188 [set a "a much much truly longer name"]
189 } {short {longer name} {even longer name} {a much much truly longer name}}
191 # Unset command, Tcl_UnsetVar procedures
193 test set-old-7.1 {unset command} {
194 catch {unset a}; catch {unset b}; catch {unset c}; catch {unset d}
200 list [catch {set a(0) 0}] [catch {set b(0) 0}] [catch {set c(0) 0}] \
203 test set-old-7.2 {unset command} {
204 list [catch {unset} msg] $msg
207 #{1 {wrong # args: should be "unset ?-nocomplain? ?--? ?varName ...?"}}
208 test set-old-7.3 {unset command} {
210 list [catch {unset a} msg] $msg
211 } {1 {can't unset "a": no such variable}}
212 test set-old-7.4 {unset command} {
215 list [catch {unset a(14)} msg] $msg
216 } {1 {can't unset "a(14)": variable isn't array}}
217 test set-old-7.5 {unset command} {
220 list [catch {unset a(14)} msg] $msg
221 } {1 {can't unset "a(14)": no such element in array}}
222 test set-old-7.6 {unset command} {
223 catch {unset a}; catch {unset b}; catch {unset c}
226 list [catch {unset a a a(14)} msg] $msg [info exists c]
227 } {1 {can't unset "a": no such variable} 1}
228 test set-old-7.7 {unsetting globals from within procedures} {
233 return [list $z [catch {set y} msg] $msg]
235 proc p2 {} {global y; unset y; list [catch {set y} msg] $msg}
237 } {{1 {can't read "y": no such variable}} 1 {can't read "y": no such variable}}
238 test set-old-7.8 {unsetting globals from within procedures} {
243 return [list [catch {set y 44} msg] $msg]
245 proc p2 {} {global y; unset y}
246 concat [p1] [list [catch {set y} msg] $msg]
248 test set-old-7.9 {unsetting globals from within procedures} {
253 return [list [catch {set y 55} msg] $msg]
255 concat [p1] [list [catch {set y} msg] $msg]
257 test set-old-7.10 {unset command} {
261 list [catch {set a(14)} msg] $msg [catch {array names a} msg2] $msg2
262 } {1 {can't read "a(14)": no such element in array} 0 {}}
263 test set-old-7.11 {unset command} {
267 list [catch {set a(14)} msg] $msg [catch {array names a} msg2] $msg2
268 } {1 {can't read "a(14)": no such variable} 0 {}}
269 test set-old-7.12 {unset command, -nocomplain} {
271 list [info exists a] [catch {unset -nocomplain a}] [info exists a]
273 test set-old-7.13 {unset command, -nocomplain} {
275 list [info exists -nocomplain] [catch {unset -nocomplain}] \
276 [info exists -nocomplain] [catch {unset -- -nocomplain}] \
277 [info exists -nocomplain]
279 test set-old-7.14 {unset command, --} {
281 list [info exists --] [catch {unset --}] \
282 [info exists --] [catch {unset -- --}] \
285 test set-old-7.15 {unset command, -nocomplain} {
288 list [info exists -nocomplain] [catch {unset -- -nocomplain}] \
289 [info exists -nocomplain] [info exists --] \
290 [catch {unset -- -nocomplain}] [info exists --] \
291 [catch {unset -- --}] [info exists --]
293 test set-old-7.16 {unset command, -nocomplain} {
296 list [info exists bogus] [catch {unset -nocomplain bogus var bogus}] \
297 [info exists -nocomplain] [info exists var] \
298 [catch {unset -nocomplain -nocomplain}] [info exists -nocomplain]
300 test set-old-7.17 {unset command, -nocomplain (no abbreviation)} {
302 list [info exists -nocomp] [catch {unset -nocomp}] [info exists -nocomp]
304 test set-old-7.18 {unset command, -nocomplain (no abbreviation)} {
305 catch {unset -nocomp}
306 list [info exists -nocomp] [catch {unset -nocomp}]
308 test set-old-7.19 {unset command, both switches} {
310 list [info exists --] [catch {unset -nocomplain --}] [info exists --]\
311 [catch {unset -nocomplain -- --}] [info exists --]
316 test set-old-8.1 {array command} {
317 list [catch {array} msg] $msg
318 } {1 {wrong # args: should be "array subcommand ?arg ...?"}}
319 test set-old-8.2 {array command} {
320 list [catch {array a} msg] $msg
321 } {1 {wrong # args: should be "array anymore arrayName searchId"}}
322 test set-old-8.3 {array command} {
324 list [catch {array anymore a b} msg] $msg
325 } {1 {"a" isn't an array}}
326 test set-old-8.4 {array command} {
329 list [catch {array anymore a b} msg] $msg
330 } {1 {"a" isn't an array}}
331 test set-old-8.5 {array command} {
335 list [catch {array anymore x b} msg] $msg
338 } {1 {"x" isn't an array}}
339 test set-old-8.6 {array command} {
342 list [catch {array gorp a} msg] $msg
343 } {1 {unknown or ambiguous subcommand "gorp": must be anymore, donesearch, exists, get, names, nextelement, set, size, startsearch, statistics, or unset}}
344 test set-old-8.7 {array command, anymore option} {
346 list [catch {array anymore a x} msg] $msg
347 } {1 {"a" isn't an array}}
348 test set-old-8.8 {array command, anymore option, array doesn't exist yet but has compiler-allocated procedure slot} {
351 return [array anymore a x]
355 list [catch {foo 1} msg] $msg
356 } {1 {"a" isn't an array}}
357 test set-old-8.9 {array command, donesearch option} {
359 list [catch {array donesearch a x} msg] $msg
360 } {1 {"a" isn't an array}}
361 test set-old-8.10 {array command, donesearch option, array doesn't exist yet but has compiler-allocated procedure slot} {
364 return [array donesearch a x]
368 list [catch {foo 1} msg] $msg
369 } {1 {"a" isn't an array}}
370 test set-old-8.11 {array command, exists option} {
371 list [catch {array exists a b} msg] $msg
372 } {1 {wrong # args: should be "array exists arrayName"}}
373 test set-old-8.12 {array command, exists option} {
377 test set-old-8.13 {array command, exists option} {
382 test set-old-8.14 {array command, exists option, array doesn't exist yet but has compiler-allocated procedure slot} {
385 return [array exists a]
389 list [catch {foo 1} msg] $msg
391 test set-old-8.15 {array command, get option} {
392 list [catch {array get} msg] $msg
393 } {1 {wrong # args: should be "array get arrayName ?pattern?"}}
394 test set-old-8.16 {array command, get option} {
395 list [catch {array get a b c} msg] $msg
396 } {1 {wrong # args: should be "array get arrayName ?pattern?"}}
397 test set-old-8.17 {array command, get option} {
401 test set-old-8.18 {array command, get option} {
404 set {a(long name)} {}
406 } {{} 22 3 {long name}}
407 test set-old-8.19 {array command, get option (unset variable)} {
410 trace var a(y) w ignore
413 test set-old-8.20 {array command, get option, with pattern} {
420 lsort [array get a x*]
422 test set-old-8.21 {array command, get option, array doesn't exist yet but has compiler-allocated procedure slot} {
429 list [catch {foo 1} msg] $msg
431 test set-old-8.22 {array command, names option} {
434 list [catch {array names a 4 5} msg] $msg
435 } {1 {bad option "4": must be -exact, -glob, or -regexp}}
436 test set-old-8.23 {array command, names option} {
440 test set-old-8.24 {array command, names option} {
442 set a(22) 3; set a(Textual_name) 44; set "a(name with spaces)" xxx
443 list [catch {lsort [array names a]} msg] $msg
444 } {0 {22 Textual_name {name with spaces}}}
445 test set-old-8.25 {array command, names option} {
447 set a(22) 3; set a(33) 44;
448 trace var a(xxx) w ignore
449 list [catch {lsort [array names a]} msg] $msg
451 test set-old-8.26 {array command, names option} {
453 set a(22) 3; set a(33) 44;
454 trace var a(xxx) w ignore
456 list [catch {lsort [array names a]} msg] $msg
458 test set-old-8.27 {array command, names option} {
464 list [lsort [array names a *xy]] [lsort [array names a]]
465 } {{axy bxy} {axy bxy no xxx}}
466 test set-old-8.28 {array command, names option, array doesn't exist yet but has compiler-allocated procedure slot} {
469 return [array names a]
473 list [catch {foo 1} msg] $msg
475 test set-old-8.29 {array command, nextelement option} {
476 list [catch {array nextelement a} msg] $msg
477 } {1 {wrong # args: should be "array nextelement arrayName searchId"}}
478 test set-old-8.30 {array command, nextelement option} {
480 list [catch {array nextelement a b} msg] $msg
481 } {1 {"a" isn't an array}}
482 test set-old-8.31 {array command, nextelement option, array doesn't exist yet but has compiler-allocated procedure slot} {
485 return [array nextelement a b]
489 list [catch {foo 1} msg] $msg
490 } {1 {"a" isn't an array}}
491 test set-old-8.32 {array command, set option} {
492 list [catch {array set a} msg] $msg
493 } {1 {wrong # args: should be "array set arrayName list"}}
494 test set-old-8.33 {array command, set option} {
495 list [catch {array set a 1 2} msg] $msg
496 } {1 {wrong # args: should be "array set arrayName list"}}
497 test set-old-8.34 {array command, set option} {
498 list [catch {array set a "a \{ c"} msg] $msg
499 } {1 {unmatched open brace in list}}
500 test set-old-8.35 {array command, set option} {
503 list [catch {array set a {a b c d}} msg] $msg
504 } {1 {can't set "a(a)": variable isn't array}}
505 test set-old-8.36 {array command, set option} {
508 array set a {b c d e}
511 test set-old-8.37 {array command, set option, array doesn't exist yet but has compiler-allocated procedure slot} {
514 return [array set a {x 0}]
518 list [catch {foo 1} msg] $msg
520 test set-old-8.38 {array command, set option} {
521 catch {unset aVaRnAmE}
522 array set aVaRnAmE {}
523 list [info exists aVaRnAmE] [catch {set aVaRnAmE} msg] $msg
524 } {1 1 {can't read "aVaRnAmE": variable is array}}
525 test set-old-8.38.1 {array command, set scalar} {
526 catch {unset aVaRnAmE}
528 list [catch {array set aVaRnAmE {}} msg] $msg
529 } {1 {can't array set "aVaRnAmE": variable isn't array}}
530 test set-old-8.38.2 {array command, set alias} {
531 catch {unset aVaRnAmE}
532 upvar 0 aVaRnAmE anAliAs
534 list [array exists aVaRnAmE] [catch {set anAliAs} msg] $msg
535 } {1 1 {can't read "anAliAs": variable is array}}
536 test set-old-8.38.3 {array command, set element alias} {
537 catch {unset aVaRnAmE}
538 list [catch {upvar 0 aVaRnAmE(elem) elemAliAs}] \
539 [catch {array set elemAliAs {}} msg] $msg
540 } {0 1 {can't array set "elemAliAs": variable isn't array}}
541 test set-old-8.38.4 {array command, empty set with populated array} {
542 catch {unset aVaRnAmE}
543 array set aVaRnAmE [list e1 v1 e2 v2]
544 array set aVaRnAmE {}
545 array set aVaRnAmE [list e3 v3]
546 list [lsort [array names aVaRnAmE]] [catch {set aVaRnAmE(e2)} msg] $msg
548 test set-old-8.38.5 {array command, set with non-existent namespace} {
549 list [catch {array set bogusnamespace::var {}} msg] $msg
550 } {1 {can't set "bogusnamespace::var": parent namespace doesn't exist}}
551 test set-old-8.38.6 {array command, set with non-existent namespace} {
552 list [catch {array set bogusnamespace::var {a b}} msg] $msg
553 } {1 {can't set "bogusnamespace::var": parent namespace doesn't exist}}
554 test set-old-8.38.7 {array command, set with non-existent namespace} {
555 list [catch {array set bogusnamespace::var(0) {a b}} msg] $msg
556 } {1 {can't set "bogusnamespace::var(0)": parent namespace doesn't exist}}
557 test set-old-8.39 {array command, size option} {
561 test set-old-8.40 {array command, size option} {
562 list [catch {array size a 4} msg] $msg
563 } {1 {wrong # args: should be "array size arrayName"}}
564 test set-old-8.41 {array command, size option} {
568 test set-old-8.42 {array command, size option} {
570 set a(22) 3; set a(Textual_name) 44; set "a(name with spaces)" xxx
571 list [catch {array size a} msg] $msg
573 test set-old-8.43 {array command, size option} {
575 set a(22) 3; set a(xx) 44; set a(y) xxx
576 unset a(22) a(y) a(xx)
577 list [catch {array size a} msg] $msg
579 test set-old-8.44 {array command, size option} {
582 trace var a(33) rwu ignore
583 list [catch {array size a} msg] $msg
585 test set-old-8.45 {array command, size option, array doesn't exist yet but has compiler-allocated procedure slot} {
588 return [array size a]
592 list [catch {foo 1} msg] $msg
594 test set-old-8.46 {array command, startsearch option} {
595 list [catch {array startsearch a b} msg] $msg
596 } {1 {wrong # args: should be "array startsearch arrayName"}}
597 test set-old-8.47 {array command, startsearch option} {
599 list [catch {array startsearch a} msg] $msg
600 } {1 {"a" isn't an array}}
601 test set-old-8.48 {array command, startsearch option, array doesn't exist yet but has compiler-allocated procedure slot} {
605 return [array startsearch a]
609 list [catch {p 1} msg] $msg
610 } {1 {"a" isn't an array}}
611 test set-old-8.49 {array command, statistics option} {
623 } "9 entries in table, 4 buckets
624 number of buckets with 0 entries: 0
625 number of buckets with 1 entries: 0
626 number of buckets with 2 entries: 3
627 number of buckets with 3 entries: 1
628 number of buckets with 4 entries: 0
629 number of buckets with 5 entries: 0
630 number of buckets with 6 entries: 0
631 number of buckets with 7 entries: 0
632 number of buckets with 8 entries: 0
633 number of buckets with 9 entries: 0
634 number of buckets with 10 or more entries: 0
635 average search distance for entry: 1.7"
636 test set-old-8.50 {array command, array names -exact on glob pattern} {
639 list [catch {array names a -exact 1*2} msg] $msg
641 test set-old-8.51 {array command, array names -glob on glob pattern} {
646 list [catch {lsort [array names a -glob 1*2]} msg] $msg
648 test set-old-8.52 {array command, array names -regexp on regexp pattern} {
653 list [catch {lsort [array names a -regexp ^1]} msg] $msg
655 test set-old-8.52.1 {array command, array names -regexp, backrefs} {
660 list [catch {lsort [array names a -regexp {^(.)\1}]} msg] $msg
662 test set-old-8.53 {array command, array names -regexp} {
667 list [catch {array names a -regexp} msg] $msg
669 test set-old-8.54 {array command, array names -exact} {
674 list [catch {array names a -exact} msg] $msg
676 test set-old-8.55 {array command, array names -glob} {
681 list [catch {array names a -glob} msg] $msg
683 test set-old-8.56 {array command, array statistics on a non-array} {
685 list [catch {array statistics a} msg] $msg
686 } [list 1 "\"a\" isn't an array"]
687 test set-old-8.57 {array command, array get with trivial pattern} {
693 test set-old-8.58 {array command, array set with LVT and odd length literal} {
694 list [catch {apply {{} {
697 } {1 {list must have an even number of elements}}
699 test set-old-9.1 {ids for array enumeration} {
702 list [array star a] [array star a] [array done a s-1-a; array star a] \
703 [array done a s-2-a; array d a s-3-a; array start a]
704 } {s-1-a s-2-a s-3-a s-1-a}
705 test set-old-9.2 {array enumeration} {
710 set x [array startsearch a]
711 lsort [list [array nextelement a $x] [array ne a $x] [array next a $x] \
712 [array next a $x] [array next a $x]]
714 test set-old-9.3 {array enumeration} {
719 set x [array startsearch a]
720 set y [array startsearch a]
721 set z [array startsearch a]
722 lsort [list [array nextelement a $x] [array ne a $x] \
723 [array next a $y] [array next a $z] [array next a $y] \
724 [array next a $z] [array next a $y] [array next a $z] \
725 [array next a $y] [array next a $z] [array next a $x] \
727 } {{} {} {} a a a b b b c c c}
728 test set-old-9.4 {array enumeration: stopping searches} {
733 set x [array startsearch a]
734 set y [array startsearch a]
735 set z [array startsearch a]
736 lsort [list [array next a $x] [array next a $x] [array next a $y] \
737 [array done a $z; array next a $x] \
738 [array done a $x; array next a $y] [array next a $y]]
740 test set-old-9.5 {array enumeration: stopping searches} {
743 set x [array startsearch a]
745 list [catch {array next a $x} msg] $msg
746 } {1 {couldn't find search "s-1-a"}}
747 test set-old-9.6 {array enumeration: searches automatically stopped} {
750 set x [array startsearch a]
751 set y [array startsearch a]
753 list [catch {array next a $x} msg] $msg \
754 [catch {array next a $y} msg2] $msg2
755 } {1 {couldn't find search "s-1-a"} 1 {couldn't find search "s-2-a"}}
756 test set-old-9.7 {array enumeration: searches automatically stopped} {
759 set x [array startsearch a]
760 set y [array startsearch a]
762 list [catch {array next a $x} msg] $msg \
763 [catch {array next a $y} msg2] $msg2
765 test set-old-9.8 {array enumeration: searches automatically stopped} {
769 set x [array startsearch a]
770 set y [array startsearch a]
772 list [catch {array next a $x} msg] $msg \
773 [catch {array next a $y} msg2] $msg2
774 } {1 {couldn't find search "s-1-a"} 1 {couldn't find search "s-2-a"}}
775 test set-old-9.9 {array enumeration: searches automatically stopped} {
778 set x [array startsearch a]
779 set y [array startsearch a]
781 list [catch {array next a $x} msg] $msg \
782 [catch {array next a $y} msg2] $msg2
784 test set-old-9.10 {array enumeration: searches automatically stopped} {
787 set x [array startsearch a]
788 set y [array startsearch a]
790 list [catch {array next a $x} msg] $msg \
791 [catch {array next a $y} msg2] $msg2
792 } {1 {couldn't find search "s-1-a"} 1 {couldn't find search "s-2-a"}}
793 test set-old-9.11 {array enumeration: searches automatically stopped} {
796 set x [array startsearch a]
797 set y [array startsearch a]
799 list [catch {array next a $x} msg] $msg \
800 [catch {array next a $y} msg2] $msg2
802 test set-old-9.12 {array enumeration with traced undefined elements} {
806 set x [array startsearch a]
807 lsort [list [array next a $x] [array next a $x]]
810 test set-old-10.1 {array enumeration errors} {
811 list [catch {array start} msg] $msg
812 } {1 {wrong # args: should be "array startsearch arrayName"}}
813 test set-old-10.2 {array enumeration errors} {
814 list [catch {array start a b} msg] $msg
815 } {1 {wrong # args: should be "array startsearch arrayName"}}
816 test set-old-10.3 {array enumeration errors} {
818 list [catch {array start a} msg] $msg
819 } {1 {"a" isn't an array}}
820 test set-old-10.4 {array enumeration errors} {
823 set x [array startsearch a]
824 list [catch {array next a} msg] $msg
825 } {1 {wrong # args: should be "array nextelement arrayName searchId"}}
826 test set-old-10.5 {array enumeration errors} {
829 set x [array startsearch a]
830 list [catch {array next a b c} msg] $msg
831 } {1 {wrong # args: should be "array nextelement arrayName searchId"}}
832 test set-old-10.6 {array enumeration errors} {
835 set x [array startsearch a]
836 list [catch {array next a a-1-a} msg] $msg
837 } {1 {illegal search identifier "a-1-a"}}
838 test set-old-10.7 {array enumeration errors} {
841 set x [array startsearch a]
842 list [catch {array next a sx1-a} msg] $msg
843 } {1 {illegal search identifier "sx1-a"}}
844 test set-old-10.8 {array enumeration errors} {
847 set x [array startsearch a]
848 list [catch {array next a s--a} msg] $msg
849 } {1 {illegal search identifier "s--a"}}
850 test set-old-10.9 {array enumeration errors} {
853 set x [array startsearch a]
854 list [catch {array next a s-1-b} msg] $msg
855 } {1 {search identifier "s-1-b" isn't for variable "a"}}
856 test set-old-10.10 {array enumeration errors} {
859 set x [array startsearch a]
860 list [catch {array next a s-1ba} msg] $msg
861 } {1 {illegal search identifier "s-1ba"}}
862 test set-old-10.11 {array enumeration errors} {
865 set x [array startsearch a]
866 list [catch {array next a s-2-a} msg] $msg
867 } {1 {couldn't find search "s-2-a"}}
868 test set-old-10.12 {array enumeration errors} {
869 list [catch {array done a} msg] $msg
870 } {1 {wrong # args: should be "array donesearch arrayName searchId"}}
871 test set-old-10.13 {array enumeration errors} {
872 list [catch {array done a b c} msg] $msg
873 } {1 {wrong # args: should be "array donesearch arrayName searchId"}}
874 test set-old-10.14 {array enumeration errors} {
877 list [catch {array done a b} msg] $msg
878 } {1 {illegal search identifier "b"}}
879 test set-old-10.15 {array enumeration errors} {
880 list [catch {array anymore a} msg] $msg
881 } {1 {wrong # args: should be "array anymore arrayName searchId"}}
882 test set-old-10.16 {array enumeration errors} {
883 list [catch {array any a b c} msg] $msg
884 } {1 {wrong # args: should be "array anymore arrayName searchId"}}
885 test set-old-10.17 {array enumeration errors} {
888 list [catch {array any a bogus} msg] $msg
889 } {1 {illegal search identifier "bogus"}}
891 # Array enumeration with "anymore" option
893 test set-old-11.1 {array anymore option} {
899 lsort [list [array anymore a s-1-a] [array next a s-1-a] \
900 [array anymore a s-1-a] [array next a s-1-a] \
901 [array anymore a s-1-a] [array next a s-1-a] \
902 [array anymore a s-1-a] [array next a s-1-a]]
904 test set-old-11.2 {array anymore option} {
910 lsort [list [array next a s-1-a] [array next a s-1-a] \
911 [array anymore a s-1-a] [array next a s-1-a] \
912 [array next a s-1-a] [array anymore a s-1-a]]
915 # Special check to see that the value of a variable is handled correctly
916 # if it is returned as the result of a procedure (must not free the variable
917 # string while deleting the call frame). Errors will only be detected if
918 # a memory consistency checker such as Purify is being used.
920 test set-old-12.1 {cleanup on procedure return} {
926 test set-old-12.2 {cleanup on procedure return} {
933 # Must delete variables when done, since these arrays get used as
934 # scalars by other tests.
938 catch {unset aVaRnAmE}
939 catch {rename foo {}}
942 ::tcltest::cleanupTests