auto.def: tclprefix should not be enabled by default
[jimtcl.git] / tests / exec2.test
blobe43bba093b9e17538b04950ec7f0f5371f31a114
1 # These tests are design especially for the vfork() implementation
2 # of exec where sh -c must be used and thus we must take extra care
3 # in quoting arguments to exec.
5 source [file dirname [info script]]/testing.tcl
7 needs cmd exec
9 set d \"
10 set s '
11 set b \\
13 array set saveenv [array get env]
15 test exec2-1.1 "Quoting - Result" {
16         exec echo ${d}double quoted${d} ${s}single quoted${s} ${b}backslash quoted${b}
17 } "\"double\ quoted\"\ 'single quoted'\ \\backslash\ quoted\\"
19 test exec2-1.2 "Quoting - Word Grouping" {
20         string trim [exec echo ${d}double quoted${d} ${s}single quoted${s} ${b}backslash quoted${b} | wc -w]
21 } {6}
23 test exec2-2.1 "Add to exec environment" {
24         set env(TESTENV) "the value"
25         exec printenv | sed -n -e /^TESTENV=/p
26 } {TESTENV=the value}
28 test exec2-2.2 "Remove from exec environment" {
29         set env(TESTENV2) "new value"
30         unset env(TESTENV)
31         exec printenv | sed -n -e /^TESTENV=/p
32 } {}
35 test exec2-2.3 "Remove all exec environment" {
36         array unset env *
37         exec printenv | sed -n -e /^TESTENV2=/p
38 } {}
40 test exec2-2.4 "Remove all env var" {
41         unset -nocomplain env
42         exec printenv | sed -n -e /^TESTENV2=/p
43 } {}
45 array set env [array get saveenv]
47 testreport