summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-04 19:03:04 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-04 19:03:04 +0000
commit454f89e2ea99044590f7be1e9a9993cd9689f8cd (patch)
tree98c5305a2347af2bbf64fbfa755f39b642afa736 /test
parent8350b7dc04ad2af3473c91e680ca05a140243101 (diff)
* vm_insnhelper.c: Fix one type of symbol leak with +send+
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_symbol.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb
index 596f2b0..db0d135 100644
--- a/test/ruby/test_symbol.rb
+++ b/test/ruby/test_symbol.rb
@@ -238,4 +238,24 @@ 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
end