aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_hash.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_hash.rb')
-rw-r--r--test/ruby/test_hash.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index 77417ecbe0..c08908fa76 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -1306,6 +1306,12 @@ class TestHash < Test::Unit::TestCase
h = @cls[a: @cls[b: [1, 2, 3]], c: 4]
assert_equal(1, h.dig(:a, :b, 0))
assert_nil(h.dig(:c, 1))
+ o = Object.new
+ def o.dig(*args)
+ {dug: args}
+ end
+ h[:d] = o
+ assert_equal({dug: [:foo, :bar]}, h.dig(:d, :foo, :bar))
end
def test_cmp