aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_symbol.rb
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-04 19:03:20 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-04 19:03:20 +0000
commit6ae6a8c7bc86e9740850e64125deceb7d8a01fce (patch)
treeb29246b2a5fa032c7f81402ba98bd30bf881f4ba /test/ruby/test_symbol.rb
parent454f89e2ea99044590f7be1e9a9993cd9689f8cd (diff)
downloadruby-6ae6a8c7bc86e9740850e64125deceb7d8a01fce.tar.gz
* vm_insnhelper.c: Fix symbol leak with +send+ and method_missing [#10828]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_symbol.rb')
-rw-r--r--test/ruby/test_symbol.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb
index db0d135b90..5d2e2c3267 100644
--- a/test/ruby/test_symbol.rb
+++ b/test/ruby/test_symbol.rb
@@ -258,4 +258,20 @@ class TestSymbol < Test::Unit::TestCase
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
+
+ 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
end