summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_object.rb25
-rw-r--r--test/ruby/test_proc.rb2
2 files changed, 26 insertions, 1 deletions
diff --git a/test/ruby/test_object.rb b/test/ruby/test_object.rb
index c4f0f79db3..b23a8e6498 100644
--- a/test/ruby/test_object.rb
+++ b/test/ruby/test_object.rb
@@ -396,6 +396,31 @@ class TestObject < Test::Unit::TestCase
end
end
+ def test_implicit_respond_to
+ bug5158 = '[ruby-core:38799]'
+
+ p = Object.new
+
+ called = []
+ p.singleton_class.class_eval do
+ define_method(:to_ary) do
+ called << [:to_ary, bug5158]
+ end
+ end
+ [[p]].flatten
+ assert_equal([[:to_ary, bug5158]], called, bug5158)
+
+ called = []
+ p.singleton_class.class_eval do
+ define_method(:respond_to?) do |*a|
+ called << [:respond_to?, *a]
+ false
+ end
+ end
+ [[p]].flatten
+ assert_equal([[:respond_to?, :to_ary, true]], called, bug5158)
+ end
+
def test_send_with_no_arguments
assert_raise(ArgumentError) { 1.send }
end
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb
index efd5a269fd..3cac94a100 100644
--- a/test/ruby/test_proc.rb
+++ b/test/ruby/test_proc.rb
@@ -787,7 +787,7 @@ class TestProc < Test::Unit::TestCase
end
def test_splat_without_respond_to
- def (obj = Object.new).respond_to?(m); false end
+ def (obj = Object.new).respond_to?(m,*); false end
[obj].each do |a, b|
assert_equal([obj, nil], [a, b], '[ruby-core:24139]')
end