tagged release 0.7.1
[parrot.git] / languages / tcl / t / cmd_append.t
blob3bec8ba4aab037fc844483f4d716d9f74afdd265
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
14 plan 8
16 is [set a 2; append a]       2 {var only}
17 is [set a 1; append a 2]    12 {append once}
18 is [set a 1; append a 2 3] 123 {append twice}
19                                #append chicken soup with rice.
21 is [set x ""; append x 1 2 abc "long string"] \
22   {12abclong string} {empty with several args}
24 eval_is {
25   catch {unset x}
26   append x 1 2 abc "long string"
27 } {12abclong string} {unset variable}
29 eval_is {append} \
30   {wrong # args: should be "append varName ?value value ...?"} \
31   {no args}
33 eval_is {
34  set x ""
35  append x(0) 44
36 } {can't set "x(0)": variable isn't array} {no args}
38 # Tcl currently throws an error for this code
39 # but a bug has been filed for it at http://tcl.sf.net (#1227172)
40 eval_is {
41  catch {unset x}
42  append x
43 } {can't read "x": no such variable} {append unset variable}