aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-11 13:18:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-11 13:18:55 +0000
commit2ad37dbe3fc0a91d955ec62be1a49eee36753cde (patch)
tree773d6580d52dace6d6f2713eeee2b5e84726d395 /test/ruby
parent70da42ebeb6a88e4a1b138587b58752929527e6f (diff)
downloadruby-2ad37dbe3fc0a91d955ec62be1a49eee36753cde.tar.gz
hash.c: env block size limit on Windows
* hash.c (ruby_setenv): do not check environment block size. c.f. https://msdn.microsoft.com/en-us/library/windows/desktop/ms682653(v=vs.85).aspx Starting with Windows Vista and Windows Server 2008, there is no technical limitation on the size of the environment block. [ruby-core:88400] [Bug #14979] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_env.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/test/ruby/test_env.rb b/test/ruby/test_env.rb
index 2f4923fbd9..892e9b7bd6 100644
--- a/test/ruby/test_env.rb
+++ b/test/ruby/test_env.rb
@@ -457,7 +457,7 @@ class TestEnv < Test::Unit::TestCase
def test_huge_value
huge_value = "bar" * 40960
ENV["foo"] = "bar"
- if /mswin|mingw/ =~ RUBY_PLATFORM
+ if /mswin|mingw/ =~ RUBY_PLATFORM && windows_version < 6
assert_raise(Errno::EINVAL) { ENV["foo"] = huge_value }
assert_equal("bar", ENV["foo"])
else
@@ -467,6 +467,10 @@ class TestEnv < Test::Unit::TestCase
end
if /mswin|mingw/ =~ RUBY_PLATFORM
+ def windows_version
+ @windows_version ||= %x[ver][/Version (\d+)/, 1].to_i
+ end
+
def test_win32_blocksize
keys = []
len = 32767 - ENV.to_a.flatten.inject(1) {|r,e| r + e.bytesize + 1}
@@ -476,9 +480,15 @@ class TestEnv < Test::Unit::TestCase
keys << key
ENV[key] = val
end
- 1.upto(12) {|i|
- assert_raise(Errno::EINVAL) { ENV[key] = val }
- }
+ if windows_version < 6
+ 1.upto(12) {|i|
+ assert_raise(Errno::EINVAL) { ENV[key] = val }
+ }
+ else
+ 1.upto(12) {|i|
+ assert_nothing_raised(Errno::EINVAL) { ENV[key] = val }
+ }
+ end
ensure
keys.each {|k| ENV.delete(k)}
end