Sha256: 5e5cb4ea2b8a48441ea40b8888b789f1b5ab0dac04ce61cd03afdb4613b01088
Contents?: true
Size: 476 Bytes
Versions: 2
Compression:
Stored size: 476 Bytes
Contents
# Test for facets/hash/swap require 'facets/hash/swap.rb' require 'test/unit' class TestHashRekey < Test::Unit::TestCase def test_swap! h = { :a=>1, :b=>2 } assert_equal( { :a=>2, :b=>1 }, h.swap!(:a, :b) ) end def test_swapkeys! foo = { :a=>1, :b=>2 } assert_equal( { 'a'=>1, :b=>2 }, foo.swapkey!('a', :a) ) assert_equal( { 'a'=>1, 'b'=>2 }, foo.swapkey!('b', :b) ) assert_equal( { 'a'=>1, 'b'=>2 }, foo.swapkey!('foo','bar') ) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
facets-2.2.1 | test/unit/hash/test_swap.rb |
facets-2.3.0 | test/core/hash/test_swap.rb |