Sha256: f96b375f6b6bdab8130f5af0130b4996cb7c82fad9a742fbf819920462bf299f

Contents?: true

Size: 396 Bytes

Versions: 10

Compression:

Stored size: 396 Bytes

Contents

require 'facets/hash/update_keys'
require 'test/unit'

class TC_Hash_Update_Keys < Test::Unit::TestCase

  def test_update_keys_01
    h = { 'A' => 1, 'B' => 2 }
    h.update_keys{ |k| k.downcase }
    assert_equal( { 'a' => 1, 'b' => 2 }, h)
  end

  def test_update_keys_02
    h = { :a => 1, :b => 2 }
    h.update_keys{ |k| "#{k}!" }
    assert_equal( { "a!" => 1, "b!" => 2 }, h)
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
facets-2.8.4 test/core/hash/test_update_keys.rb
facets-2.8.3 test/core/hash/test_update_keys.rb
facets-2.8.2 test/core/hash/test_update_keys.rb
facets-2.8.1 test/core/hash/test_update_keys.rb
facets-2.8.0 test/core/hash/test_update_keys.rb
facets-2.7.0 test/core/hash/test_update_keys.rb
facets-2.6.0 test/core/hash/test_update_keys.rb
facets-2.5.0 test/core/hash/test_update_keys.rb
facets-2.5.1 test/core/hash/test_update_keys.rb
facets-2.5.2 test/core/hash/test_update_keys.rb