Cool test; Still can't believe there is no standard implementation of first/rest
authorSrdjan Pejic <srdjan@themarknews.com>
Fri, 24 Sep 2010 01:06:40 +0000 (21:06 -0400)
committerJim Weirich <jim.weirich@gmail.com>
Tue, 28 Sep 2010 18:11:08 +0000 (14:11 -0400)
src/about_array_assignment.rb

index 659ce6b..035d5bb 100644 (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