test_env.rb: fix test
* test/ruby/test_env.rb (test_win32_blocksize): fix remained size, and delete added envvars. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e35f127403
commit
b9c94bce7f
@ -390,13 +390,19 @@ class TestEnv < Test::Unit::TestCase
|
|||||||
|
|
||||||
if /mswin|mingw/ =~ RUBY_PLATFORM
|
if /mswin|mingw/ =~ RUBY_PLATFORM
|
||||||
def test_win32_blocksize
|
def test_win32_blocksize
|
||||||
len = 32767 - ENV.to_a.flatten.inject(0) {|r,e| r + e.size + 2 }
|
keys = []
|
||||||
|
len = 32767 - ENV.to_a.flatten.inject(0) {|r,e| r + e.bytesize + 1}
|
||||||
val = "bar" * 1000
|
val = "bar" * 1000
|
||||||
key = nil
|
key = nil
|
||||||
|
while (len -= val.size + (key="foo#{len}").size + 2) > 0
|
||||||
|
keys << key
|
||||||
|
ENV[key] = val
|
||||||
|
end
|
||||||
1.upto(12) {|i|
|
1.upto(12) {|i|
|
||||||
ENV[key] = val while (len -= val.size + (key="foo#{len}").size + 2) > 0
|
|
||||||
assert_raise(Errno::EINVAL) { ENV[key] = val }
|
assert_raise(Errno::EINVAL) { ENV[key] = val }
|
||||||
}
|
}
|
||||||
|
ensure
|
||||||
|
keys.each {|k| ENV.delete(k)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user