diff options
Diffstat (limited to 'test/prism')
| -rw-r--r-- | test/prism/errors_test.rb | 7 | ||||
| -rw-r--r-- | test/prism/location_test.rb | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/test/prism/errors_test.rb b/test/prism/errors_test.rb index d1af9a5dae..60322585f0 100644 --- a/test/prism/errors_test.rb +++ b/test/prism/errors_test.rb @@ -2069,6 +2069,13 @@ module Prism ], compare_ripper: false # Ripper does not check 'both block arg and actual block given'. end + def test_it_with_ordinary_parameter + source = "proc { || it }" + errors = [["`it` is not allowed when an ordinary parameter is defined", 10..12]] + + assert_errors expression(source), source, errors, compare_ripper: false + end + private def assert_errors(expected, source, errors, compare_ripper: RUBY_ENGINE == "ruby") diff --git a/test/prism/location_test.rb b/test/prism/location_test.rb index e5b7546925..a36f5fe011 100644 --- a/test/prism/location_test.rb +++ b/test/prism/location_test.rb @@ -570,6 +570,12 @@ module Prism def test_LocalVariableReadNode assert_location(LocalVariableReadNode, "foo = 1; foo", 9...12) + assert_location(LocalVariableReadNode, "-> { it }", 5...7) do |node| + node.body.body.first + end + assert_location(LocalVariableReadNode, "foo { it }", 6...8) do |node| + node.block.body.body.first + end end def test_LocalVariableTargetNode |
