aboutsummaryrefslogtreecommitdiffstats
path: root/test/prism/errors_test.rb
diff options
context:
space:
mode:
authorHaldun Bayhantopcu <haldun@github.com>2023-10-05 08:15:23 +0200
committergit <svn-admin@ruby-lang.org>2023-10-05 11:25:32 +0000
commitfb9795cf7a25d675d1fd525997fd002a16f46aec (patch)
tree344eaae34122e8a7cac7683f565e687957b7b673 /test/prism/errors_test.rb
parent54f1d398d9a8e91d64aaa739c666292f3ff3f867 (diff)
downloadruby-fb9795cf7a25d675d1fd525997fd002a16f46aec.tar.gz
[ruby/prism] Fix parsing shadow args in lambda blocks
https://github.com/ruby/prism/commit/53efaf252d
Diffstat (limited to 'test/prism/errors_test.rb')
-rw-r--r--test/prism/errors_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/prism/errors_test.rb b/test/prism/errors_test.rb
index 399653ef3e..cb58b3cd21 100644
--- a/test/prism/errors_test.rb
+++ b/test/prism/errors_test.rb
@@ -1363,6 +1363,16 @@ module Prism
]
end
+ def test_shadow_args_in_lambda
+ source = "->a;b{}"
+ assert_errors expression(source), source, [
+ ["Expected a `do` keyword or a `{` to open the lambda block", 3..3],
+ ["Expected a newline or semicolon after the statement", 7..7],
+ ["Cannot parse the expression", 7..7],
+ ["Expected a lambda block beginning with `do` to end with `end`", 7..7],
+ ]
+ end
+
private
def assert_errors(expected, source, errors, compare_ripper: RUBY_ENGINE == "ruby")