Skip to content

Commit

Permalink
add tests for keyword argument value omission (#821)
Browse files Browse the repository at this point in the history
  • Loading branch information
skryukov committed Sep 24, 2021
1 parent 61bf873 commit 0f1c7d7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/test_parser.rb
Expand Up @@ -10084,6 +10084,30 @@ def test_value_omission
| ~~ expression (pair)
|~~~~~~~~ expression},
SINCE_3_1)

assert_diagnoses(
[:error, :unexpected_token, { :token => 'tRCURLY' }],
%q{{"#{x}":}},
%q{ ^ location},
SINCE_3_1)
end

def test_keyword_argument_omission
assert_parses(
s(:send, nil, :foo,
s(:kwargs,
s(:pair, s(:sym, :a), s(:send, nil, :a)),
s(:pair, s(:sym, :b), s(:send, nil, :b)))),
%q{foo(a:, b:)},
%q{ ^ begin
| ^ end
| ^ operator (kwargs.pair)
| ~ expression (kwargs.pair.sym)
| ~~ expression (kwargs.pair.send)
| ~~ expression (kwargs.pair)
| ~~~~~~ expression (kwargs)
|~~~~~~~~~~~ expression},
SINCE_3_1)
end

def test_rasgn_line_continuation
Expand Down

0 comments on commit 0f1c7d7

Please sign in to comment.