@@ -26,7 +26,7 @@ def test_module_name_recoverable
26
26
)
27
27
28
28
assert_errors expected , "module Parent module end" , [
29
- [ "expected a constant name after `module`" , 14 ..20 ] ,
29
+ [ "unexpected constant path after `module`; class/module name must be CONSTANT " , 14 ..20 ] ,
30
30
[ "unexpected 'end', assuming it is closing the parent module definition" , 21 ..24 ]
31
31
]
32
32
end
@@ -177,7 +177,7 @@ def test_unterminated_empty_string
177
177
178
178
def test_incomplete_instance_var_string
179
179
assert_errors expression ( '%@#@@#' ) , '%@#@@#' , [
180
- [ "'@#' is not allowed as an instance variable name" , 4 ..5 ] ,
180
+ [ "'@' without identifiers is not allowed as an instance variable name" , 4 ..5 ] ,
181
181
[ "unexpected instance variable, expecting end-of-input" , 4 ..5 ]
182
182
]
183
183
end
@@ -325,7 +325,7 @@ def test_aliasing_non_global_variable_with_global_variable
325
325
326
326
def test_aliasing_global_variable_with_global_number_variable
327
327
assert_errors expression ( "alias $a $1" ) , "alias $a $1" , [
328
- [ "invalid argument being passed to `alias`; expected a bare word, symbol, constant, or global variable " , 9 ..11 ]
328
+ [ "invalid argument being passed to `alias`; can't make alias for the number variables " , 9 ..11 ]
329
329
]
330
330
end
331
331
@@ -452,7 +452,7 @@ def test_module_definition_in_method_body
452
452
)
453
453
454
454
assert_errors expected , "def foo;module A;end;end" , [
455
- [ "unexpected module definition in a method definition " , 8 ..14 ]
455
+ [ "unexpected module definition in method body " , 8 ..14 ]
456
456
]
457
457
end
458
458
@@ -490,7 +490,7 @@ def test_module_definition_in_method_body_within_block
490
490
Location ( )
491
491
)
492
492
493
- assert_errors expected , <<~RUBY , [ [ "unexpected module definition in a method definition " , 21 ..27 ] ]
493
+ assert_errors expected , <<~RUBY , [ [ "unexpected module definition in method body " , 21 ..27 ] ]
494
494
def foo
495
495
bar do
496
496
module Foo;end
@@ -505,7 +505,7 @@ def foo(bar = module A;end);end
505
505
def foo;rescue;module A;end;end
506
506
def foo;ensure;module A;end;end
507
507
RUBY
508
- message = "unexpected module definition in a method definition "
508
+ message = "unexpected module definition in method body "
509
509
assert_errors expression ( source ) , source , [
510
510
[ message , 14 ..20 ] ,
511
511
[ message , 47 ..53 ] ,
@@ -541,7 +541,7 @@ def test_class_definition_in_method_body
541
541
)
542
542
543
543
assert_errors expected , "def foo;class A;end;end" , [
544
- [ "unexpected class definition in a method definition " , 8 ..13 ]
544
+ [ "unexpected class definition in method body " , 8 ..13 ]
545
545
]
546
546
end
547
547
@@ -551,7 +551,7 @@ def foo(bar = class A;end);end
551
551
def foo;rescue;class A;end;end
552
552
def foo;ensure;class A;end;end
553
553
RUBY
554
- message = "unexpected class definition in a method definition "
554
+ message = "unexpected class definition in method body "
555
555
assert_errors expression ( source ) , source , [
556
556
[ message , 14 ..19 ] ,
557
557
[ message , 46 ..51 ] ,
@@ -1254,7 +1254,7 @@ def test_invalid_operator_write_dot
1254
1254
1255
1255
def test_unterminated_global_variable
1256
1256
assert_errors expression ( "$" ) , "$" , [
1257
- [ "'$' is not allowed as a global variable name" , 0 ..1 ]
1257
+ [ "'$' without identifiers is not allowed as a global variable name" , 0 ..1 ]
1258
1258
]
1259
1259
end
1260
1260
@@ -1438,7 +1438,7 @@ def test_parameter_name_ending_with_bang_or_question_mark
1438
1438
def test_class_name
1439
1439
source = "class 0.X end"
1440
1440
assert_errors expression ( source ) , source , [
1441
- [ "expected a constant name after `class`" , 6 ..9 ] ,
1441
+ [ "unexpected constant path after `class`; class/module name must be CONSTANT " , 6 ..9 ] ,
1442
1442
]
1443
1443
end
1444
1444
@@ -2060,7 +2060,7 @@ def test_non_assoc_equality
2060
2060
def test_block_arg_and_block
2061
2061
source = 'foo(&1) { }'
2062
2062
assert_errors expression ( source ) , source , [
2063
- [ 'multiple block arguments ; only one block is allowed' , 8 ..11 ]
2063
+ [ "both block arg and actual block given ; only one block is allowed" , 8 ..11 ]
2064
2064
]
2065
2065
end
2066
2066
0 commit comments