ruby_parser 3.12.0 → 3.13.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -244,16 +244,14 @@ module TestRubyParserShared
244
244
 
245
245
  def test_bug_begin_else
246
246
  rb = "begin 1; else; 2 end"
247
- pt = s(:block, s(:lit, 1), s(:lit, 2))
248
247
 
249
- assert_parse rb, pt
248
+ assert_syntax_error rb, "else without rescue is useless"
250
249
  end
251
250
 
252
251
  def test_begin_else_return_value
253
252
  rb = "begin; else 2; end"
254
- pt = s(:lit, 2)
255
253
 
256
- assert_parse rb, pt
254
+ assert_syntax_error rb, "else without rescue is useless"
257
255
  end
258
256
 
259
257
  def test_bug_comment_eq_begin
@@ -894,16 +892,6 @@ module TestRubyParserShared
894
892
  assert_parse rb, pt
895
893
  end
896
894
 
897
- # according to 2.3.1 parser -- added: ON 1.8 only:
898
- # rp.process("f { |(a,b),c| }") == rp.process("f { |((a,b),c)| }")
899
-
900
- # ruby18 -e "p lambda { |(a,b)| }.arity" # => 2
901
- # ruby19 -e "p lambda { |(a,b)| }.arity" # => 1
902
- # ruby18 -e "p lambda { |(a,b),c| }.arity" # => 2
903
- # ruby19 -e "p lambda { |(a,b),c| }.arity" # => 2
904
- # ruby18 -e "p lambda { |((a,b),c)| }.arity" # => 2
905
- # ruby19 -e "p lambda { |((a,b),c)| }.arity" # => 1
906
-
907
895
  def test_bug_args_masgn
908
896
  rb = "f { |(a, b), c| }"
909
897
  pt = s(:iter,
@@ -922,20 +910,10 @@ module TestRubyParserShared
922
910
  assert_parse rb, pt
923
911
  end
924
912
 
925
- def ruby18
926
- RubyParser::V18 === self.processor
927
- end
928
-
929
913
  def test_bug_comma
930
- val = if ruby18 then
931
- s(:lit, 100)
932
- else
933
- s(:str, "d")
934
- end
935
-
936
914
  rb = "if test ?d, dir then end"
937
915
  pt = s(:if,
938
- s(:call, nil, :test, val, s(:call, nil, :dir)),
916
+ s(:call, nil, :test, s(:str, "d"), s(:call, nil, :dir)),
939
917
  nil,
940
918
  nil)
941
919
 
@@ -979,11 +957,7 @@ module TestRubyParserShared
979
957
 
980
958
  def test_bug_not_parens
981
959
  rb = "not(a)"
982
- pt = if ruby18 then
983
- s(:not, s(:call, nil, :a))
984
- else
985
- s(:call, s(:call, nil, :a), :"!")
986
- end
960
+ pt = s(:call, s(:call, nil, :a), :"!")
987
961
 
988
962
  assert_parse rb, pt
989
963
  end
@@ -1008,6 +982,14 @@ module TestRubyParserShared
1008
982
  s(:op_asgn_or, s(:lvar, :a), s(:lasgn, :a, s(:call, nil, :b))),
1009
983
  s(:resbody, s(:array), s(:nil)))
1010
984
 
985
+ # TODO: HRM: this seems more correct IMO. Check against other versions
986
+ pt = s(:op_asgn_or,
987
+ s(:lvar, :a),
988
+ s(:lasgn, :a,
989
+ s(:rescue,
990
+ s(:call, nil, :b),
991
+ s(:resbody, s(:array), s(:nil)))))
992
+
1011
993
  assert_parse rb, pt
1012
994
  end
1013
995
 
@@ -1427,7 +1409,7 @@ module TestRubyParserShared
1427
1409
 
1428
1410
  def test_BEGIN
1429
1411
  rb = "BEGIN { 42 }"
