mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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'
This commit is contained in:
parent
e32fe3ce76
commit
70cefcfa0f
Notes:
git
2021-09-20 00:16:01 +09:00
1 changed files with 7 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue