summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLars Kanis <[email protected]>2023-10-27 13:50:07 +0200
committerHiroshi SHIBATA <[email protected]>2024-09-24 14:06:51 +0900
commitacf28e835fc649c2a8597ef6244af5a8f61fa24a (patch)
treefc9bc3cad5aa2089f025430462a288843b0a01a7 /test
parent7627a95e414cec5753bae514fd5490777d9afd7f (diff)
Windows: Use Unicode aware WinAPI function for ENV[]=
This only makes a difference when setting an empty value to a Unicode key.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7034
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_env.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_env.rb b/test/ruby/test_env.rb
index 4b5f18e7bb..74f4750b13 100644
--- a/test/ruby/test_env.rb
+++ b/test/ruby/test_env.rb
@@ -1485,5 +1485,15 @@ class TestEnv < Test::Unit::TestCase
ensure
ENV["test"] = test
end
+
+ def test_utf8_empty
+ key = "VAR\u{e5 e1 e2 e4 e3 101 3042}"
+ ENV[key] = "x"
+ assert_equal "x", ENV[key]
+ ENV[key] = ""
+ assert_equal "", ENV[key]
+ ENV[key] = nil
+ assert_nil ENV[key]
+ end
end
end