Sha256: e02a431aa713f0b58431f7f55beb2f9e141876b6c68e4e5ad66026e5f9d50756

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
# for lib/facets/core/hash/rekey.rb
#
# Extracted Fri Feb 16 02:00:36 EST 2007
# Project.rb Test Extraction
#

require 'facets/core/hash/rekey.rb'


  require 'test/unit'

  class TestHash < Test::Unit::TestCase

    def test_01
      foo = { :a=>1, :b=>2 }
      assert_equal( { "a"=>1, "b"=>2 }, foo.rekey{|k|k.to_s} )
      assert_equal( { :a =>1, :b=>2 }, foo  )
    end

    def test_02
      foo = { :a=>1, :b=>2 }
      assert_equal( { "a"=>1, "b"=>2 }, foo.rekey!{|k|k.to_s}  )
      assert_equal( { "a"=>1, "b"=>2 }, foo )
    end

    def test_03
      foo = { :a=>1, :b=>2 }
      assert_equal( { "a"=>1, "b"=>2 }, foo.rekey(:to_s) )
      assert_equal( { :a =>1, :b=>2 }, foo  )
    end

    def test_04
      foo = { :a=>1, :b=>2 }
      assert_equal( { "a"=>1, "b"=>2 }, foo.rekey!(:to_s) )
      assert_equal( { "a"=>1, "b"=>2 }, foo )
    end

    def test_05
      foo = { "a"=>1, "b"=>2 }
      assert_equal( { :a=>1, :b=>2 }, foo.rekey! )
      assert_equal( { :a=>1, :b=>2 }, foo )
    end

  end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-1.8.49 test/lib/facets/core/hash/test_rekey.rb