summaryrefslogtreecommitdiff
path: root/test/ruby/test_method.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_method.rb')
-rw-r--r--test/ruby/test_method.rb16
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|}