summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_hash.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index 3baba6a0b7..8b6910cf3b 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -1324,6 +1324,15 @@ class TestHash < Test::Unit::TestCase
assert_equal({dug: [:foo, :bar]}, h.dig(:d, :foo, :bar))
end
+ def test_dig_with_respond_to
+ bug12030 = '[ruby-core:73556] [Bug #12030]'
+ o = Object.new
+ def o.respond_to?(*args)
+ super
+ end
+ assert_raise(TypeError) {{foo: o}.dig(:foo, :foo)}
+ end
+
def test_cmp
h1 = {a:1, b:2}
h2 = {a:1, b:2, c:3}