Commit 0349283f authored by Jun Hiroe's avatar Jun Hiroe

Add Enumerable#first test

parent 7380acf1
......@@ -45,3 +45,11 @@ 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