diff options
Diffstat (limited to 'test/ruby/test_hash.rb')
-rw-r--r-- | test/ruby/test_hash.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index e8f0f87326..ee51c8ed7d 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -1302,6 +1302,12 @@ class TestHash < Test::Unit::TestCase x = x end + def test_dig + h = @cls[a: @cls[b: [1, 2, 3]], c: 4] + assert_equal(1, h.dig(:a, :b, 0)) + assert_nil(h.dig(:c, 1)) + end + class TestSubHash < TestHash class SubHash < Hash def reject(*) |