Sha256: 26ef3d6f0ee7bab6a45584a71149ff457d62f265990fe9ce6aeef299d6679600

Contents?: true

Size: 435 Bytes

Versions: 4

Compression:

Stored size: 435 Bytes

Contents

require 'helper'

class TestArrayIndex < Test::Unit::TestCase

  context "Arrays" do

    should "have an to_h method converting key-value pairs to a hash" do
      assert_respond_to [], :to_h
      assert_equal({}, [].to_h)
      assert_equal({:a=>11, :b=>22}, [[:a,11], [:b,22]].to_h)
      assert_equal({:a=>11, :b=>[22,33]}, [[:a,11], [:b,22,33]].to_h)
      assert_equal({1=>nil, 2=>nil, 3=>nil}, [1,2,3].to_h)
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
modalsupport-0.9.2 test/test_array_to_h.rb
modalsupport-0.9.1 test/test_array_to_h.rb
modalsupport-0.9.0 test/test_array_to_h.rb
modalsupport-0.8.3 test/test_array_to_h.rb