Sha256: 6f275955df889e915048ce04d1a6a78dd6103e219fc2acfde833bede2193583f

Contents?: true

Size: 322 Bytes

Versions: 6

Compression:

Stored size: 322 Bytes

Contents

require_relative '../test_helper'
DuckPuncher.punch! :Object

class HashTest < MiniTest::Test
  def test_dig
    my_hash = { a: 1, b: { c: 2 } }.punch
    assert_equal my_hash.dig(:a), 1
    assert_equal my_hash.dig(:b, :a), nil
    assert_equal my_hash.dig(:b, :c), 2
    assert_equal my_hash.dig(:b), { c: 2 }
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
duck_puncher-2.9.3 test/duck_puncher/hash_test.rb
duck_puncher-2.9.2 test/duck_puncher/hash_test.rb
duck_puncher-2.9.1 test/duck_puncher/hash_test.rb
duck_puncher-2.9.0 test/duck_puncher/hash_test.rb
duck_puncher-2.8.0 test/duck_puncher/hash_test.rb
duck_puncher-2.7.0 test/duck_puncher/hash_test.rb