summaryrefslogtreecommitdiffhomepage
path: root/test/t/syntax.rb
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2015-05-31 17:02:45 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2015-05-31 17:02:45 +0900
commit8dd6b0fd09eb057d51192da634ecddfee9154d89 (patch)
tree46f242dff002a3bf85d68686f7eb842b2d133a05 /test/t/syntax.rb
parentb720cb635ab8c13832ac57cf11d07a3d848b8bd1 (diff)
parentba3a0c22a52111da15c9dfea534a68d3fffd78e3 (diff)
downloadmruby-8dd6b0fd09eb057d51192da634ecddfee9154d89.tar.gz
mruby-8dd6b0fd09eb057d51192da634ecddfee9154d89.zip
Merge branch 'failing-multiple-assignments-with-rest-tests' of https://github.com/cremno/mruby into cremno-failing-multiple-assignments-with-rest-tests
Diffstat (limited to 'test/t/syntax.rb')
-rw-r--r--test/t/syntax.rb15
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