1430
- pt = s(:iter, s(:preexe), s(:args), s(:lit, 42))
1412
+ pt = s(:iter, s(:preexe), 0, s(:lit, 42))
1431
1413
 
1432
1414
  assert_parse rb, pt
1433
1415
  end
@@ -1520,8 +1502,6 @@ module TestRubyParserShared
1520
1502
  end
1521
1503
 
1522
1504
  def test_block_decomp_splat
1523
- skip "not that smart yet" if ruby18 # HACK
1524
-
1525
1505
  rb = "f { |(*a)| }"
1526
1506
  pt = s(:iter, s(:call, nil, :f), s(:args, s(:masgn, :"*a")))
1527
1507
 
@@ -1546,6 +1526,13 @@ module TestRubyParserShared
1546
1526
  assert_parse rb, pt
1547
1527
  end
1548
1528
 
1529
+ def test_alias_resword
1530
+ rb = "alias in out"
1531
+ pt = s(:alias, s(:lit, :in), s(:lit, :out))
1532
+
1533
+ assert_parse rb, pt
1534
+ end
1535
+
1549
1536
  def test_alias_gvar_backref
1550
1537
  rb = "alias $MATCH $&"
1551
1538
  pt = s(:valias, :$MATCH, :$&)
@@ -1585,19 +1572,7 @@ module TestRubyParserShared
1585
1572
 
1586
1573
  def test___ENCODING__
1587
1574
  rb = "__ENCODING__"
1588
- pt = if RubyParser::V18 === processor then
1589
- s(:call, nil, :__ENCODING__)
1590
- else
1591
- if defined? Encoding then
1592
- if RubyParser::V18 === processor then
1593
- s(:call, nil, :__ENCODING__)
1594
- else
1595
- s(:colon2, s(:const, :Encoding), :UTF_8)
1596
- end
1597
- else
1598
- s(:str, "Unsupported!")
1599
- end
1600
- end
1575
+ pt = s(:colon2, s(:const, :Encoding), :UTF_8)
1601
1576
 
1602
1577
  assert_parse rb, pt
1603
1578
  end
@@ -1736,6 +1711,8 @@ module TestRubyParserShared
1736
1711
  end
1737
1712
 
1738
1713
  module TestRubyParserShared19Plus
1714
+ include TestRubyParserShared
1715
+
1739
1716
  def test_aref_args_lit_assocs
1740
1717
  rb = "[1, 2 => 3]"
1741
1718
  pt = s(:array, s(:lit, 1), s(:hash, s(:lit, 2), s(:lit, 3)))
@@ -2275,8 +2252,6 @@ module TestRubyParserShared19Plus
2275
2252
  end
2276
2253
 
2277
2254
  def test_symbol_empty
2278
- skip "can't do this in ruby 1.8" if RUBY_VERSION < "1.9"
2279
-
2280
2255
  rb = ":''"
2281
2256
  pt = s(:lit, "".to_sym)
2282
2257
 
@@ -2430,6 +2405,13 @@ module TestRubyParserShared19Plus
2430
2405
  assert_parse_error rb, '(string):1 :: parse error on value "=" (tEQL)'
2431
2406
  end
2432
2407
 
2408
+ def test_parse_def_special_name
2409
+ rb = 'def next; end'
2410
+ pt = s(:defn, :next, s(:args), s(:nil))
2411
+
2412
+ assert_parse rb, pt
2413
+ end
2414
+
2433
2415
  def test_parse_until_not_canonical
2434
2416
  rb = "until not var.nil?\n 'foo'\nend"
