diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-15 08:04:59 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-15 08:04:59 +0000 |
commit | 163c2994206805c3c717e8566878babf3621e994 (patch) | |
tree | d99a710c180ef601616fb5005e31ba0a0c2edd67 /test/ruby | |
parent | 83edc945fa7f726a9d4cb2e8668a901fef93f474 (diff) | |
download | ruby-163c2994206805c3c717e8566878babf3621e994.tar.gz |
test/ruby/test_env.rb: test memory leaks only on Windows
* test/ruby/test_env.rb (test_memory_leak_{aset,select,shift}):
test for Windows platform specific code.
(test_memory_crash_select): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_env.rb | 78 |
1 files changed, 40 insertions, 38 deletions
diff --git a/test/ruby/test_env.rb b/test/ruby/test_env.rb index 954464137b..52cc487858 100644 --- a/test/ruby/test_env.rb +++ b/test/ruby/test_env.rb @@ -509,43 +509,45 @@ class TestEnv < Test::Unit::TestCase end end - def test_memory_leak_aset - bug9977 = '[ruby-dev:48323] [Bug #9977]' - assert_no_memory_leak([], <<-'end;', "5_000.times(&doit)", bug9977, limit: 2.0) - ENV.clear - k = 'FOO' - v = (ENV[k] = 'bar'*5000 rescue 'bar'*1500) - doit = proc {ENV[k] = v} - 500.times(&doit) - end; - end - - def test_memory_leak_select - bug9978 = '[ruby-dev:48325] [Bug #9978]' - assert_no_memory_leak([], <<-'end;', "5_000.times(&doit)", bug9978, limit: 2.0) - ENV.clear - k = 'FOO' - (ENV[k] = 'bar'*5000 rescue 'bar'*1500) - doit = proc {ENV.select {break}} - 500.times(&doit) - end; - end - - def test_memory_crash_select - assert_normal_exit(<<-'end;') - 1000.times {ENV["FOO#{i}"] = 'bar'} - ENV.select {ENV.clear} - end; - end - - def test_memory_leak_shift - bug9983 = '[ruby-dev:48332] [Bug #9983]' - assert_no_memory_leak([], <<-'end;', "5_000.times(&doit)", bug9983, limit: 2.0) - ENV.clear - k = 'FOO' - v = (ENV[k] = 'bar'*5000 rescue 'bar'*1500) - doit = proc {ENV[k] = v; ENV.shift} - 500.times(&doit) - end; + if RUBY_PLATFORM =~ /bccwin|mswin|mingw/ + def test_memory_leak_aset + bug9977 = '[ruby-dev:48323] [Bug #9977]' + assert_no_memory_leak([], <<-'end;', "5_000.times(&doit)", bug9977, limit: 2.0) + ENV.clear + k = 'FOO' + v = (ENV[k] = 'bar'*5000 rescue 'bar'*1500) + doit = proc {ENV[k] = v} + 500.times(&doit) + end; + end + + def test_memory_leak_select + bug9978 = '[ruby-dev:48325] [Bug #9978]' + assert_no_memory_leak([], <<-'end;', "5_000.times(&doit)", bug9978, limit: 2.0) + ENV.clear + k = 'FOO' + (ENV[k] = 'bar'*5000 rescue 'bar'*1500) + doit = proc {ENV.select {break}} + 500.times(&doit) + end; + end + + def test_memory_crash_select + assert_normal_exit(<<-'end;') + 1000.times {ENV["FOO#{i}"] = 'bar'} + ENV.select {ENV.clear} + end; + end + + def test_memory_leak_shift + bug9983 = '[ruby-dev:48332] [Bug #9983]' + assert_no_memory_leak([], <<-'end;', "5_000.times(&doit)", bug9983, limit: 2.0) + ENV.clear + k = 'FOO' + v = (ENV[k] = 'bar'*5000 rescue 'bar'*1500) + doit = proc {ENV[k] = v; ENV.shift} + 500.times(&doit) + end; + end end end |