diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-06-11 22:57:33 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-04-10 15:03:58 +0900 |
commit | 1b2d351b216661e03d497dfdce216e0d51474664 (patch) | |
tree | 4151ebb30b8789a9ee87afad79fb8c8a32481ae3 /test/ruby/test_syntax.rb | |
parent | d94960f22ec2de3a3855305cb51343806d2b46c7 (diff) |
Rightward-assign by ASSOC
[Feature #15921]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3012
Diffstat (limited to 'test/ruby/test_syntax.rb')
-rw-r--r-- | test/ruby/test_syntax.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index a0c2bf62b7..04e98eca83 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -1559,6 +1559,13 @@ eom end end + def test_rightward_assign + assert_equal(1, eval("1 => a")) + assert_equal([2,3], eval("13.divmod(5) => a,b; [a, b]")) + assert_equal([2,3,2,3], eval("13.divmod(5) => a,b => c, d; [a, b, c, d]")) + assert_equal([2,3], eval("13.divmod(5)\n => a,b; [a, b]")) + end + private def not_label(x) @result = x; @not_label ||= nil end |