summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorLars Kanis <kanis@comcard.de>2021-06-22 08:52:49 +0200
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-09-20 00:15:30 +0900
commit70cefcfa0f769f7269cf0c950a4516036dd1a1ea (patch)
tree5080f6b91bb3e397a3ff6b7d17d61ca7cabd5456 /test/ruby
parente32fe3ce7611f58f260959f96757704aee17a18e (diff)
Adjust test to set+get big values on all platforms and add MINGW-UCRT
Previously the test verified on MSWIN that huge values can not be stored in environment variables but that they can on others. IMHO the intention of the test should not change between platforms. Therefore this adjusts the test to have the same intention - that is to store a big value. This also fixes compatibility with MINGW-UCRT, which previously failed with: <Errno::EINVAL: Invalid argument - ruby_setenv(foo)> test/ruby/test_env.rb:512:in `[]=' test/ruby/test_env.rb:512:in `block in test_huge_value'
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4599
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_env.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/ruby/test_env.rb b/test/ruby/test_env.rb
index 583b432e3d..ea0f367334 100644
--- a/test/ruby/test_env.rb
+++ b/test/ruby/test_env.rb
@@ -503,15 +503,15 @@ class TestEnv < Test::Unit::TestCase
end
def test_huge_value
- huge_value = "bar" * 40960
- ENV["foo"] = "bar"
- if /mswin/ =~ RUBY_PLATFORM
- assert_raise(Errno::EINVAL) { ENV["foo"] = huge_value }
- assert_equal("bar", ENV["foo"])
+ if /mswin/ =~ RUBY_PLATFORM || /ucrt/ =~ RbConfig::CONFIG['sitearch']
+ # On Windows >= Vista each environment variable can be max 32768 characters
+ huge_value = "bar" * 10900
else
- assert_nothing_raised { ENV["foo"] = huge_value }
- assert_equal(huge_value, ENV["foo"])
+ huge_value = "bar" * 40960
end
+ ENV["foo"] = "overwritten"
+ assert_nothing_raised { ENV["foo"] = huge_value }
+ assert_equal(huge_value, ENV["foo"])
end
if /mswin|mingw/ =~ RUBY_PLATFORM