tagged release 0.6.4
[parrot.git] / languages / tcl / t / cmd_set.t
blobdd8f302bca5ab31b64e937fece9bb8df2ff8450a
1 #!perl
3 # Copyright (C) 2004-2006, The Perl Foundation.
4 # $Id$
6 # the following lines re-execute this as a tcl script
7 # the \ at the end of these lines makes them a comment in tcl \
8 use lib qw(languages/tcl/lib tcl/lib lib ../lib ../../lib); # \
9 use Tcl::Test; #\
10 __DATA__
12 source lib/test_more.tcl
13 plan 8
15 eval_is {
16  set a 2
17  expr $a
18 } 2 {set}
20 eval_is {
21  set a 1
22  set a
23 } 1 {get}
25 eval_is {
26   catch {unset a}
27   set a
28 } {can't read "a": no such variable} \
29   {missing global}
31 eval_is {
32  set b 1
33  set b(c) 2
34 } {can't set "b(c)": variable isn't array} \
35   {not an array}
37 eval_is {
38   array set a {}
39   set a foo
40 } {can't set "a": variable is array} \
41   {variable is array}
43 eval_is {
44   array set test {4 ok}
45   set {test(4)}
46 } ok {array access}
48 eval_is {set} \
49   {wrong # args: should be "set varName ?newValue?"} \
50   {no args}
52 eval_is {set a b c} \
53   {wrong # args: should be "set varName ?newValue?"} \
54   {too many args}