tagged release 0.6.4
[parrot.git] / languages / tcl / t / tcl_command_subst.t
blob9c9f6daeaba73aefae5c412bf267305f2881b787
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 13
15 eval_is {
16  set a 5
17  set b [set a]
18 } 5 {entire word}
20 eval_is {
21  set a 5
22  set b [set a]b
23 } 5b {beginning of word}
25 eval_is {
26  set a 5
27  set b b[set a]
28 } b5 {end of word}
30 eval_is {
31  set a "St\[ring Parsing"
32  set b $a
33 } {St[ring Parsing} {escaped bracket}
35 eval_is {
36  set a "St\\\[ring Parsing"
37  set b $a
38 } {St\[ring Parsing} {escaped backslash, escaped brace}
40 eval_is {
41  set a [set b \[]
42  set b $a
43 } {[} {embedded escaped open bracket}
45 eval_is {
46  set a [set b \]]
47  set b $a
48 } {]} {embedded escaped close bracket}
50 eval_is {
51  set a "2 [set b 3]"
52  set b $a
53 } {2 3} {command subst inside string}
55 eval_is {
56  set b [set a [set b 2]]
57 } 2 {nested command sub}
59 eval_is {
60  set b [set a "]"]
61 } {]} {] in quotes}
63 eval_is {
64   set b [expr {4*[llength "]"]}]
65 } 4 {] in " in [expr]}
67 eval_is {
68   set b [expr {4*"[llength "]"]"}]
69 } 4 {" in ] in " in [expr]}
71 eval_is {
72   set b [
73     set x {}
74     set x 3
75   ]
76 } 3 {newline after last command}