equal_rights_for_hash 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/equal_rights_for_hash.gemspec +1 -1
- data/lib/equal_rights_for_hash.rb +1 -1
- data/test/to_h_test.rb +10 -0
- metadata +1 -1
data/test/to_h_test.rb
CHANGED
@@ -53,4 +53,14 @@ class TestToH < Test::Unit::TestCase
|
|
53
53
|
assert_equal({}, [[1, 2, 3, 4]].to_h)
|
54
54
|
assert_equal({}, [[1, 2, 3, 4, 5]].to_h) # and so on
|
55
55
|
end
|
56
|
+
|
57
|
+
def test_works_on_enumerables
|
58
|
+
assert_equal({1 => 2, 3 => 4}, (1..4).to_a.to_h)
|
59
|
+
assert_equal({1 => 2, 3 => 4}, (1..4).to_h)
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_works_on_enumerators
|
63
|
+
assert_equal({1 => 2, 3 => 4}, (1..4).to_enum.to_a.to_h)
|
64
|
+
assert_equal({1 => 2, 3 => 4}, (1..4).to_enum.to_h)
|
65
|
+
end
|
56
66
|
end
|