Sha256: 82adf7800beecbe9f1d1ddc624dc45273c56c135fedd2ef3e2236f3d2ca0668b

Contents?: true

Size: 482 Bytes

Versions: 16

Compression:

Stored size: 482 Bytes

Contents

require 'facets/hash/traverse'
require 'test/unit'

class TC_Hash_Traverse < Test::Unit::TestCase

  def test_traverse
    h = { "A" => "x", "B" => "y" }
    h2 = h.traverse { |k,v| [k.downcase, v.upcase] }
    e = { "a" => "X", "b" => "Y" }
    assert_not_equal( h, h2 )
    assert_equal( e, h2 )
  end

  def test_traverse!
    h = { "A" => "x", "B" => "y" }
    h.traverse! { |k,v| [k.downcase, v.upcase] }
    e = { "a" => "X", "b" => "Y" }
    assert_equal( e, h )
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
facets-2.8.4 test/core/hash/test_traverse.rb
facets-2.8.3 test/core/hash/test_traverse.rb
facets-2.8.2 test/core/hash/test_traverse.rb
facets-2.8.1 test/core/hash/test_traverse.rb
facets-2.8.0 test/core/hash/test_traverse.rb
facets-2.7.0 test/core/hash/test_traverse.rb
facets-2.6.0 test/core/hash/test_traverse.rb
facets-2.4.0 test/hash/test_traverse.rb
facets-2.4.1 test/hash/test_traverse.rb
facets-2.4.2 test/core/hash/test_traverse.rb
facets-2.4.4 test/core/hash/test_traverse.rb
facets-2.4.3 test/core/hash/test_traverse.rb
facets-2.4.5 test/core/hash/test_traverse.rb
facets-2.5.1 test/core/hash/test_traverse.rb
facets-2.5.0 test/core/hash/test_traverse.rb
facets-2.5.2 test/core/hash/test_traverse.rb