diff options
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_syntax.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 42ad002b8e..6e397a9c00 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -1295,8 +1295,12 @@ eom assert_valid_syntax('proc {@1}') assert_equal(3, eval('[1,2].then {@1+@2}')) assert_equal("12", eval('[1,2].then {"#@1#@2"}')) + assert_equal(3, eval('->{@1+@2}.call(1,2)')) assert_syntax_error('proc {|| @1}', /ordinary parameter is defined/) assert_syntax_error('proc {|x| @1}', /ordinary parameter is defined/) + assert_syntax_error('->(){@1}', /ordinary parameter is defined/) + assert_syntax_error('->(x){@1}', /ordinary parameter is defined/) + assert_syntax_error('->x{@1}', /ordinary parameter is defined/) assert_syntax_error('proc {@1 = nil}', /Can't assign to numbered parameter @1/) assert_syntax_error('proc {@01}', /leading zero/) assert_syntax_error('proc {@1_}', /unexpected/) |