Updated koans from src.

This commit is contained in:
Jim Weirich
2010-09-28 14:17:46 -04:00
parent c0bbe773d9
commit b41d6167b4
11 changed files with 174 additions and 28 deletions

View File

@@ -5,7 +5,7 @@ class AboutArrayAssignment < EdgeCase::Koan
names = ["John", "Smith"]
assert_equal __, names
end
def test_parallel_assignments
first_name, last_name = ["John", "Smith"]
assert_equal __, first_name
@@ -18,13 +18,19 @@ class AboutArrayAssignment < EdgeCase::Koan
assert_equal __, last_name
end
def test_parallel_assignments_with_extra_variables
def test_parallel_assignments_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_too_few_variables
first_name, last_name = ["Cher"]
assert_equal __, first_name
assert_equal __, last_name
end
def test_parallel_assignements_with_subarrays
def test_parallel_assignments_with_subarrays
first_name, last_name = [["Willie", "Rae"], "Johnson"]
assert_equal __, first_name
assert_equal __, last_name