summaryrefslogtreecommitdiffstats
path: root/tests/env.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/env.test')
-rw-r--r--tests/env.test62
1 files changed, 32 insertions, 30 deletions
diff --git a/tests/env.test b/tests/env.test
index 2d4dc8a..043748a 100644
--- a/tests/env.test
+++ b/tests/env.test
@@ -1,17 +1,17 @@
# Commands covered: none (tests environment variable implementation)
#
-# This file contains a collection of tests for one or more of the Tcl
-# built-in commands. Sourcing this file into Tcl runs the tests and
-# generates output for errors. No output means no errors were found.
+# This file contains a collection of tests for one or more of the Tcl built-in
+# commands. Sourcing this file into Tcl runs the tests and generates output
+# for errors. No output means no errors were found.
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+# 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.29 2008/07/19 09:57:37 dkf Exp $
+# RCS: @(#) $Id: env.test,v 1.30 2008/07/19 21:47:55 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -23,9 +23,8 @@ if {[lsearch [namespace children] ::tcltest] == -1} {
testConstraint exec [llength [info commands exec]]
#
-# These tests will run on any platform (and indeed crashed
-# on the Mac). So put them before you test for the existance
-# of exec.
+# These tests will run on any platform (and indeed crashed on the Mac). So put
+# them before you test for the existance of exec.
#
test env-1.1 {propagation of env values to child interpreters} -setup {
catch {interp delete child}
@@ -39,8 +38,8 @@ test env-1.1 {propagation of env values to child interpreters} -setup {
unset env(test)
} -result {garbage}
#
-# This one crashed on Solaris under Tcl8.0, so we only
-# want to make sure it runs.
+# This one crashed on Solaris under Tcl8.0, so we only want to make sure it
+# runs.
#
test env-1.2 {lappend to env value} -setup {
catch {unset env(test)}
@@ -80,7 +79,7 @@ set printenvScript [makeFile {
}
set names [lsort [array names env]]
- if {$tcl_platform(platform) == "windows"} {
+ if {$tcl_platform(platform) eq "windows"} {
lrem names HOME
lrem names COMSPEC
lrem names ComSpec
@@ -90,7 +89,7 @@ set printenvScript [makeFile {
TCL_LIBRARY PATH LD_LIBRARY_PATH LIBPATH PURE_PROG_NAME DISPLAY
SHLIB_PATH SYSTEMDRIVE SYSTEMROOT DYLD_LIBRARY_PATH DYLD_FRAMEWORK_PATH
DYLD_NEW_LOCAL_SHARED_REGIONS DYLD_NO_FIX_PREBINDING
- __CF_USER_TEXT_ENCODING SECURITYSESSIONID
+ __CF_USER_TEXT_ENCODING SECURITYSESSIONID LANG
} {
lrem names $name
}
@@ -99,12 +98,12 @@ set printenvScript [makeFile {
}
exit
} printenv]
-# [exec] is required here to see the actual environment received
-# by child processes.
+# [exec] is required here to see the actual environment received by child
+# processes.
proc getenv {} {
global printenvScript tcltest
catch {exec [interpreter] $printenvScript} out
- if {$out == "child process exited abnormally"} {
+ if {$out eq "child process exited abnormally"} {
set out {}
}
return $out
@@ -114,13 +113,13 @@ proc getenv {} {
set env2 [array get env]
foreach name [array names env] {
- # Keep some environment variables that support operation of the
- # tcltest package.
+ # Keep some environment variables that support operation of the tcltest
+ # package.
if {[string toupper $name] ni {
- TCL_LIBRARY PATH LD_LIBRARY_PATH LIBPATH DISPLAY SHLIB_PATH
- SYSTEMDRIVE SYSTEMROOT DYLD_LIBRARY_PATH DYLD_FRAMEWORK_PATH
- DYLD_NEW_LOCAL_SHARED_REGIONS DYLD_NO_FIX_PREBINDING
- SECURITYSESSIONID
+ TCL_LIBRARY PATH LD_LIBRARY_PATH LIBPATH DISPLAY SHLIB_PATH
+ SYSTEMDRIVE SYSTEMROOT DYLD_LIBRARY_PATH DYLD_FRAMEWORK_PATH
+ DYLD_NEW_LOCAL_SHARED_REGIONS DYLD_NO_FIX_PREBINDING
+ SECURITYSESSIONID LANG
}} {
unset env($name)
}
@@ -190,10 +189,9 @@ test env-5.0 {corner cases - set a value, it should exist} -body {
test env-5.1 {corner cases - remove one elem at a time} -setup {
set x [array get env]
} -body {
- # When no environment variables exist, the env var will
- # contain no entries. The "array names" call synchs up
- # the C-level environ array with the Tcl level env array.
- # Make sure an empty Tcl array is created.
+ # When no environment variables exist, the env var will contain no
+ # entries. The "array names" call synchs up the C-level environ array with
+ # the Tcl level env array. Make sure an empty Tcl array is created.
foreach e [array names env] {
unset env($e)
}
@@ -204,8 +202,8 @@ test env-5.1 {corner cases - remove one elem at a time} -setup {
test env-5.2 {corner cases - unset the env array} -setup {
interp create i
} -body {
- # Unsetting a variable in an interp detaches the C-level
- # traces from the Tcl "env" variable.
+ # Unsetting a variable in an interp detaches the C-level traces from the
+ # Tcl "env" variable.
i eval {
unset env
set env(THIS_SHOULDNT_EXIST) a
@@ -217,8 +215,8 @@ test env-5.2 {corner cases - unset the env array} -setup {
test env-5.3 {corner cases - unset the env in master should unset child} -setup {
interp create i
} -body {
- # Variables deleted in a master interp should be deleted in
- # child interp too.
+ # Variables deleted in a master interp should be deleted in child interp
+ # too.
i eval { set env(THIS_SHOULD_EXIST) a}
set result [set env(THIS_SHOULD_EXIST)]
unset env(THIS_SHOULD_EXIST)
@@ -262,3 +260,7 @@ array set env $env2
removeFile $printenvScript
::tcltest::cleanupTests
return
+
+# Local Variables:
+# mode: tcl
+# End: