PageRenderTime 29ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/mediashelf/fedora-migrator
Ruby | 20 lines | 15 code | 5 blank | 0 comment | 0 complexity | ecf9960187a18748573aba297a3c6968 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, IPL-1.0, AGPL-1.0, LGPL-3.0
  1. require 'facets/hash/slice'
  2. require 'test/unit'
  3. class TC_Hash_Slice < Test::Unit::TestCase
  4. def test_slice
  5. h = {:a=>1,:b=>2,:c=>3}
  6. e = {:b=>2, :a=>1}
  7. assert_equal(e, h.slice(:a, :b))
  8. end
  9. def test_slice!
  10. h = {:a=>1,:b=>2,:c=>3}
  11. e = {:c=>3}
  12. assert_equal(e, h.slice!(:a, :b))
  13. assert_equal({:a=>1,:b=>2}, h)
  14. end
  15. end