2435
2417
  pt = s(:until,
@@ -2697,9 +2679,6 @@ module TestRubyParserShared19Plus
2697
2679
  assert_parse rb, pt
2698
2680
  end
2699
2681
 
2700
- # In 1.8, block args with an outer set of parens are superfluous.
2701
- # In 1.9, outer set of parens are NOT... they are an explicit extra masgn.
2702
-
2703
2682
  def test_iter_args_2__19
2704
2683
  rb = "f { |(a, b)| }"
2705
2684
  pt = s(:iter, s(:call, nil, :f), s(:args, s(:masgn, :a, :b)))
@@ -2918,76 +2897,9 @@ module TestRubyParserShared19Plus
2918
2897
  end
2919
2898
  end
2920
2899
 
2921
- module TestRubyParserShared21Plus
2922
- def test_f_kw
2923
- rb = "def x k:42; end"
2924
- pt = s(:defn, :x, s(:args, s(:kwarg, :k, s(:lit, 42))), s(:nil))
2925
-
2926
- assert_parse rb, pt
2927
- end
2928
-
2929
- def test_f_kw__required
2930
- rb = "def x k:; end"
2931
- pt = s(:defn, :x, s(:args, s(:kwarg, :k)), s(:nil))
2932
-
2933
- assert_parse rb, pt
2934
- end
2935
-
2936
- def test_block_kw
2937
- rb = "blah { |k:42| }"
2938
- pt = s(:iter, s(:call, nil, :blah), s(:args, s(:kwarg, :k, s(:lit, 42))))
2939
-
2940
- assert_parse rb, pt
2941
-
2942
- rb = "blah { |k:42| }"
2943
- assert_parse rb, pt
2944
- end
2945
-
2946
- def test_block_kw__required
2947
- rb = "blah do |k:| end"
2948
- pt = s(:iter, s(:call, nil, :blah), s(:args, s(:kwarg, :k)))
2949
-
2950
- assert_parse rb, pt
2951
-
2952
- rb = "blah do |k:| end"
2953
- assert_parse rb, pt
2954
- end
2955
-
2956
- def test_stabby_block_kw
2957
- rb = "-> (k:42) { }"
2958
- pt = s(:iter, s(:call, nil, :lambda), s(:args, s(:kwarg, :k, s(:lit, 42))))
2959
-
2960
- assert_parse rb, pt
2961
- end
2962
-
2963
- def test_stabby_block_kw__required
2964
- rb = "-> (k:) { }"
2965
- pt = s(:iter, s(:call, nil, :lambda), s(:args, s(:kwarg, :k)))
2966
-
2967
- assert_parse rb, pt
2968
- end
2969
-
2970
- def test_parse_line_heredoc_hardnewline
2971
- skip "not yet"
2972
-
2973
- rb = <<-'CODE'.gsub(/^ /, '')
2974
- <<-EOFOO
2975
- \n\n\n\n\n\n\n\n\n
2976
- EOFOO
2977
-
2978
- class Foo
2979
- end
2980
- CODE
2981
-
2982
- pt = s(:block,
2983
- s(:str, "\n\n\n\n\n\n\n\n\n\n").line(1),
2984
- s(:class, :Foo, nil).line(5)).line(1)
2985
-
2986
- assert_parse rb, pt
2987
- end
2988
- end
2989
-
2990
2900
  module TestRubyParserShared20Plus
2901
+ include TestRubyParserShared19Plus
2902
+
2991
2903
  def test_non_interpolated_symbol_array_line_breaks
2992
2904
 
2993
2905
  rb = "%i(\na\nb\n)\n1"
@@ -3293,7 +3205,87 @@ module TestRubyParserShared20Plus
3293
3205
  end
3294
3206
  end
3295
3207
 
3208
+ module TestRubyParserShared21Plus
3209
+ include TestRubyParserShared20Plus
3210
+
3211
+ def test_defn_unary_not
3212
+ rb = "def !@; true; end" # I seriously HATE this
3213
+ pt = s(:defn, :"!@", s(:args), s(:true))
3214
+
3215
+ assert_parse rb, pt
3216
+ end
3217
+
3218
+ def test_f_kw
3219
+ rb = "def x k:42; end"
3220
+ pt = s(:defn, :x, s(:args, s(:kwarg, :k, s(:lit, 42))), s(:nil))
3221
+
3222
+ assert_parse rb, pt
3223
+ end
3224
+
3225
+ def test_f_kw__required
3226
+ rb = "def x k:; end"
3227
+ pt = s(:defn, :x, s(:args, s(:kwarg, :k)), s(:nil))
3228
+
3229
+ assert_parse rb, pt
3230
+ end
3231
+
3232
+ def test_block_kw
3233
+ rb = "blah { |k:42| }"
3234
+ pt = s(:iter, s(:call, nil, :blah), s(:args, s(:kwarg, :k, s(:lit, 42))))
3235
+
3236
+ assert_parse rb, pt
3237
+
3238
+ rb = "blah { |k:42| }"
3239
+ assert_parse rb, pt
3240
+ end
3241
+
3242
+ def test_block_kw__required
3243
+ rb = "blah do |k:| end"
3244
+ pt = s(:iter, s(:call, nil, :blah), s(:args, s(:kwarg, :k)))
3245
+
3246
+ assert_parse rb, pt
3247
+
3248
+ rb = "blah do |k:| end"
3249
+ assert_parse rb, pt
3250
+ end
3251
+
3252
+ def test_stabby_block_kw
3253
+ rb = "-> (k:42) { }"
3254
+ pt = s(:iter, s(:call, nil, :lambda), s(:args, s(:kwarg, :k, s(:lit, 42))))
3255
+
3256
+ assert_parse rb, pt
3257
+ end
3258
+
3259
+ def test_stabby_block_kw__required
3260
+ rb = "-> (k:) { }"
3261
+ pt = s(:iter, s(:call, nil, :lambda), s(:args, s(:kwarg, :k)))
3262
+
3263
+ assert_parse rb, pt
3264
+ end
3265
+
3266
+ def test_parse_line_heredoc_hardnewline
3267
+ skip "not yet"
3268
+
3269
+ rb = <<-'CODE'.gsub(/^ /, '')
3270
+ <<-EOFOO
3271
+ \n\n\n\n\n\n\n\n\n
3272
+ EOFOO
3273
+
3274
+ class Foo
3275
+ end
3276
+ CODE
3277
+
3278
+ pt = s(:block,
3279
+ s(:str, "\n\n\n\n\n\n\n\n\n\n").line(1),
3280
+ s(:class, :Foo, nil).line(5)).line(1)
3281
+
3282
+ assert_parse rb, pt
3283
+ end
3284
+ end
3285
+
3296
3286
  module TestRubyParserShared22Plus
3287
+ include TestRubyParserShared21Plus
3288
+
3297
3289
  def test_call_args_assoc_quoted
3298
3290
  pt = s(:call, nil, :x, s(:hash, s(:lit, :k), s(:lit, 42)))
3299
3291
 
@@ -3335,6 +3327,8 @@ module TestRubyParserShared22Plus
3335
3327
  end
3336
3328
 
3337
3329
  module TestRubyParserShared23Plus
3330
+ include TestRubyParserShared22Plus
3331
+
3338
3332
  def test_safe_call
3339
3333
  rb = "a&.b"
3340
3334
  pt = s(:safe_call, s(:call, nil, :a), :b)
@@ -3472,16 +3466,46 @@ a + b
3472
3466
  end
3473
3467
 
3474
3468
  module TestRubyParserShared24Plus
3469
+ include TestRubyParserShared23Plus
3470
+
3475
3471
  # ...version specific tests to go here...
3476
3472
  end
3477
3473
 
3478
3474
  module TestRubyParserShared25Plus
3475
+ include TestRubyParserShared24Plus
3476
+
3479
3477
  # ...version specific tests to go here...
3480
3478
  end
3481
3479
 
3480
+ module TestRubyParserShared26Plus
3481
+ include TestRubyParserShared25Plus
3482
+
3483
+ def test_symbol_list
3484
+ rb = '%I[#{a} #{b}]'
3485
+ pt = s(:array,
3486
+ s(:dsym, "", s(:evstr, s(:call, nil, :a))),
3487
+ s(:dsym, "", s(:evstr, s(:call, nil, :b))))
3488
+
3489
+ assert_parse rb, pt
3490
+ end
3491
+
3492
+ def test_dot2_nil__26
3493
+ rb = "a.."
3494
+ pt = s(:dot2, s(:call, nil, :a), nil)
3495
+
3496
+ assert_parse rb, pt
3497
+ end
3498
+
3499
+ def test_dot3_nil__26
3500
+ rb = "a..."
3501
+ pt = s(:dot3, s(:call, nil, :a), nil)
3502
+
3503
+ assert_parse rb, pt
3504
+ end
3505
+ end
3506
+
3482
3507
  class TestRubyParser < Minitest::Test
3483
3508
  def test_cls_version
3484
- assert_equal 18, RubyParser::V18.version
3485
3509
  assert_equal 23, RubyParser::V23.version
3486
3510
  assert_equal 24, RubyParser::V24.version
3487
3511
  assert_equal 24, Ruby24Parser.version
@@ -3491,15 +3515,6 @@ class TestRubyParser < Minitest::Test
3491
3515
  def test_parse
3492
3516
  processor = RubyParser.new
3493
3517
 
3494
- # 1.8 only syntax
3495
- rb = "while false : 42 end"
3496
- pt = s(:while, s(:false), s(:lit, 42), true)
3497
-
3498
- assert_silent do
3499
- assert_equal pt, processor.parse(rb)
3500
- end
3501
-
3502
- # 1.9 only syntax
3503
3518
  rb = "a.()"
3504
3519
  pt = s(:call, s(:call, nil, :a), :call)
3505
3520
 
@@ -3512,8 +3527,20 @@ class TestRubyParser < Minitest::Test
3512
3527
  end
3513
3528
  end
3514
3529
 
3515
- msg = "(string):1 :: parse error on value \"(\" (tLPAREN2)"
3516
- assert_equal msg, e.message.strip
3530
+ assert_includes e.message, 'parse error on value "$end"'
3531
+ end
3532
+
3533
+ def test_parse_error_from_first
3534
+ processor = RubyParser.new
3535
+
3536
+ e = assert_raises Racc::ParseError do
3537
+ capture_io do
3538
+ processor.parse "a -> () {"
3539
+ end
3540
+ end
3541
+
3542
+ # This is a 2.x error, will fail on 1.8/1.9.
3543
+ assert_includes e.message, 'parse error on value "$end"'
3517
3544
  end
3518
3545
  end
3519
3546
 
@@ -3578,119 +3605,7 @@ class RubyParserTestCase < ParseTreeTestCase
3578
3605
  end
3579
3606
  end
3580
3607
 
3581
- class TestRubyParserV18 < RubyParserTestCase
3582
- include TestRubyParserShared
3583
-
3584
- def setup
3585
- super
3586
-
3587
- self.processor = RubyParser::V18.new
3588
- end
3589
-
3590
- def test_assoc_list_18
3591
- rb = "{1, 2, 3, 4}"
3592
- pt = s(:hash, s(:lit, 1), s(:lit, 2), s(:lit, 3), s(:lit, 4))
3593
-
3594
- assert_parse rb, pt
3595
- end
3596
-
3597
- def test_case_then_colon_18
3598
- rb = "case x; when Fixnum: 42; end"
3599
- pt = s(:case,
3600
- s(:call, nil, :x),
3601
- s(:when, s(:array, s(:const, :Fixnum)), s(:lit, 42)),
3602
- nil)
3603
-
3604
- assert_parse rb, pt
3605
- end
3606
-
3607
- def test_do_colon_18
3608
- rb = "while false : 42 end"
3609
- pt = s(:while, s(:false), s(:lit, 42), true)
3610
-
3611
- assert_parse rb, pt
3612
- end
3613
-
3614
- def test_call_space_before_paren_args_18
3615
- rb = "a (:b, :c, :d => :e)"
3616
- pt = s(:call, nil, :a,
3617
- s(:lit, :b),
3618
- s(:lit, :c),
3619
- s(:hash, s(:lit, :d), s(:lit, :e)))
3620
-
3621
- assert_parse rb, pt
3622
- end
3623
-
3624
- # In 1.8, block args with an outer set of parens are superfluous.
3625
- # In 1.9, outer set of parens are NOT... they are an explicit extra masgn.
3626
-
3627
- def test_iter_args_2_18
3628
- rb = "f { |(a, b)| }"
3629
- pt = s(:iter, s(:call, nil, :f), s(:args, :a, :b))
3630
-
3631
- assert_parse rb, pt
3632
- end
3633
-
3634
- def test_bug_args__18
3635
- rb = "f { |(a, b)| }"
3636
- pt = s(:iter, s(:call, nil, :f),
3637
- s(:args, :a, :b))
3638
-
3639
- assert_parse rb, pt
3640
- end
3641
-
3642
- def test_bug_args_masgn_outer_parens__18
3643
- rb = "f { |((a, b), c)| }"
3644
- pt = s(:iter, # NOTE: same sexp as test_bug_args_masgn
3645
- s(:call, nil, :f),
3646
- s(:args, s(:masgn, :a, :b), :c))
3647
-
3648
- assert_parse rb, pt.dup
3649
- end
3650
-
3651
- def test_double_block_error_10
3652
- assert_syntax_error "a.b (&b) {}", BLOCK_DUP_MSG
3653
- end
3654
-
3655
- def test_double_block_error_11
3656
- assert_syntax_error "a (1, &b) { }", BLOCK_DUP_MSG
3657
- end
3658
-
3659
- def test_double_block_error_12
3660
- assert_syntax_error "a (1, &b) do end", BLOCK_DUP_MSG
3661
- end
3662
-
3663
- def test_double_block_error_13
3664
- assert_syntax_error "m.a (1, &b) { }", BLOCK_DUP_MSG
3665
- end
3666
-
3667
- def test_double_block_error_14
3668
- assert_syntax_error "m.a (1, &b) do end", BLOCK_DUP_MSG
3669
- end
3670
-
3671
- def test_double_block_error_15
3672
- assert_syntax_error "m::a (1, &b) { }", BLOCK_DUP_MSG
3673
- end
3674
-
3675
- def test_double_block_error_16
3676
- assert_syntax_error "m::a (1, &b) do end", BLOCK_DUP_MSG
3677
- end
3678
- end
3679
-
3680
- class TestRubyParserV19 < RubyParserTestCase
3681
- include TestRubyParserShared
3682
- include TestRubyParserShared19Plus
3683
-
3684
- def setup
3685
- super
3686
-
3687
- self.processor = RubyParser::V19.new
3688
- end
3689
- end
3690
-
3691
3608
  class TestRubyParserV20 < RubyParserTestCase
3692
- include TestRubyParserShared
3693
- include TestRubyParserShared19Plus
3694
3609
  include TestRubyParserShared20Plus
3695
3610
 
3696
3611
  def setup
@@ -3698,19 +3613,9 @@ class TestRubyParserV20 < RubyParserTestCase
3698
3613
 
3699
3614
  self.processor = RubyParser::V20.new
3700
3615
  end
3701
-
3702
- def test_defn_unary_not
3703
- rb = "def !@; true; end" # I seriously HATE this
3704
- pt = s(:defn, :"!@", s(:args), s(:true))
3705
-
3706
- assert_parse rb, pt
3707
- end
3708
3616
  end
3709
3617
 
3710
3618
  class TestRubyParserV21 < RubyParserTestCase
3711
- include TestRubyParserShared
3712
- include TestRubyParserShared19Plus
3713
- include TestRubyParserShared20Plus
3714
3619
  include TestRubyParserShared21Plus
3715
3620
 
3716
3621
  def setup
@@ -3721,10 +3626,6 @@ class TestRubyParserV21 < RubyParserTestCase
3721
3626
  end
3722
3627
 
3723
3628
  class TestRubyParserV22 < RubyParserTestCase
3724
- include TestRubyParserShared
3725
- include TestRubyParserShared19Plus
3726
- include TestRubyParserShared20Plus
3727
- include TestRubyParserShared21Plus
3728
3629
  include TestRubyParserShared22Plus
3729
3630
 
3730
3631
  def setup
@@ -3735,11 +3636,6 @@ class TestRubyParserV22 < RubyParserTestCase
3735
3636
  end
3736
3637
 
3737
3638
  class TestRubyParserV23 < RubyParserTestCase
3738
- include TestRubyParserShared
3739
- include TestRubyParserShared19Plus
3740
- include TestRubyParserShared20Plus
3741
- include TestRubyParserShared21Plus
3742
- include TestRubyParserShared22Plus
3743
3639
  include TestRubyParserShared23Plus
3744
3640
 
3745
3641
  def setup
@@ -3750,12 +3646,6 @@ class TestRubyParserV23 < RubyParserTestCase
3750
3646
  end
3751
3647
 
3752
3648
  class TestRubyParserV24 < RubyParserTestCase
3753
- include TestRubyParserShared
3754
- include TestRubyParserShared19Plus
3755
- include TestRubyParserShared20Plus
3756
- include TestRubyParserShared21Plus
3757
- include TestRubyParserShared22Plus
3758
- include TestRubyParserShared23Plus
3759
3649
  include TestRubyParserShared24Plus
3760
3650
 
3761
3651
  def setup
@@ -3766,13 +3656,6 @@ class TestRubyParserV24 < RubyParserTestCase
3766
3656
  end
3767
3657
 
3768
3658
  class TestRubyParserV25 < RubyParserTestCase
3769
- include TestRubyParserShared
3770
- include TestRubyParserShared19Plus
3771
- include TestRubyParserShared20Plus
3772
- include TestRubyParserShared21Plus
3773
- include TestRubyParserShared22Plus
3774
- include TestRubyParserShared23Plus
3775
- include TestRubyParserShared24Plus
3776
3659
  include TestRubyParserShared25Plus
3777
3660
 
3778
3661
  def setup
@@ -3783,7 +3666,10 @@ class TestRubyParserV25 < RubyParserTestCase
3783
3666
 
3784
3667
  def test_rescue_in_block
3785
3668
  rb = "blah do\nrescue\n stuff\nend"
3786
- pt = s(:iter, s(:call, nil, :blah), 0, s(:rescue, s(:resbody, s(:array), s(:call, nil, :stuff))))
3669
+ pt = s(:iter,
3670
+ s(:call, nil, :blah),
3671
+ 0,
3672
+ s(:rescue, s(:resbody, s(:array), s(:call, nil, :stuff))))
3787
3673
  assert_parse rb, pt
3788
3674
  end
3789
3675
 
@@ -3848,6 +3734,16 @@ class TestRubyParserV25 < RubyParserTestCase
3848
3734
  end
3849
3735
  end
3850
3736
 
3737
+ class TestRubyParserV26 < RubyParserTestCase
3738
+ include TestRubyParserShared26Plus
3739
+
3740
+ def setup
3741
+ super
3742
+
3743
+ self.processor = RubyParser::V26.new
3744
+ end
3745
+ end
3746
+
3851
3747
  RubyParser::VERSIONS.each do |klass|
3852
3748
  v = klass.version
3853
3749
  describe "block args arity #{v}" do