Cool test; Still can't believe there is no standard implementation of first/rest

This commit is contained in:
Srdjan Pejic
2010-09-23 21:06:40 -04:00
committed by Jim Weirich
parent 1dcd9babd4
commit 6fb8e3c3af

View File

@@ -12,6 +12,12 @@ class AboutArrayAssignment < EdgeCase::Koan
assert_equal __("Smith"), last_name
end
def test_parallel_assigments_with_splat_operator
first_name, *last_name = ["John", "Smith", "III"]
assert_equal "John", first_name
assert_equal ["Smith","III"], last_name
end
def test_parallel_assignments_with_extra_values
first_name, last_name = ["John", "Smith", "III"]
assert_equal __("John"), first_name