summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorKOBAYASHI Shuji <[email protected]>2019-12-21 18:43:09 +0900
committerKOBAYASHI Shuji <[email protected]>2019-12-21 18:54:15 +0900
commit74f564b0bb2f886ffc1c7ccd2a8c49c4265ad9dd (patch)
treeff5ffc1e9cc74c09fbe2a64a2bd4c4fcdc4377cb /test
parent5cc595cb2a057deff4c123425c9384f8e59e5e34 (diff)
downloadmruby-74f564b0bb2f886ffc1c7ccd2a8c49c4265ad9dd.tar.gz
mruby-74f564b0bb2f886ffc1c7ccd2a8c49c4265ad9dd.zip
`_0` is not numbered parameter
#### Before this patch: ```console $ bin/mruby rb -e '_0=:l; p ->{_0}.()' -e:1:13: _0 is not available -e:1:13: syntax error, unexpected $end, expecting '}' ``` #### After this patch (same as Ruby): ```console $ bin/mruby rb -e '_0=:l; p ->{_0}.()' :l ```
Diffstat (limited to 'test')
-rw-r--r--test/t/syntax.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/t/syntax.rb b/test/t/syntax.rb
index af63fcef9..4404de4d4 100644
--- a/test/t/syntax.rb
+++ b/test/t/syntax.rb
@@ -672,7 +672,6 @@ assert 'keyword arguments' do
assert_equal([:a, nil, :c], m(a: :a, c: :c))
end
-
assert('numbered parameters') do
assert_equal(15, [1,2,3,4,5].reduce {_1+_2})
assert_equal(3, ->{_1+_2}.call(1,2))
@@ -680,3 +679,8 @@ assert('numbered parameters') do
assert_equal(5, -> a: ->{_1} {a}.call.call(5))
assert_equal(45, Proc.new do _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 end.call(*[1, 2, 3, 4, 5, 6, 7, 8, 9]))
end
+
+assert('_0 is not numbered parameter') do
+ _0 = :l
+ assert_equal(:l, ->{_0}.call)
+end