Sha256: ba258d47f9a1ba141416bd4948e068a1d56c78813c0108bde586bb6ff1fa8278

Contents?: true

Size: 583 Bytes

Versions: 2

Compression:

Stored size: 583 Bytes

Contents

require "minitest/autorun"
require "shenanigans/hash/has_shape_pred"

class HasShape < Minitest::Test
  def setup
    @hash = {
      k1: 1.0,
      k2: 1,
      k3: {
        k4: "1",
        k5: {
          k6: Array
        }
      }
    }
  end

  def test_has_shape
    shape_pass = {
      k1: Float,
      k2: Integer,
      k3: {
        k4: String,
        k5: {
          k6: Class
        }
      }
    }

    assert @hash.has_shape?(shape_pass)
  end

  def test_has_shape_fail
    shape_fail = {
      k1: Float
    }

    assert !@hash.has_shape?(shape_fail)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shenanigans-1.0.15 test/hash/has_shape_pred_test.rb
shenanigans-1.0.14 test/hash/has_shape_pred_test.rb