@@ -77,6 +77,7 @@ def test_script_lines_encoding
77
77
def test_anonymous_block_forwarding
78
78
assert_syntax_error ( "def b; c(&); end" , /no anonymous block parameter/ )
79
79
assert_syntax_error ( "def b(&) ->(&) {c(&)} end" , /anonymous block parameter is also used/ )
80
+ assert_valid_syntax ( "def b(&) ->() {c(&)} end" )
80
81
assert_separately ( [ ] , "#{ <<-"begin;" } \n #{ <<-'end;' } " )
81
82
begin;
82
83
def b(&); c(&) end
@@ -147,6 +148,9 @@ def test_anonymous_rest_forwarding
147
148
assert_syntax_error ( "def b(*) ->(*) {c(*)} end" , /anonymous rest parameter is also used/ )
148
149
assert_syntax_error ( "def b(a, *) ->(*) {c(1, *)} end" , /anonymous rest parameter is also used/ )
149
150
assert_syntax_error ( "def b(*) ->(a, *) {c(*)} end" , /anonymous rest parameter is also used/ )
151
+ assert_valid_syntax ( "def b(*) ->() {c(*)} end" )
152
+ assert_valid_syntax ( "def b(a, *) ->() {c(1, *)} end" )
153
+ assert_valid_syntax ( "def b(*) ->(a) {c(*)} end" )
150
154
assert_separately ( [ ] , "#{ <<-"begin;" } \n #{ <<-'end;' } " )
151
155
begin;
152
156
def b(*); c(*) end
@@ -163,6 +167,9 @@ def test_anonymous_keyword_rest_forwarding
163
167
assert_syntax_error ( "def b(**) ->(**) {c(**)} end" , /anonymous keyword rest parameter is also used/ )
164
168
assert_syntax_error ( "def b(k:, **) ->(**) {c(k: 1, **)} end" , /anonymous keyword rest parameter is also used/ )
165
169
assert_syntax_error ( "def b(**) ->(k:, **) {c(**)} end" , /anonymous keyword rest parameter is also used/ )
170
+ assert_valid_syntax ( "def b(**) ->() {c(**)} end" )
171
+ assert_valid_syntax ( "def b(k:, **) ->() {c(k: 1, **)} end" )
172
+ assert_valid_syntax ( "def b(**) ->(k:) {c(**)} end" )
166
173
assert_separately ( [ ] , "#{ <<-"begin;" } \n #{ <<-'end;' } " )
167
174
begin;
168
175
def b(**); c(**) end
0 commit comments