/vendor/gems/facets-2.4.5/test/core/hash/test_slice.rb
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
- require 'facets/hash/slice'
- require 'test/unit'
- class TC_Hash_Slice < Test::Unit::TestCase
- def test_slice
- h = {:a=>1,:b=>2,:c=>3}
- e = {:b=>2, :a=>1}
- assert_equal(e, h.slice(:a, :b))
- end
- def test_slice!
- h = {:a=>1,:b=>2,:c=>3}
- e = {:c=>3}
- assert_equal(e, h.slice!(:a, :b))
- assert_equal({:a=>1,:b=>2}, h)
- end
- end