/vendor/gems/facets-2.4.5/test/core/hash/test_op_and.rb

https://bitbucket.org/mediashelf/fedora-migrator · Ruby · 28 lines · 22 code · 6 blank · 0 comment · 0 complexity · 1c52dea6694b978066921d5247a40f78 MD5 · raw file

  1. require 'facets/hash/op_and'
  2. require 'test/unit'
  3. class TC_Hash_Op < Test::Unit::TestCase
  4. def test_op_and_hash
  5. a = { :a => 1, :b => 2 }
  6. b = { :a => 1 }
  7. r = { :a => 1 }
  8. assert_equal( r, a & b )
  9. end
  10. def test_op_and_hash_subarray
  11. a = { :a => [1], :b => [2] }
  12. b = { :a => [1] }
  13. r = { :a => [1] }
  14. assert_equal( r, a & b )
  15. end
  16. def test_op_and_array
  17. a = { :a => 1, :b => 2 }
  18. b = [ :a ]
  19. r = { :a => 1 }
  20. assert_equal( r, a & b )
  21. end
  22. end