diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-05 02:10:44 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-05 02:10:44 +0000 |
commit | 0e414175fdcc19550fe44cc1ad8cb4827d2e3da8 (patch) | |
tree | 172ab605be5bd5b23fa69dd8364739bf3cb988ae /test/ruby/test_symbol.rb | |
parent | 9e57ac56a38be03ed197dc63019626eb465c8e38 (diff) | |
download | ruby-0e414175fdcc19550fe44cc1ad8cb4827d2e3da8.tar.gz |
test_inadvertent_creation.rb: move tests
* test/-ext-/symbol/test_inadvertent_creation.rb: move symbol leak
tests, for implementation details, from test/ruby/test_symbol.rb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_symbol.rb')
-rw-r--r-- | test/ruby/test_symbol.rb | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb index 6606b51112..596f2b09f6 100644 --- a/test/ruby/test_symbol.rb +++ b/test/ruby/test_symbol.rb @@ -238,69 +238,4 @@ class TestSymbol < Test::Unit::TestCase 200_000.times { |i| i.to_s.to_sym } end; end - - def assert_no_immortal_symbol_created - delta = -Symbol.all_symbols.size - yield - GC.start - delta += Symbol.all_symbols.size - assert_equal 0, delta, "#{delta} immortal symbols were created" - end - - def test_symbol_send_leak_string - assert_no_immortal_symbol_created do - 10.times { 42.send "send should not leak #{i} - str" rescue nil } - end - end - - def test_symbol_send_leak_symbol - assert_no_immortal_symbol_created do - 10.times { 42.send "send should not leak #{i} - sym".to_sym rescue nil } - end - end - - def test_symbol_send_leak_string_custom_method_missing - x = Object.new - def x.method_missing(*); end - assert_no_immortal_symbol_created do - 10.times { |i| x.send "send should not leak #{i} - str mm" } - end - end if false - - def test_symbol_send_leak_symbol_custom_method_missing - x = Object.new - def x.method_missing(*); end - assert_no_immortal_symbol_created do - 10.times { |i| x.send "send should not leak #{i} - sym mm".to_sym } - end - end if false - - def test_symbol_send_leak_string_no_optimization - assert_no_immortal_symbol_created do - 10.times { 42.method(:send).call "send should not leak #{i} - str slow" rescue nil } - end - end - - def test_symbol_send_leak_symbol_no_optimization - assert_no_immortal_symbol_created do - 10.times { 42.method(:send).call "send should not leak #{i} - sym slow".to_sym rescue nil } - end - end - - def test_symbol_send_leak_string_custom_method_missing_no_optimization - x = Object.new - def x.method_missing(*); end - assert_no_immortal_symbol_created do - 10.times { |i| x.method(:send).call "send should not leak #{i} - str mm slow" } - end - end - - def test_symbol_send_leak_symbol_custom_method_missing_no_optimization - x = Object.new - def x.method_missing(*); end - assert_no_immortal_symbol_created do - 10.times { |i| x.method(:send).call "send should not leak #{i} - sym mm slow".to_sym } - end - end - end |