Commit 555c1876 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #1883 from suzukaze/add-test-enumerable

Add enumerable test
parents 598385e2 0349283f
......@@ -41,3 +41,15 @@ assert("Enumerable#group_by") do
assert_equal [1, 4], r[1]
assert_equal [2, 5], r[2]
end
assert("Enumerable#sort_by") do
assert_equal ["car", "train", "bicycle"], %w{car bicycle train}.sort_by {|e| e.length}
end
assert("Enumerable#first") do
a = [1, 2, 3]
assert_equal 1, a.first
assert_equal [1, 2], a.first(2)
assert_equal [1, 2, 3], a.first(10)
assert_nil [].first
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment