3 # Copyright (C) 2007, The Perl Foundation.
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); # \
12 source lib/test_more.tcl
16 {wrong # args: should be "subst ?-nobackslashes? ?-nocommands? ?-novariables? string"} \
19 eval_is {subst foo bar} \
20 {bad switch "foo": must be -nobackslashes, -nocommands, or -novariables} \
24 is [subst {{$foo}}] {{ba}} {subst: variable}
25 is [subst -nobackslashes {{$foo}}] {{ba}} {subst -nobackslashes: variable}
26 is [subst -nocommands {{$foo}}] {{ba}} {subst -nocommands: variable}
27 is [subst -novariables {{$foo}}] {{$foo}} {subst -novariables: variable}
29 is [subst {{[set foo]}}] {{ba}} {subst: command}
30 is [subst -nobackslashes {{[set foo]}}] {{ba}} {subst -nobackslashes: command}
31 is [subst -nocommands {{[set foo]}}] {{[set foo]}} {subst -nocommands: command}
32 is [subst -novariables {{[set foo]}}] {{ba}} {subst -novariables: command}
34 is [subst {{\$foo \[set foo]}}] {{$foo [set foo]}} {subst: backslash}
35 is [subst -nobackslashes {{\$foo \[set foo]}}] {{\ba \ba}} {subst -nobackslashes: backslash}
36 is [subst -nocommands {{\$foo}}] {{$foo}} {subst -nobackslashes: backslash}
37 is [subst -novariables {{\[set foo]}}] {{[set foo]}} {subst -nobackslashes: backslash}