From 33fd9238dc467ef70e757a917e4c8ddd2dd7d78e Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 7 May 2009 10:34:42 +0000 Subject: Fix [Bug 1513659]. --- ChangeLog | 11 ++++-- tests/env.test | 107 +++++++++++++++++++++++++++++++++++++++----------------- tests/exec.test | 17 +++++++-- 3 files changed, 97 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9a8fb7d..af2adbe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,14 @@ +2009-05-07 Donal K. Fellows + + * tests/env.test (printenvScript, env-4.3, env-4.5): [Bug 1513659]: + * tests/exec.test (exec-2.6): These tests had subtle dependencies on + being on platforms that were either ISO 8859-1 or UTF-8. Stabilized + the results by forcing the encoding. + 2009-05-06 Don Porter - * generic/tclCmdMZ.c: Improve overflow error message from - [string repeat]. [Bug 2582327] + * generic/tclCmdMZ.c: [Bug 2582327]: Improve overflow error message + from [string repeat]. * tests/interp.test: interp-20.50 test for Bug 2486550. 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) "< 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: -- cgit v0.12