summaryrefslogtreecommitdiffstats
path: root/tests/env.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/env.test')
-rw-r--r--tests/env.test20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/env.test b/tests/env.test
index 79a353a..4af46c3 100644
--- a/tests/env.test
+++ b/tests/env.test
@@ -219,6 +219,26 @@ test env-2.4 {
NAME2=more
XYZZY=garbage}
+test env-2.5 {different encoding (wide chars)} -constraints {win exec} -setup {
+ # be sure set of (unicode) environment occurs if single-byte encoding is used:
+ encodingswitch cp1252
+ # german (cp1252) and russian (cp1251) characters together encoded as utf-8:
+ set val 2d2dc3a4c3b6c3bcc39f2dd182d0b5d181d1822d2d
+ set env(XYZZY) [encoding convertfrom utf-8 [binary decode hex $val]]
+ # now switch to utf-8 (to see correct values from test):
+ encoding system utf-8
+} -body {
+ exec [interpreter] << [string map [list \$val $val] {
+ encoding system utf-8; fconfigure stdout -encoding utf-8
+ set test [encoding convertfrom utf-8 [binary decode hex $val]]
+ puts "[expr {$env(XYZZY) eq $test}] \ngot:\t\
+ $env(XYZZY) ([binary encode hex [encoding convertto $env(XYZZY)]]) \nexp:\t\
+ $test ([binary encode hex [encoding convertto $test]])"
+ }]
+} -cleanup {
+ encodingrestore
+ unset -nocomplain val f env(XYZZY)
+} -match glob -result {1 *}
test env-3.1 {
changing environment variables