summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_object.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_object.rb b/test/ruby/test_object.rb
index f4a38e0ee3..271ab600a2 100644
--- a/test/ruby/test_object.rb
+++ b/test/ruby/test_object.rb
@@ -460,6 +460,24 @@ class TestObject < Test::Unit::TestCase
assert_equal([[:respond_to?, :to_ary]], called, '[bug:6000]')
end
+ def test_implicit_respond_to_arity_3
+ p = Object.new
+
+ called = []
+ p.singleton_class.class_eval do
+ define_method(:respond_to?) do |a, b, c|
+ called << [:respond_to?, a, b, c]
+ false
+ end
+ end
+
+ e = assert_raises(ArgumentError, '[bug:6000]') do
+ [[p]].flatten
+ end
+
+ assert_equal('respond_to? must accept 1 or 2 arguments (requires 3)', e.message)
+ end
+
def test_method_missing_passed_block
bug5731 = '[ruby-dev:44961]'