Sha256: c500f6c239e03dea7fb6a51fe134c337ec6c7a32003a939fb4b78fd0914f2b13

Contents?: true

Size: 790 Bytes

Versions: 5

Compression:

Stored size: 790 Bytes

Contents

require 'facets/hash/op'
require 'test/unit'

class TC_Hash_Op < Test::Unit::TestCase

  def test_op_and_hash
    a = { :a => 1, :b => 2 }
    b = { :a => 1 }
    r = { :a => 1 }
    assert_equal( r, a & b )
  end

  def test_op_and_hash_subarray
    a = { :a => [1], :b => [2] }
    b = { :a => [1] }
    r = { :a => [1] }
    assert_equal( r, a & b )
  end

  def test_op_and_array
    a = { :a => 1, :b => 2 }
    b = [ :a ]
    r = { :a => 1 }
    assert_equal( r, a & b )
  end

  def test_op_minus_array
    a = { :a => 1, :b => 2, :c => 3 }
    b = [ :a ]
    e = { :b => 2, :c => 3 }
    assert_equal( e, a - b )
  end

  def test_op_minus_hash
    a = { :a => 1, :b => 2, :c => 3 }
    b = { :a => 1, :d => 4 }
    e = { :b => 2, :c => 3 }
    assert_equal( e, a - b )
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
facets-2.4.0 test/hash/test_op.rb
facets-2.4.1 test/hash/test_op.rb
facets-2.4.2 test/core/hash/test_op.rb
facets-2.4.3 test/core/hash/test_op.rb
facets-2.4.4 test/core/hash/test_op.rb