summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2008-07-19 21:47:53 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2008-07-19 21:47:53 (GMT)
commit408b3815ace54fe1580fe6b3c0aea3403732edf1 (patch)
tree2eee09f227aaa61528ba0ec9e4f1969c3c375561
parentf7a85c74ab8ed55803fbcd9cd91a115bc1190b60 (diff)
downloadtcl-408b3815ace54fe1580fe6b3c0aea3403732edf1.zip
tcl-408b3815ace54fe1580fe6b3c0aea3403732edf1.tar.gz
tcl-408b3815ace54fe1580fe6b3c0aea3403732edf1.tar.bz2
Fix miguel's problem with env failures; need LANG to get [encoding system]
right in subprocesses...
-rw-r--r--ChangeLog4
-rw-r--r--tests/env.test62
2 files changed, 36 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index e22f543..d7c0068 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2008-07-19 Donal K. Fellows <dkf@users.sf.net>
+ * tests/env.test: Add LANG to the list of variables that are not
+ touched by the environment variable tests, so that subprocesses can
+ get their system encoding correct.
+
* tests/exec.test, tests/env.test: Rewrite so that non-ASCII
characters are not used in the final comparison. Part of fixing [Bug
1513659].
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: