From acf28e835fc649c2a8597ef6244af5a8f61fa24a Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Fri, 27 Oct 2023 13:50:07 +0200 Subject: Windows: Use Unicode aware WinAPI function for ENV[]= This only makes a difference when setting an empty value to a Unicode key. --- test/ruby/test_env.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/ruby') 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 -- cgit v1.2.3