summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2009-05-07 10:34:42 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2009-05-07 10:34:42 (GMT)
commit33fd9238dc467ef70e757a917e4c8ddd2dd7d78e (patch)
tree8d6391699c15edb848ea83590d018902258f0b4d /tests
parent8af7bf38453d71fecfc5e4e507d92e5220b5d5be (diff)
downloadtcl-33fd9238dc467ef70e757a917e4c8ddd2dd7d78e.zip
tcl-33fd9238dc467ef70e757a917e4c8ddd2dd7d78e.tar.gz
tcl-33fd9238dc467ef70e757a917e4c8ddd2dd7d78e.tar.bz2
Fix [Bug 1513659].
Diffstat (limited to 'tests')
-rw-r--r--tests/env.test107
-rw-r--r--tests/exec.test17
2 files changed, 88 insertions, 36 deletions
diff --git a/tests/env.test b/tests/env.test
index 043748a..7d7e5fa 100644
--- a/tests/env.test
+++ b/tests/env.test
@@ -11,7 +11,7 @@
# 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.30 2008/07/19 21:47:55 dkf Exp $
+# RCS: @(#) $Id: env.test,v 1.31 2009/05/07 10:34:42 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -61,6 +61,7 @@ test env-1.3 {reflection of env by "array names"} -setup {
} -result {1}
set printenvScript [makeFile {
+ encoding system iso8859-1
proc lrem {listname name} {
upvar $listname list
set i [lsearch -nocase $list $name]
@@ -71,7 +72,7 @@ set printenvScript [makeFile {
}
proc mangle s {
regsub -all {\[|\\|\]} $s {\\&} s
- regsub -all {[\u007f-\uffff]} $s {[manglechar &]} s
+ regsub -all {[\u0000-\u001f\u007f-\uffff]} $s {[manglechar &]} s
return [subst -novariables $s]
}
proc manglechar c {
@@ -125,60 +126,100 @@ foreach name [array names env] {
}
}
-test env-2.1 {adding environment variables} {exec} {
+# Need to run 'getenv' in known encoding, so save the current one here...
+set sysenc [encoding system]
+
+test env-2.1 {adding environment variables} -setup {
+ encoding system iso8859-1
+} -constraints {exec} -body {
getenv
-} {}
-set env(NAME1) "test string"
-test env-2.2 {adding environment variables} {exec} {
+} -cleanup {
+ encoding system $sysenc
+} -result {}
+test env-2.2 {adding environment variables} -setup {
+ encoding system iso8859-1
+} -constraints {exec} -body {
+ set env(NAME1) "test string"
getenv
-} {NAME1=test string}
-set env(NAME2) "more"
-test env-2.3 {adding environment variables} {exec} {
+} -cleanup {
+ encoding system $sysenc
+} -result {NAME1=test string}
+test env-2.3 {adding environment variables} -setup {
+ encoding system iso8859-1
+} -constraints {exec} -body {
+ set env(NAME2) "more"
getenv
-} {NAME1=test string
+} -cleanup {
+ encoding system $sysenc
+} -result {NAME1=test string
NAME2=more}
-set env(XYZZY) "garbage"
-test env-2.4 {adding environment variables} {exec} {
+test env-2.4 {adding environment variables} -setup {
+ encoding system iso8859-1
+} -constraints {exec} -body {
+ set env(XYZZY) "garbage"
getenv
-} {NAME1=test string
+} -cleanup {
+ encoding system $sysenc
+} -result {NAME1=test string
NAME2=more
XYZZY=garbage}
set env(NAME2) "new value"
-test env-3.1 {changing environment variables} {exec} {
+test env-3.1 {changing environment variables} -setup {
+ encoding system iso8859-1
+} -constraints {exec} -body {
set result [getenv]
unset env(NAME2)
set result
-} {NAME1=test string
+} -cleanup {
+ encoding system $sysenc
+} -result {NAME1=test string
NAME2=new value
XYZZY=garbage}
-test env-4.1 {unsetting environment variables} {exec} {
- set result [getenv]
- unset env(NAME1)
- set result
-} {NAME1=test string
+test env-4.1 {unsetting environment variables: default} -setup {
+ encoding system iso8859-1
+} -constraints {exec} -body {
+ getenv
+} -cleanup {
+ encoding system $sysenc
+} -result {NAME1=test string
XYZZY=garbage}
-test env-4.2 {unsetting environment variables} {exec} {
- set result [getenv]
+test env-4.2 {unsetting environment variables} -setup {
+ encoding system iso8859-1
+} -constraints {exec} -body {
+ unset env(NAME1)
+ getenv
+} -cleanup {
unset env(XYZZY)
- set result
-} {XYZZY=garbage}
-test env-4.3 {setting international environment variables} {exec} {
+ encoding system $sysenc
+} -result {XYZZY=garbage}
+test env-4.3 {setting international environment variables} -setup {
+ encoding system iso8859-1
+} -constraints {exec} -body {
set env(\ua7) \ub6
getenv
-} {\u00a7=\u00b6}
-test env-4.4 {changing international environment variables} {exec} {
+} -cleanup {
+ encoding system $sysenc
+} -result {\u00a7=\u00b6}
+test env-4.4 {changing international environment variables} -setup {
+ encoding system iso8859-1
+} -constraints {exec} -body {
set env(\ua7) \ua7
getenv
-} {\u00a7=\u00a7}
-test env-4.5 {unsetting international environment variables} {exec} {
+} -cleanup {
+ encoding system $sysenc
+} -result {\u00a7=\u00a7}
+test env-4.5 {unsetting international environment variables} -setup {
+ encoding system iso8859-1
+} -body {
set env(\ub6) \ua7
unset env(\ua7)
- set result [getenv]
+ getenv
+} -constraints {exec} -cleanup {
+ encoding system $sysenc
unset env(\ub6)
- set result
-} {\u00b6=\u00a7}
+} -result {\u00b6=\u00a7}
test env-5.0 {corner cases - set a value, it should exist} -body {
set env(temp) a
@@ -212,7 +253,7 @@ test env-5.2 {corner cases - unset the env array} -setup {
} -cleanup {
interp delete i
} -result {0}
-test env-5.3 {corner cases - unset the env in master should unset child} -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
diff --git a/tests/exec.test b/tests/exec.test
index e8b0e66..297278f 100644
--- a/tests/exec.test
+++ b/tests/exec.test
@@ -11,7 +11,7 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: exec.test,v 1.31 2008/07/21 21:25:21 nijtmans Exp $
+# RCS: @(#) $Id: exec.test,v 1.32 2009/05/07 10:34:42 dkf Exp $
package require tcltest 2
namespace import -force ::tcltest::*
@@ -114,7 +114,8 @@ proc readfile filename {
close $f
return [string trimright $d \n]
}
-
+
+# ----------------------------------------------------------------------
# Basic operations.
test exec-1.1 {basic exec operation} {exec} {
@@ -152,6 +153,8 @@ test exec-2.5 {redirecting input from immediate source} {exec} {
exec [interpreter] $path(cat) "<<Joined to arrows"
} {Joined to arrows}
test exec-2.6 {redirecting input from immediate source, with UTF} -setup {
+ set sysenc [encoding system]
+ encoding system iso8859-1
proc quotenonascii s {
regsub -all {\[|\\|\]} $s {\\&} s
regsub -all {[\u007f-\uffff]} $s \
@@ -163,6 +166,9 @@ test exec-2.6 {redirecting input from immediate source, with UTF} -setup {
# If it does, this means that the UTF -> external conversion did not occur
# before writing out the temp file.
quotenonascii [exec [interpreter] $path(cat) << "\uE9\uE0\uFC\uF1"]
+} -cleanup {
+ encoding system $sysenc
+ rename quotenonascii {}
} -result {\u00e9\u00e0\u00fc\u00f1}
# I/O redirection: output to file.
@@ -669,7 +675,8 @@ test exec-19.1 {exec >> uses O_APPEND} -constraints {exec unix} -setup {
} -cleanup {
removeFile $tmpfile
} -result 14
-
+
+# ----------------------------------------------------------------------
# cleanup
foreach file {gorp.file gorp.file2 echo echo2 cat wc sh sh2 sleep exit err} {
@@ -679,3 +686,7 @@ unset -nocomplain path
::tcltest::cleanupTests
return
+
+# Local Variables:
+# mode: tcl
+# End: