summaryrefslogtreecommitdiff
path: root/test/ripper
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2020-05-28 11:09:44 -0700
committerJeremy Evans <code@jeremyevans.net>2020-06-06 17:07:11 -0700
commitf8b4340fa2c254cd093ebc3bc70d2d0c46ea9997 (patch)
treead5406a80ddad1a4aa3aaae929724b8b196995c6 /test/ripper
parent4178cbd2974fc0022823392c2460e09df2517a6e (diff)
downloadruby-f8b4340fa2c254cd093ebc3bc70d2d0c46ea9997.tar.gz
Add leading arguments support to arguments forwarding
The idFWD_KWREST sections may be wrong. However, the existing idFWD_KWREST sections for ... without leading arguments are already broken. Implements [Feature #16378]
Diffstat (limited to 'test/ripper')
-rw-r--r--test/ripper/test_parser_events.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb
index b6eeb77cda..544896b15f 100644
--- a/test/ripper/test_parser_events.rb
+++ b/test/ripper/test_parser_events.rb
@@ -132,9 +132,17 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
end
def test_args_forward
- thru_args_forward = false
- parse('def m(...) n(...) end', :on_args_forward) {thru_args_forward = true}
- assert_equal true, thru_args_forward
+ [
+ 'def m(...) n(...) end',
+ 'def m(...) end',
+ 'def m(a, ...) n(1, ...) end',
+ 'def m(...) n(1, ...) end',
+ 'def m(a, ...) n(...) end'
+ ].each do |code|
+ thru_args_forward = false
+ parse(code, :on_args_forward) {thru_args_forward = true}
+ assert_equal true, thru_args_forward, "no args_forward for: #{code}"
+ end
end
def test_arg_paren