aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-20 02:14:57 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-20 02:14:57 +0000
commit20c5662da763b68e41bddb6b94c7e6206d9aa9a1 (patch)
treee30b055f59b9fde1c6307adfd4ddc179762086dd /test
parent4b44adefe308ec6fae37e4ce6484d66689a98755 (diff)
downloadruby-20c5662da763b68e41bddb6b94c7e6206d9aa9a1.tar.gz
* proc.c (rb_mod_define_method): should check Symbol or not.
[Bug #11850] * test/ruby/test_method.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_method.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb
index cc2c9873c5..1e5f05473c 100644
--- a/test/ruby/test_method.rb
+++ b/test/ruby/test_method.rb
@@ -939,4 +939,18 @@ class TestMethod < Test::Unit::TestCase
assert_equal([:m1, :m2, :m3].sort, MethodInMethodClass.public_instance_methods(false).sort)
assert_equal([].sort, MethodInMethodClass.private_instance_methods(false).sort)
end
+
+ def test_define_method_with_symbol
+ assert_normal_exit %q{
+ define_method(:foo, &:to_s)
+ define_method(:bar, :to_s.to_proc)
+ }, '[Bug #11850]'
+ c = Class.new{
+ define_method(:foo, &:to_s)
+ define_method(:bar, :to_s.to_proc)
+ }
+ obj = c.new
+ assert_equal('1', obj.foo(1))
+ assert_equal('1', obj.bar(1))
+ end
end