diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-03-06 11:16:34 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-03-06 11:16:34 +0000 |
commit | 7fed9a2df50404c734504e0405ecaa98f0d9147c (patch) | |
tree | 19be6a0efc6648be92de6e03e4ff7666923782fc /test/ruby | |
parent | a679e98e64a7c69d65578b11ef072e1115d536ad (diff) | |
download | ruby-7fed9a2df50404c734504e0405ecaa98f0d9147c.tar.gz |
proc.c: call respond_to_missing? with a symbol
[ruby-core:91683] [Bug #15640]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_method.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index 6647ff86f4..f313279f62 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -494,6 +494,22 @@ class TestMethod < Test::Unit::TestCase assert_include mmethods, :meth, 'normal methods are public by default' end + def test_respond_to_missing_argument + obj = Struct.new(:mid).new + def obj.respond_to_missing?(id, *) + self.mid = id + true + end + assert_kind_of(Method, obj.method("bug15640")) + assert_kind_of(Symbol, obj.mid) + assert_equal("bug15640", obj.mid.to_s) + + arg = Struct.new(:to_str).new("bug15640_2") + assert_kind_of(Method, obj.method(arg)) + assert_kind_of(Symbol, obj.mid) + assert_equal("bug15640_2", obj.mid.to_s) + end + define_method(:pm0) {||} define_method(:pm1) {|a|} define_method(:pm2) {|a, b|} |