Cool test; Still can't believe there is no standard implementation of first/rest
This commit is contained in:
committed by
Jim Weirich
parent
1dcd9babd4
commit
6fb8e3c3af
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user