diff options
author | dgp <dgp@users.sourceforge.net> | 2002-07-10 11:56:44 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2002-07-10 11:56:44 (GMT) |
commit | b82fab03b6af98493600f93ab86254446957ffdd (patch) | |
tree | 1a37add20fefab1047a8268adf31e600b827891e /tests/env.test | |
parent | bf3a542777f9aa1164f705b7be08031012208d76 (diff) | |
download | tcl-b82fab03b6af98493600f93ab86254446957ffdd.zip tcl-b82fab03b6af98493600f93ab86254446957ffdd.tar.gz tcl-b82fab03b6af98493600f93ab86254446957ffdd.tar.bz2 |
* Cleaned up, constrained, and reduced the amount of [exec] usage
in the test suite.
Diffstat (limited to 'tests/env.test')
-rw-r--r-- | tests/env.test | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/tests/env.test b/tests/env.test index 1fbec90..5b7c76b 100644 --- a/tests/env.test +++ b/tests/env.test @@ -11,12 +11,10 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: env.test,v 1.15 2002/07/05 10:38:42 dkf Exp $ +# RCS: @(#) $Id: env.test,v 1.16 2002/07/10 11:56:44 dgp Exp $ -if {[lsearch [namespace children] ::tcltest] == -1} { - package require tcltest 2 - namespace import -force ::tcltest::* -} +package require tcltest 2 +namespace import -force ::tcltest::* # # These tests will run on any platform (and indeed crashed @@ -58,7 +56,7 @@ test env-1.3 {reflection of env by "array names"} { # Some tests require the "exec" command. # Skip them if exec is not defined. -::tcltest::testConstraint execCommandExists [expr {[info commands exec] != ""}] +testConstraint exec [llength [info commands exec]] set printenvScript [makeFile { proc lrem {listname name} { @@ -86,9 +84,11 @@ set printenvScript [makeFile { exit } printenv] +# [exec] is required here to see the actual environment received +# by child processes. proc getenv {} { global printenvScript tcltest - catch {exec $::tcltest::tcltest $printenvScript} out + catch {exec [interpreter] $printenvScript} out if {$out == "child process exited abnormally"} { set out {} } @@ -111,30 +111,30 @@ foreach name {TCL_LIBRARY PATH LD_LIBRARY_PATH LIBPATH DISPLAY SHLIB_PATH} { } } -test env-2.1 {adding environment variables} {execCommandExists} { +test env-2.1 {adding environment variables} {exec} { getenv } {} set env(NAME1) "test string" -test env-2.2 {adding environment variables} {execCommandExists} { +test env-2.2 {adding environment variables} {exec} { getenv } {NAME1=test string} set env(NAME2) "more" -test env-2.3 {adding environment variables} {execCommandExists} { +test env-2.3 {adding environment variables} {exec} { getenv } {NAME1=test string NAME2=more} set env(XYZZY) "garbage" -test env-2.4 {adding environment variables} {execCommandExists} { +test env-2.4 {adding environment variables} {exec} { getenv } {NAME1=test string NAME2=more XYZZY=garbage} set env(NAME2) "new value" -test env-3.1 {changing environment variables} {execCommandExists} { +test env-3.1 {changing environment variables} {exec} { set result [getenv] unset env(NAME2) set result @@ -142,28 +142,28 @@ test env-3.1 {changing environment variables} {execCommandExists} { NAME2=new value XYZZY=garbage} -test env-4.1 {unsetting environment variables} {execCommandExists} { +test env-4.1 {unsetting environment variables} {exec} { set result [getenv] unset env(NAME1) set result } {NAME1=test string XYZZY=garbage} -test env-4.2 {unsetting environment variables} {execCommandExists} { +test env-4.2 {unsetting environment variables} {exec} { set result [getenv] unset env(XYZZY) set result } {XYZZY=garbage} -test env-4.3 {setting international environment variables} {execCommandExists} { +test env-4.3 {setting international environment variables} {exec} { set env(\ua7) \ub6 getenv } "\ua7=\ub6" -test env-4.4 {changing international environment variables} {execCommandExists} { +test env-4.4 {changing international environment variables} {exec} { set env(\ua7) \ua7 getenv } "\ua7=\ua7" -test env-4.5 {unsetting international environment variables} {execCommandExists} { +test env-4.5 {unsetting international environment variables} {exec} { set env(\ub6) \ua7 unset env(\ua7) set result [getenv] |