diff options
Diffstat (limited to 'spec/inputs/test/param_destructure_spec.yue')
| -rw-r--r-- | spec/inputs/test/param_destructure_spec.yue | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/spec/inputs/test/param_destructure_spec.yue b/spec/inputs/test/param_destructure_spec.yue index 4659031..5b9ef83 100644 --- a/spec/inputs/test/param_destructure_spec.yue +++ b/spec/inputs/test/param_destructure_spec.yue | |||
| @@ -38,10 +38,10 @@ describe "parameter destructuring", -> | |||
| 38 | assert.same result, {1, 2, 3} | 38 | assert.same result, {1, 2, 3} |
| 39 | 39 | ||
| 40 | it "should support mixed array and object", -> | 40 | it "should support mixed array and object", -> |
| 41 | f = ([first], {key: :value}) -> | 41 | f = ([first,], {key: :value}) -> |
| 42 | {first, value} | 42 | {first, value} |
| 43 | 43 | ||
| 44 | result = f [1], {key: "test"} | 44 | result = f [1,], {key: value: "test"} |
| 45 | assert.same result, {1, "test"} | 45 | assert.same result, {1, "test"} |
| 46 | 46 | ||
| 47 | it "should work with fat arrow", -> | 47 | it "should work with fat arrow", -> |
| @@ -54,7 +54,7 @@ describe "parameter destructuring", -> | |||
| 54 | assert.same result, 130 | 54 | assert.same result, 130 |
| 55 | 55 | ||
| 56 | it "should handle missing keys", -> | 56 | it "should handle missing keys", -> |
| 57 | f = (:a, :b = "default", :c = "missing") -> | 57 | f = ({:a, :b = "default", :c = "missing"}) -> |
| 58 | {a, b, c} | 58 | {a, b, c} |
| 59 | 59 | ||
| 60 | result = f a: 1 | 60 | result = f a: 1 |
| @@ -89,10 +89,10 @@ describe "parameter destructuring", -> | |||
| 89 | assert.same result, {1, {2, 3, 4}} | 89 | assert.same result, {1, {2, 3, 4}} |
| 90 | 90 | ||
| 91 | it "should support spreading", -> | 91 | it "should support spreading", -> |
| 92 | f = (...rest, :last) -> | 92 | f = ({...rest, :last}) -> |
| 93 | {rest, last} | 93 | {rest, last} |
| 94 | 94 | ||
| 95 | result = f 1, 2, 3, {last: "final"} | 95 | result = f {1, 2, 3, last: "final"} |
| 96 | assert.same result, {{1, 2, 3}, 'final'} | 96 | assert.same result, {{1, 2, 3}, 'final'} |
| 97 | 97 | ||
| 98 | it "should work with table comprehensions", -> | 98 | it "should work with table comprehensions", -> |
| @@ -103,8 +103,8 @@ describe "parameter destructuring", -> | |||
| 103 | assert.same result, {2, 4, 6} | 103 | assert.same result, {2, 4, 6} |
| 104 | 104 | ||
| 105 | it "should handle nil arguments", -> | 105 | it "should handle nil arguments", -> |
| 106 | f = (:a = "nil_a", :b = "nil_b") -> | 106 | f = ({:a = "nil_a", :b = "nil_b"}) -> |
| 107 | {a, b} | 107 | {a, b} |
| 108 | 108 | ||
| 109 | result = f nil, nil | 109 | result = f {} |
| 110 | assert.same result, {'nil_a', 'nil_b'} | 110 | assert.same result, {"nil_a", "nil_b"} |
