summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-04-14 23:47:40 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2020-10-12 16:21:18 +0900
commit6e86e290e4bd029e3ef53be6c4ac1d52e20538af (patch)
tree9e097d86686d54a9d73f9d00ce99e20f2791d4a3 /test
parentb2398879fa4d40f65703ca819d012af4a000bbb2 (diff)
downloadmruby-6e86e290e4bd029e3ef53be6c4ac1d52e20538af.tar.gz
mruby-6e86e290e4bd029e3ef53be6c4ac1d52e20538af.zip
Rightward-assign by ASSOC.
[ruby-bugs:15921]
Diffstat (limited to 'test')
-rw-r--r--test/t/syntax.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/t/syntax.rb b/test/t/syntax.rb
index 436c06601..a52e0dcea 100644
--- a/test/t/syntax.rb
+++ b/test/t/syntax.rb
@@ -345,6 +345,15 @@ assert('splat object in assignment') do
assert_equal [2], (a = *o)
end
+assert('right-ward assignment') do
+ 1 => a
+ assert_equal(1, a)
+ 13.divmod(5) => a,b
+ assert_equal([2,3], [a, b])
+ 13.divmod(5) => a,b => c, d
+ assert_equal([2,3,2,3], [a, b, c, d])
+end
+
assert('splat object in case statement') do
o = Object.new
def o.to_a