diff options
| author | cremno <[email protected]> | 2015-05-29 12:17:13 +0200 |
|---|---|---|
| committer | cremno <[email protected]> | 2015-05-29 12:17:13 +0200 |
| commit | ba3a0c22a52111da15c9dfea534a68d3fffd78e3 (patch) | |
| tree | 74ead0f557ffee34a4ddff23b172bfdbb7d41f86 /test/t/syntax.rb | |
| parent | b05d736b49a6d3a99b7f75c74ffd9b6613c453d3 (diff) | |
| download | mruby-ba3a0c22a52111da15c9dfea534a68d3fffd78e3.tar.gz mruby-ba3a0c22a52111da15c9dfea534a68d3fffd78e3.zip | |
add multiple assignment with rest tests
Diffstat (limited to 'test/t/syntax.rb')
| -rw-r--r-- | test/t/syntax.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/t/syntax.rb b/test/t/syntax.rb index 5ce4e0a63..41e49d938 100644 --- a/test/t/syntax.rb +++ b/test/t/syntax.rb @@ -219,6 +219,21 @@ assert('Splat without assignment') do assert_equal 1, a end +assert('multiple assignment (rest)') do + *a = 0 + assert_equal [0], a +end + +assert('multiple assignment (rest+post)') do + *a, b = 0, 1, 2 + *c, d = 3 + + assert_equal [0, 1], a + assert_equal [2], b + assert_equal [], c + assert_equal [3], d +end + assert('Return values of case statements') do a = [] << case 1 when 3 then 2 |
