Skip to content

Commit

Permalink
* backport tests for mixed usage of anonymous kwarg/kwrestarg and for…
Browse files Browse the repository at this point in the history
…warded-arguments (#915)
  • Loading branch information
iliabylich committed Mar 7, 2023
1 parent 2d23044 commit a4bc6c4
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/test_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11148,4 +11148,36 @@ def test_kwoptarg_with_kwrestarg_and_forwarded_args
%q{},
SINCE_3_2)
end

def test_argument_forwarding_with_anon_rest_kwrest_and_block
assert_diagnoses(
[:error, :unexpected_token, { token: 'tBDOT3' }],
%q{def f(*, **, &); g(...); end},
%q{},
SINCE_3_2)

assert_diagnoses(
[:error, :no_anonymous_restarg],
%q{def f(...); g(*); end},
%q{},
SINCE_3_2)

assert_diagnoses(
[:error, :no_anonymous_restarg],
%q{def f(...); g(0, *); end},
%q{},
SINCE_3_2)

assert_diagnoses(
[:error, :no_anonymous_kwrestarg],
%q{def f(...); g(**); end},
%q{},
SINCE_3_2)

assert_diagnoses(
[:error, :no_anonymous_kwrestarg],
%q{def f(...); g(x: 1, **); end},
%q{},
SINCE_3_2)
end
end

0 comments on commit a4bc6c4

Please sign in to comment.