diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3f811317..468591bd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,8 @@ jobs: - '3.0' - '3.1' - '3.2' - - head + - '3.3' + - '3.4' - truffleruby-head name: CI runs-on: ubuntu-latest diff --git a/.rubocop.yml b/.rubocop.yml index 2142296f..1b81a535 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -136,6 +136,9 @@ Style/KeywordParametersOrder: Style/MissingRespondToMissing: Enabled: false +Style/MultipleComparison: + Enabled: false + Style/MutableConstant: Enabled: false @@ -157,6 +160,9 @@ Style/PerlBackrefs: Style/RedundantArrayConstructor: Enabled: false +Style/RedundantParentheses: + Enabled: false + Style/SafeNavigation: Enabled: false diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index 944880fa..00000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -3.2.0 diff --git a/Gemfile b/Gemfile index be173b20..b4252fb5 100644 --- a/Gemfile +++ b/Gemfile @@ -3,3 +3,5 @@ source "https://rubygems.org" gemspec + +gem "fiddle" diff --git a/Gemfile.lock b/Gemfile.lock index 1bf158a2..b855c712 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,42 +7,47 @@ PATH GEM remote: https://rubygems.org/ specs: - ast (2.4.2) - docile (1.4.0) - json (2.6.3) - language_server-protocol (3.17.0.3) + ast (2.4.3) + docile (1.4.1) + fiddle (1.1.8) + json (2.12.2) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) minitest (5.25.5) - parallel (1.23.0) - parser (3.2.2.4) + parallel (1.27.0) + parser (3.3.8.0) ast (~> 2.4.1) racc prettier_print (1.2.1) - racc (1.7.1) + prism (1.4.0) + racc (1.8.1) rainbow (3.1.1) rake (13.3.0) - regexp_parser (2.8.2) - rexml (3.2.6) - rubocop (1.57.2) + regexp_parser (2.10.0) + rubocop (1.78.0) json (~> 2.3) - language_server-protocol (>= 3.17.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) - parser (>= 3.2.2.4) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.1, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.45.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.30.0) - parser (>= 3.2.1.0) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.45.1) + parser (>= 3.3.7.2) + prism (~> 1.4) ruby-progressbar (1.13.0) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) + simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) - unicode-display_width (2.5.0) + unicode-display_width (3.1.4) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) PLATFORMS arm64-darwin-21 @@ -53,6 +58,7 @@ PLATFORMS DEPENDENCIES bundler + fiddle minitest rake rubocop diff --git a/lib/syntax_tree/cli.rb b/lib/syntax_tree/cli.rb index f2616c87..e0bafce9 100644 --- a/lib/syntax_tree/cli.rb +++ b/lib/syntax_tree/cli.rb @@ -159,7 +159,7 @@ class CTags < Action attr_reader :entries def initialize(options) - super(options) + super @entries = [] end diff --git a/lib/syntax_tree/node.rb b/lib/syntax_tree/node.rb index 3b676552..5a92a5a7 100644 --- a/lib/syntax_tree/node.rb +++ b/lib/syntax_tree/node.rb @@ -11644,6 +11644,10 @@ def pin(parent, pin) elsif value.is_a?(Array) && (index = value.index(self)) parent.public_send(key)[index] = replace break + elsif value.is_a?(Array) && + (index = value.index { |(_k, v)| v == self }) + parent.public_send(key)[index][1] = replace + break end end end diff --git a/lib/syntax_tree/parser.rb b/lib/syntax_tree/parser.rb index 825cd90e..326d3ec7 100644 --- a/lib/syntax_tree/parser.rb +++ b/lib/syntax_tree/parser.rb @@ -670,7 +670,11 @@ def visit(node) visit_methods do def visit_var_ref(node) - node.pin(stack[-2], pins.shift) + if node.start_char > pins.first.start_char + node.pin(stack[-2], pins.shift) + else + super + end end end @@ -1732,13 +1736,13 @@ def on_fcall(value) # :call-seq: # on_field: ( # untyped parent, - # (:"::" | Op | Period) operator + # (:"::" | Op | Period | 73) operator # (Const | Ident) name # ) -> Field def on_field(parent, operator, name) Field.new( parent: parent, - operator: operator, + operator: operator == 73 ? :"::" : operator, name: name, location: parent.location.to(name.location) ) diff --git a/lib/syntax_tree/pattern.rb b/lib/syntax_tree/pattern.rb index ca49c6bf..a5e88bfa 100644 --- a/lib/syntax_tree/pattern.rb +++ b/lib/syntax_tree/pattern.rb @@ -70,6 +70,7 @@ def compile raise CompilationError, query end + raise CompilationError, query if program.nil? compile_node(program.statements.body.first.consequent.pattern) end diff --git a/lib/syntax_tree/yarv/assembler.rb b/lib/syntax_tree/yarv/assembler.rb index b29c252a..a48c58fd 100644 --- a/lib/syntax_tree/yarv/assembler.rb +++ b/lib/syntax_tree/yarv/assembler.rb @@ -408,7 +408,7 @@ def assemble_iseq(iseq, lines) def find_local(iseq, operands) name_string, level_string = operands.split(/,\s*/) name = name_string.to_sym - level = level_string&.to_i || 0 + level = level_string.to_i iseq.local_table.plain(name) iseq.local_table.find(name, level) @@ -455,7 +455,7 @@ def parse_calldata(value) CallData::CALL_ARGS_SIMPLE end - YARV.calldata(message.to_sym, argc_value&.to_i || 0, flags) + YARV.calldata(message.to_sym, argc_value.to_i, flags) end end end diff --git a/lib/syntax_tree/yarv/calldata.rb b/lib/syntax_tree/yarv/calldata.rb index e35992f5..278a3dd9 100644 --- a/lib/syntax_tree/yarv/calldata.rb +++ b/lib/syntax_tree/yarv/calldata.rb @@ -41,7 +41,7 @@ def initialize( end def flag?(mask) - (flags & mask) > 0 + flags.anybits?(mask) end def to_h diff --git a/lib/syntax_tree/yarv/decompiler.rb b/lib/syntax_tree/yarv/decompiler.rb index 4ea99e3a..6a2cddbd 100644 --- a/lib/syntax_tree/yarv/decompiler.rb +++ b/lib/syntax_tree/yarv/decompiler.rb @@ -45,7 +45,7 @@ def node_for(value) when Integer Int(value.to_s) when Symbol - SymbolLiteral(Ident(value.to_s)) + SymbolLiteral(Ident(value.name)) end end @@ -88,10 +88,10 @@ def decompile(iseq) clause << HashLiteral(LBrace("{"), assocs) when GetGlobal - clause << VarRef(GVar(insn.name.to_s)) + clause << VarRef(GVar(insn.name.name)) when GetLocalWC0 local = iseq.local_table.locals[insn.index] - clause << VarRef(Ident(local.name.to_s)) + clause << VarRef(Ident(local.name.name)) when Jump clause << Assign(block_label.field, node_for(insn.label.name)) clause << Next(Args([])) @@ -123,7 +123,7 @@ def decompile(iseq) left, right = clause.pop(2) clause << Binary(left, :"!=", right) when OptSendWithoutBlock - method = insn.calldata.method.to_s + method = insn.calldata.method.name argc = insn.calldata.argc if insn.calldata.flag?(CallData::CALL_FCALL) @@ -182,7 +182,7 @@ def decompile(iseq) when PutSelf clause << VarRef(Kw("self")) when SetGlobal - target = GVar(insn.name.to_s) + target = GVar(insn.name.name) value = clause.pop clause << if value.is_a?(Binary) && VarRef(target) === value.left @@ -256,7 +256,7 @@ def decompile(iseq) def local_name(index, level) current = iseq level.times { current = current.parent_iseq } - current.local_table.locals[index].name.to_s + current.local_table.locals[index].name.name end end end diff --git a/lib/syntax_tree/yarv/instruction_sequence.rb b/lib/syntax_tree/yarv/instruction_sequence.rb index df92799b..4f2e0d9a 100644 --- a/lib/syntax_tree/yarv/instruction_sequence.rb +++ b/lib/syntax_tree/yarv/instruction_sequence.rb @@ -252,19 +252,23 @@ def to_a dumped_options = argument_options.dup dumped_options[:opt].map!(&:name) if dumped_options[:opt] + metadata = { + arg_size: argument_size, + local_size: local_table.size, + stack_max: stack.maximum_size, + node_id: -1, + node_ids: [-1] * insns.length + } + + metadata[:parser] = :prism if RUBY_VERSION >= "3.3" + # Next, return the instruction sequence as an array. [ MAGIC, versions[0], versions[1], 1, - { - arg_size: argument_size, - local_size: local_table.size, - stack_max: stack.maximum_size, - node_id: -1, - node_ids: [-1] * insns.length - }, + metadata, name, file, "", @@ -689,6 +693,10 @@ def concatstrings(number) push(ConcatStrings.new(number)) end + def concattoarray(object) + push(ConcatToArray.new(object)) + end + def defineclass(name, class_iseq, flags) push(DefineClass.new(name, class_iseq, flags)) end @@ -897,6 +905,14 @@ def pop push(Pop.new) end + def pushtoarraykwsplat + push(PushToArrayKwSplat.new) + end + + def putchilledstring(object) + push(PutChilledString.new(object)) + end + def putnil push(PutNil.new) end @@ -1079,6 +1095,8 @@ def self.from(source, options = Compiler::Options.new, parent_iseq = nil) iseq.concatarray when :concatstrings iseq.concatstrings(opnds[0]) + when :concattoarray + iseq.concattoarray(opnds[0]) when :defineclass iseq.defineclass(opnds[0], from(opnds[1], options, iseq), opnds[2]) when :defined @@ -1191,8 +1209,13 @@ def self.from(source, options = Compiler::Options.new, parent_iseq = nil) iseq.newarray(opnds[0]) iseq.send(YARV.calldata(:min)) when :opt_newarray_send + mid = opnds[1] + if RUBY_VERSION >= "3.4" + mid = %i[max min hash pack pack_buffer include?][mid - 1] + end + iseq.newarray(opnds[0]) - iseq.send(CallData.new(opnds[1])) + iseq.send(CallData.new(mid)) when :opt_neq iseq.push( OptNEq.new(CallData.from(opnds[0]), CallData.from(opnds[1])) @@ -1207,6 +1230,10 @@ def self.from(source, options = Compiler::Options.new, parent_iseq = nil) iseq.send(YARV.calldata(:-@)) when :pop iseq.pop + when :pushtoarraykwsplat + iseq.pushtoarraykwsplat + when :putchilledstring + iseq.putchilledstring(opnds[0]) when :putnil iseq.putnil when :putobject diff --git a/lib/syntax_tree/yarv/instructions.rb b/lib/syntax_tree/yarv/instructions.rb index ffeebe65..02188dfe 100644 --- a/lib/syntax_tree/yarv/instructions.rb +++ b/lib/syntax_tree/yarv/instructions.rb @@ -757,6 +757,59 @@ def call(vm) end end + # ### Summary + # + # `concattoarray` pops a single value off the stack and attempts to concat + # it to the Array on top of the stack. If the value is not an Array, it + # will be coerced into one. + # + # ### Usage + # + # ~~~ruby + # [1, *2] + # ~~~ + # + class ConcatToArray < Instruction + attr_reader :object + + def initialize(object) + @object = object + end + + def disasm(fmt) + fmt.instruction("concattoarray", [fmt.object(object)]) + end + + def to_a(_iseq) + [:concattoarray, object] + end + + def deconstruct_keys(_keys) + { object: object } + end + + def ==(other) + other.is_a?(ConcatToArray) && other.object == object + end + + def length + 2 + end + + def pops + 1 + end + + def pushes + 1 + end + + def call(vm) + array, value = vm.pop(2) + vm.push(array.concat(Array(value))) + end + end + # ### Summary # # `defineclass` defines a class. First it pops the superclass off the @@ -4472,6 +4525,52 @@ def side_effects? end end + # ### Summary + # + # `pushtoarraykwsplat` is used to append a hash literal that is being + # splatted onto an array. + # + # ### Usage + # + # ~~~ruby + # ["string", **{ foo: "bar" }] + # ~~~ + # + class PushToArrayKwSplat < Instruction + def disasm(fmt) + fmt.instruction("pushtoarraykwsplat") + end + + def to_a(_iseq) + [:pushtoarraykwsplat] + end + + def deconstruct_keys(_keys) + {} + end + + def ==(other) + other.is_a?(PushToArrayKwSplat) + end + + def length + 2 + end + + def pops + 2 + end + + def pushes + 1 + end + + def call(vm) + array, hash = vm.pop(2) + vm.push(array << hash) + end + end + # ### Summary # # `putnil` pushes a global nil object onto the stack. @@ -4759,6 +4858,54 @@ def call(vm) end end + # ### Summary + # + # `putchilledstring` pushes an unfrozen string literal onto the stack that + # acts like a frozen string. This is a migration path to frozen string + # literals as the default in the future. + # + # ### Usage + # + # ~~~ruby + # "foo" + # ~~~ + # + class PutChilledString < Instruction + attr_reader :object + + def initialize(object) + @object = object + end + + def disasm(fmt) + fmt.instruction("putchilledstring", [fmt.object(object)]) + end + + def to_a(_iseq) + [:putchilledstring, object] + end + + def deconstruct_keys(_keys) + { object: object } + end + + def ==(other) + other.is_a?(PutChilledString) && other.object == object + end + + def length + 2 + end + + def pushes + 1 + end + + def call(vm) + vm.push(object.dup) + end + end + # ### Summary # # `putstring` pushes an unfrozen string literal onto the stack. diff --git a/tasks/whitequark.rake b/tasks/whitequark.rake index 4f7ee650..6e1663aa 100644 --- a/tasks/whitequark.rake +++ b/tasks/whitequark.rake @@ -43,8 +43,13 @@ module ParseHelper # that we do not support. return if (versions & %w[3.1 3.2]).empty? - entry = caller.find { _1.include?("test_parser.rb") } - _, lineno, name = *entry.match(/(\d+):in `(.+)'/) + entry = + caller.find do |call| + call.include?("test_parser.rb") && call.match?(%r{(? "3.3" + require_relative "test_helper" module SyntaxTree diff --git a/test/fixtures/bodystmt.rb b/test/fixtures/bodystmt.rb index 4cbb8f5e..5999fdba 100644 --- a/test/fixtures/bodystmt.rb +++ b/test/fixtures/bodystmt.rb @@ -36,6 +36,7 @@ end % begin +rescue StandardError else # else end % diff --git a/test/fixtures/break.rb b/test/fixtures/break.rb index 519becda..23277f6b 100644 --- a/test/fixtures/break.rb +++ b/test/fixtures/break.rb @@ -1,37 +1,45 @@ % -break +tap { break } % -break foo +tap { break foo } % -break foo, bar +tap { break foo, bar } % -break(foo) +tap { break(foo) } % -break fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo +tap { break fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo } - -break( - fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo -) +tap do + break( + fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo + ) +end % -break(fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo) +tap { break(fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo) } - -break( - fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo -) -% -break (foo), bar -% -break( - foo - bar -) -% -break foo.bar :baz do |qux| qux end +tap do + break( + fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo + ) +end +% +tap { break (foo), bar } +% +tap do + break( + foo + bar + ) +end +% +tap { break foo.bar :baz do |qux| qux end } - -break( - foo.bar :baz do |qux| - qux - end -) -% -break :foo => "bar" +tap do + break( + foo.bar :baz do |qux| + qux + end + ) +end +% +tap { break :foo => "bar" } diff --git a/test/fixtures/ifop.rb b/test/fixtures/ifop.rb index e56eb987..f7504658 100644 --- a/test/fixtures/ifop.rb +++ b/test/fixtures/ifop.rb @@ -11,8 +11,10 @@ % foo bar ? 1 : 2 % -foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo ? break : baz +tap { foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo ? break : baz } - -foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo ? - break : - baz +tap do + foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo ? + break : + baz +end diff --git a/test/fixtures/next.rb b/test/fixtures/next.rb index 66e90028..dc159488 100644 --- a/test/fixtures/next.rb +++ b/test/fixtures/next.rb @@ -1,76 +1,82 @@ % -next +tap { next } % -next foo +tap { next foo } % -next foo, bar +tap { next foo, bar } % -next(foo) +tap { next(foo) } % -next fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo +tap { next fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo } - -next( - fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo -) +tap do + next( + fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo + ) +end % -next(fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo) +tap { next(fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo) } - -next( - fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo -) -% -next (foo), bar -% -next( - foo - bar -) -% -next(1) +tap do + next( + fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo + ) +end +% +tap { next (foo), bar } +% +tap do + next( + foo + bar + ) +end +% +tap { next(1) } - -next 1 +tap { next 1 } % -next(1.0) +tap { next(1.0) } - -next 1.0 +tap { next 1.0 } % -next($a) +tap { next($a) } - -next $a +tap { next $a } % -next(@@a) +tap { next(@@a) } - -next @@a +tap { next @@a } % -next(self) +tap { next(self) } - -next self +tap { next self } % -next(@a) +tap { next(@a) } - -next @a +tap { next @a } % -next(A) +tap { next(A) } - -next A +tap { next A } % -next([]) +tap { next([]) } - -next [] +tap { next [] } % -next([1]) +tap { next([1]) } - -next [1] +tap { next [1] } % -next([1, 2]) +tap { next([1, 2]) } - -next 1, 2 +tap { next 1, 2 } % -next fun foo do end +tap { next fun foo do end } - -next( - fun foo do - end -) -% -next :foo => "bar" +tap do + next( + fun foo do + end + ) +end diff --git a/test/fixtures/redo.rb b/test/fixtures/redo.rb index 8ab087a2..962af3d0 100644 --- a/test/fixtures/redo.rb +++ b/test/fixtures/redo.rb @@ -1,4 +1,6 @@ % -redo +tap { redo } % -redo # comment +tap do + redo # comment +end diff --git a/test/fixtures/retry.rb b/test/fixtures/retry.rb index 2b14d21a..47b6be51 100644 --- a/test/fixtures/retry.rb +++ b/test/fixtures/retry.rb @@ -1,4 +1,10 @@ % -retry +begin +rescue StandardError + retry +end % -retry # comment +begin +rescue StandardError + retry # comment +end diff --git a/test/fixtures/var_field_rassign.rb b/test/fixtures/var_field_rassign.rb index 3e019c5c..aa5ec379 100644 --- a/test/fixtures/var_field_rassign.rb +++ b/test/fixtures/var_field_rassign.rb @@ -1,6 +1,7 @@ % foo in bar % +bar = 1 foo in ^bar % foo in ^@bar diff --git a/test/fixtures/yield.rb b/test/fixtures/yield.rb index f3f023f8..3cf1e5f1 100644 --- a/test/fixtures/yield.rb +++ b/test/fixtures/yield.rb @@ -1,16 +1,30 @@ % -yield foo +def foo + yield foo +end % -yield(foo) +def foo + yield(foo) +end % -yield foo, bar +def foo + yield foo, bar +end % -yield(foo, bar) +def foo + yield(foo, bar) +end % -yield foo # comment +def foo + yield foo # comment +end % -yield(foo) # comment +def foo + yield(foo) # comment +end % -yield( # comment - foo -) +def foo + yield( # comment + foo + ) +end diff --git a/test/fixtures/yield0.rb b/test/fixtures/yield0.rb index a168c4aa..c1833bb5 100644 --- a/test/fixtures/yield0.rb +++ b/test/fixtures/yield0.rb @@ -1,4 +1,8 @@ % -yield +def foo + yield +end % -yield # comment +def foo + yield # comment +end diff --git a/test/node_test.rb b/test/node_test.rb index 19fbeed2..f2706b2c 100644 --- a/test/node_test.rb +++ b/test/node_test.rb @@ -280,7 +280,10 @@ def test_brace_block end def test_break - assert_node(Break, "break value") + at = location(chars: 6..17) + assert_node(Break, "tap { break value }", at: at) do |node| + node.block.bodystmt.body.first + end end def test_call @@ -710,7 +713,10 @@ def test_mrhs_add_star end def test_next - assert_node(Next, "next(value)") + at = location(chars: 6..17) + assert_node(Next, "tap { next(value) }", at: at) do |node| + node.block.bodystmt.body.first + end end def test_op @@ -786,7 +792,9 @@ def test_rational end def test_redo - assert_node(Redo, "redo") + assert_node(Redo, "tap { redo }", at: location(chars: 6..10)) do |node| + node.block.bodystmt.body.first + end end def test_regexp_literal @@ -833,7 +841,10 @@ def test_rest_param end def test_retry - assert_node(Retry, "retry") + at = location(chars: 15..20) + assert_node(Retry, "begin; rescue; retry; end", at: at) do |node| + node.bodystmt.rescue_clause.statements.body.first + end end def test_return @@ -949,8 +960,8 @@ def test_var_field guard_version("3.1.0") do def test_pinned_var_ref - source = "foo in ^bar" - at = location(chars: 7..11) + source = "bar = 1; foo in ^bar" + at = location(chars: 16..20) assert_node(PinnedVarRef, source, at: at, &:pattern) end @@ -1013,11 +1024,17 @@ def test_xstring_heredoc end def test_yield - assert_node(YieldNode, "yield value") + at = location(lines: 2..2, chars: 10..21) + assert_node(YieldNode, "def foo\n yield value\nend\n", at: at) do |node| + node.bodystmt.statements.body.first + end end def test_yield0 - assert_node(YieldNode, "yield") + at = location(lines: 2..2, chars: 10..15) + assert_node(YieldNode, "def foo\n yield\nend\n", at: at) do |node| + node.bodystmt.statements.body.first + end end def test_zsuper diff --git a/test/test_helper.rb b/test/test_helper.rb index 8015be14..787f819d 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -106,17 +106,15 @@ def assert_syntax_tree(node) refute_includes(json, "#<") assert_equal(type, JSON.parse(json)["type"]) - if RUBY_ENGINE != "truffleruby" - # Get a match expression from the node, then assert that it can in fact - # match the node. - # rubocop:disable all - assert(eval(<<~RUBY)) - case node - in #{node.construct_keys} - true - end - RUBY - end + # Get a match expression from the node, then assert that it can in fact + # match the node. + # rubocop:disable all + assert(eval(<<~RUBY)) + case node + in #{node.construct_keys} + true + end + RUBY end Minitest::Test.include(self) diff --git a/test/translation/parser.txt b/test/translation/parser.txt index 5e9e8d31..d732cd0d 100644 --- a/test/translation/parser.txt +++ b/test/translation/parser.txt @@ -1,1237 +1,980 @@ -!!! assert_parses_args:2249:0 -def f (foo: 1, bar: 2, **baz, &b); end -!!! assert_parses_args:2249:1 -def f (foo: 1, &b); end -!!! assert_parses_args:2249:2 -def f **baz, &b; end -!!! assert_parses_args:2249:3 -def f *, **; end -!!! assert_parses_args:2249:4 -def f a, o=1, *r, &b; end -!!! assert_parses_args:2249:5 -def f a, o=1, *r, p, &b; end -!!! assert_parses_args:2249:6 -def f a, o=1, &b; end -!!! assert_parses_args:2249:7 -def f a, o=1, p, &b; end -!!! assert_parses_args:2249:8 -def f a, *r, &b; end -!!! assert_parses_args:2249:9 -def f a, *r, p, &b; end -!!! assert_parses_args:2249:10 -def f a, &b; end -!!! assert_parses_args:2249:11 -def f o=1, *r, &b; end -!!! assert_parses_args:2249:12 -def f o=1, *r, p, &b; end -!!! assert_parses_args:2249:13 -def f o=1, &b; end -!!! assert_parses_args:2249:14 -def f o=1, p, &b; end -!!! assert_parses_args:2249:15 -def f *r, &b; end -!!! assert_parses_args:2249:16 -def f *r, p, &b; end -!!! assert_parses_args:2249:17 -def f &b; end -!!! assert_parses_args:2249:18 -def f ; end -!!! assert_parses_args:2249:19 -def f (((a))); end -!!! assert_parses_args:2249:20 -def f ((a, a1)); end -!!! assert_parses_args:2249:21 -def f ((a, *r)); end -!!! assert_parses_args:2249:22 -def f ((a, *r, p)); end -!!! assert_parses_args:2249:23 -def f ((a, *)); end -!!! assert_parses_args:2249:24 -def f ((a, *, p)); end -!!! assert_parses_args:2249:25 -def f ((*r)); end -!!! assert_parses_args:2249:26 -def f ((*r, p)); end -!!! assert_parses_args:2249:27 -def f ((*)); end -!!! assert_parses_args:2249:28 -def f ((*, p)); end -!!! assert_parses_args:2249:29 -def f foo: -; end -!!! assert_parses_args:2249:30 -def f foo: -1 -; end -!!! assert_parses_blockargs:2506:0 -f{ |a| } -!!! assert_parses_blockargs:2506:1 -f{ |a, b,| } -!!! assert_parses_blockargs:2506:2 -f{ |a| } -!!! assert_parses_blockargs:2506:3 -f{ |foo:| } -!!! assert_parses_blockargs:2506:4 -f{ } -!!! assert_parses_blockargs:2506:5 -f{ | | } -!!! assert_parses_blockargs:2506:6 -f{ |;a| } -!!! assert_parses_blockargs:2506:7 -f{ |; -a -| } -!!! assert_parses_blockargs:2506:8 -f{ || } -!!! assert_parses_blockargs:2506:9 -f{ |a| } -!!! assert_parses_blockargs:2506:10 -f{ |a, c| } -!!! assert_parses_blockargs:2506:11 -f{ |a,| } -!!! assert_parses_blockargs:2506:12 -f{ |a, &b| } -!!! assert_parses_blockargs:2506:13 -f{ |a, *s, &b| } -!!! assert_parses_blockargs:2506:14 -f{ |a, *, &b| } -!!! assert_parses_blockargs:2506:15 -f{ |a, *s| } -!!! assert_parses_blockargs:2506:16 -f{ |a, *| } -!!! assert_parses_blockargs:2506:17 -f{ |*s, &b| } -!!! assert_parses_blockargs:2506:18 -f{ |*, &b| } -!!! assert_parses_blockargs:2506:19 -f{ |*s| } -!!! assert_parses_blockargs:2506:20 -f{ |*| } -!!! assert_parses_blockargs:2506:21 -f{ |&b| } -!!! assert_parses_blockargs:2506:22 -f{ |a, o=1, o1=2, *r, &b| } -!!! assert_parses_blockargs:2506:23 -f{ |a, o=1, *r, p, &b| } -!!! assert_parses_blockargs:2506:24 -f{ |a, o=1, &b| } -!!! assert_parses_blockargs:2506:25 -f{ |a, o=1, p, &b| } -!!! assert_parses_blockargs:2506:26 -f{ |a, *r, p, &b| } -!!! assert_parses_blockargs:2506:27 -f{ |o=1, *r, &b| } -!!! assert_parses_blockargs:2506:28 -f{ |o=1, *r, p, &b| } -!!! assert_parses_blockargs:2506:29 -f{ |o=1, &b| } -!!! assert_parses_blockargs:2506:30 -f{ |o=1, p, &b| } -!!! assert_parses_blockargs:2506:31 -f{ |*r, p, &b| } -!!! assert_parses_blockargs:2506:32 -f{ |foo: 1, bar: 2, **baz, &b| } -!!! assert_parses_blockargs:2506:33 -f{ |foo: 1, &b| } -!!! assert_parses_blockargs:2506:34 -f{ |**baz, &b| } -!!! assert_parses_pattern_match:8503:0 -case foo; in self then true; end -!!! assert_parses_pattern_match:8503:1 -case foo; in 1..2 then true; end -!!! assert_parses_pattern_match:8503:2 -case foo; in 1.. then true; end -!!! assert_parses_pattern_match:8503:3 -case foo; in ..2 then true; end -!!! assert_parses_pattern_match:8503:4 -case foo; in 1...2 then true; end -!!! assert_parses_pattern_match:8503:5 -case foo; in 1... then true; end -!!! assert_parses_pattern_match:8503:6 -case foo; in ...2 then true; end -!!! assert_parses_pattern_match:8503:7 -case foo; in [*x, 1 => a, *y] then true; end -!!! assert_parses_pattern_match:8503:8 -case foo; in String(*, 1, *) then true; end -!!! assert_parses_pattern_match:8503:9 -case foo; in Array[*, 1, *] then true; end -!!! assert_parses_pattern_match:8503:10 -case foo; in *, 42, * then true; end -!!! assert_parses_pattern_match:8503:11 -case foo; in x, then nil; end -!!! assert_parses_pattern_match:8503:12 -case foo; in *x then nil; end -!!! assert_parses_pattern_match:8503:13 -case foo; in * then nil; end -!!! assert_parses_pattern_match:8503:14 -case foo; in x, y then nil; end -!!! assert_parses_pattern_match:8503:15 -case foo; in x, y, then nil; end -!!! assert_parses_pattern_match:8503:16 -case foo; in x, *y, z then nil; end -!!! assert_parses_pattern_match:8503:17 -case foo; in *x, y, z then nil; end -!!! assert_parses_pattern_match:8503:18 -case foo; in 1, "a", [], {} then nil; end -!!! assert_parses_pattern_match:8503:19 -case foo; in ->{ 42 } then true; end -!!! assert_parses_pattern_match:8503:20 -case foo; in A(1, 2) then true; end -!!! assert_parses_pattern_match:8503:21 -case foo; in A(x:) then true; end -!!! assert_parses_pattern_match:8503:22 -case foo; in A() then true; end -!!! assert_parses_pattern_match:8503:23 -case foo; in A[1, 2] then true; end -!!! assert_parses_pattern_match:8503:24 -case foo; in A[x:] then true; end -!!! assert_parses_pattern_match:8503:25 -case foo; in A[] then true; end -!!! assert_parses_pattern_match:8503:26 -case foo; in x then x; end -!!! assert_parses_pattern_match:8503:27 -case foo; in {} then true; end -!!! assert_parses_pattern_match:8503:28 -case foo; in a: 1 then true; end -!!! assert_parses_pattern_match:8503:29 -case foo; in { a: 1 } then true; end -!!! assert_parses_pattern_match:8503:30 -case foo; in { a: 1, } then true; end -!!! assert_parses_pattern_match:8503:31 -case foo; in a: then true; end -!!! assert_parses_pattern_match:8503:32 -case foo; in **a then true; end -!!! assert_parses_pattern_match:8503:33 -case foo; in ** then true; end -!!! assert_parses_pattern_match:8503:34 -case foo; in a: 1, b: 2 then true; end -!!! assert_parses_pattern_match:8503:35 -case foo; in a:, b: then true; end -!!! assert_parses_pattern_match:8503:36 -case foo; in a: 1, _a:, ** then true; end -!!! assert_parses_pattern_match:8503:37 -case foo; - in {a: 1 - } - false - ; end -!!! assert_parses_pattern_match:8503:38 -case foo; - in {a: - 2} - false - ; end -!!! assert_parses_pattern_match:8503:39 -case foo; - in {Foo: 42 - } - false - ; end -!!! assert_parses_pattern_match:8503:40 -case foo; - in a: {b:}, c: - p c - ; end -!!! assert_parses_pattern_match:8503:41 -case foo; - in {a: - } - true - ; end -!!! assert_parses_pattern_match:8503:42 -case foo; in A then true; end -!!! assert_parses_pattern_match:8503:43 -case foo; in A::B then true; end -!!! assert_parses_pattern_match:8503:44 -case foo; in ::A then true; end -!!! assert_parses_pattern_match:8503:45 -case foo; in [x] then nil; end -!!! assert_parses_pattern_match:8503:46 -case foo; in [x,] then nil; end -!!! assert_parses_pattern_match:8503:47 -case foo; in [x, y] then true; end -!!! assert_parses_pattern_match:8503:48 -case foo; in [x, y,] then true; end -!!! assert_parses_pattern_match:8503:49 -case foo; in [x, y, *] then true; end -!!! assert_parses_pattern_match:8503:50 -case foo; in [x, y, *z] then true; end -!!! assert_parses_pattern_match:8503:51 -case foo; in [x, *y, z] then true; end -!!! assert_parses_pattern_match:8503:52 -case foo; in [x, *, y] then true; end -!!! assert_parses_pattern_match:8503:53 -case foo; in [*x, y] then true; end -!!! assert_parses_pattern_match:8503:54 -case foo; in [*, x] then true; end -!!! assert_parses_pattern_match:8503:55 -case foo; in (1) then true; end -!!! assert_parses_pattern_match:8503:56 -case foo; in x if true; nil; end -!!! assert_parses_pattern_match:8503:57 -case foo; in x unless true; nil; end -!!! assert_parses_pattern_match:8503:58 -case foo; in 1; end -!!! assert_parses_pattern_match:8503:59 -case foo; in ^foo then nil; end -!!! assert_parses_pattern_match:8503:60 -case foo; in "a": then true; end -!!! assert_parses_pattern_match:8503:61 -case foo; in "#{ 'a' }": then true; end -!!! assert_parses_pattern_match:8503:62 -case foo; in "#{ %q{a} }": then true; end -!!! assert_parses_pattern_match:8503:63 -case foo; in "#{ %Q{a} }": then true; end -!!! assert_parses_pattern_match:8503:64 -case foo; in "a": 1 then true; end -!!! assert_parses_pattern_match:8503:65 -case foo; in "#{ 'a' }": 1 then true; end -!!! assert_parses_pattern_match:8503:66 -case foo; in "#{ %q{a} }": 1 then true; end -!!! assert_parses_pattern_match:8503:67 -case foo; in "#{ %Q{a} }": 1 then true; end -!!! assert_parses_pattern_match:8503:68 -case foo; in ^(42) then nil; end -!!! assert_parses_pattern_match:8503:69 -case foo; in { foo: ^(42) } then nil; end -!!! assert_parses_pattern_match:8503:70 -case foo; in ^(0+0) then nil; end -!!! assert_parses_pattern_match:8503:71 -case foo; in ^@a; end -!!! assert_parses_pattern_match:8503:72 -case foo; in ^@@TestPatternMatching; end -!!! assert_parses_pattern_match:8503:73 -case foo; in ^$TestPatternMatching; end -!!! assert_parses_pattern_match:8503:74 -case foo; in ^(1 -); end -!!! assert_parses_pattern_match:8503:75 -case foo; in 1 | 2 then true; end -!!! assert_parses_pattern_match:8503:76 -case foo; in 1 => a then true; end -!!! assert_parses_pattern_match:8503:77 -case foo; in **nil then true; end -!!! block in test_endless_comparison_method:10392:0 -def ===(other) = do_something -!!! block in test_endless_comparison_method:10392:1 -def ==(other) = do_something -!!! block in test_endless_comparison_method:10392:2 -def !=(other) = do_something -!!! block in test_endless_comparison_method:10392:3 -def <=(other) = do_something -!!! block in test_endless_comparison_method:10392:4 -def >=(other) = do_something -!!! block in test_endless_comparison_method:10392:5 -def !=(other) = do_something -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:0 -'a\ -b' -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:1 -<<-'HERE' -a\ -b -HERE -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:2 -%q{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:3 -"a\ -b" -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:4 -<<-"HERE" -a\ -b -HERE -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:5 -%{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:6 -%Q{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:7 -%w{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:8 -%W{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:9 -%i{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:10 -%I{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:11 -:'a\ -b' -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:12 -%s{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:13 -:"a\ -b" -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:14 -/a\ -b/ -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:15 -%r{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:16 -%x{a\ -b} -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:17 -`a\ -b` -!!! block in test_parser_slash_slash_n_escaping_in_literals:7327:18 -<<-`HERE` -a\ -b -HERE -!!! block in test_ruby_bug_11873_a:6017:0 -a b{c d}, :e do end -!!! block in test_ruby_bug_11873_a:6017:1 -a b{c d}, 1 do end -!!! block in test_ruby_bug_11873_a:6017:2 -a b{c d}, 1.0 do end -!!! block in test_ruby_bug_11873_a:6017:3 -a b{c d}, 1.0r do end -!!! block in test_ruby_bug_11873_a:6017:4 -a b{c d}, 1.0i do end -!!! block in test_ruby_bug_11873_a:6022:0 -a b{c(d)}, :e do end -!!! block in test_ruby_bug_11873_a:6022:1 -a b{c(d)}, 1 do end -!!! block in test_ruby_bug_11873_a:6022:2 -a b{c(d)}, 1.0 do end -!!! block in test_ruby_bug_11873_a:6022:3 -a b{c(d)}, 1.0r do end -!!! block in test_ruby_bug_11873_a:6022:4 -a b{c(d)}, 1.0i do end -!!! block in test_ruby_bug_11873_a:6036:0 -a b(c d), :e do end -!!! block in test_ruby_bug_11873_a:6036:1 -a b(c d), 1 do end -!!! block in test_ruby_bug_11873_a:6036:2 -a b(c d), 1.0 do end -!!! block in test_ruby_bug_11873_a:6036:3 -a b(c d), 1.0r do end -!!! block in test_ruby_bug_11873_a:6036:4 -a b(c d), 1.0i do end -!!! block in test_ruby_bug_11873_a:6041:0 -a b(c(d)), :e do end -!!! block in test_ruby_bug_11873_a:6041:1 -a b(c(d)), 1 do end -!!! block in test_ruby_bug_11873_a:6041:2 -a b(c(d)), 1.0 do end -!!! block in test_ruby_bug_11873_a:6041:3 -a b(c(d)), 1.0r do end -!!! block in test_ruby_bug_11873_a:6041:4 -a b(c(d)), 1.0i do end -!!! test___ENCODING__:1037 +!!! test___ENCODING__:1051 __ENCODING__ -!!! test___ENCODING___legacy_:1046 +!!! test___ENCODING___legacy_:1060 __ENCODING__ -!!! test_alias:2020 +!!! test_alias:2034 alias :foo bar -!!! test_alias_gvar:2032 +!!! test_alias_gvar:2046 alias $a $b -!!! test_alias_gvar:2037 +!!! test_alias_gvar:2051 alias $a $+ -!!! test_ambiuous_quoted_label_in_ternary_operator:7204 +!!! test_ambiuous_quoted_label_in_ternary_operator:7389 a ? b & '': nil -!!! test_and:4447 +!!! test_and:4507 foo and bar -!!! test_and:4453 +!!! test_and:4513 foo && bar -!!! test_and_asgn:1748 +!!! test_and_asgn:1762 foo.a &&= 1 -!!! test_and_asgn:1758 +!!! test_and_asgn:1772 foo[0, 1] &&= 2 -!!! test_and_or_masgn:4475 +!!! test_and_or_masgn:4535 foo && (a, b = bar) -!!! test_and_or_masgn:4484 +!!! test_and_or_masgn:4544 foo || (a, b = bar) -!!! test_anonymous_blockarg:10861 +!!! test_anonymous_blockarg:11205 def foo(&); bar(&); end -!!! test_arg:2055 +!!! test_arg:2069 def f(foo); end -!!! test_arg:2066 +!!! test_arg:2080 def f(foo, bar); end -!!! test_arg_duplicate_ignored:2958 -def foo(_, _); end +!!! test_arg_combinations:2272 +def f a, o=1, *r, &b; end +!!! test_arg_combinations:2281 +def f a, o=1, *r, p, &b; end +!!! test_arg_combinations:2292 +def f a, o=1, &b; end +!!! test_arg_combinations:2300 +def f a, o=1, p, &b; end +!!! test_arg_combinations:2310 +def f a, *r, &b; end +!!! test_arg_combinations:2318 +def f a, *r, p, &b; end +!!! test_arg_combinations:2328 +def f a, &b; end +!!! test_arg_combinations:2335 +def f o=1, *r, &b; end +!!! test_arg_combinations:2343 +def f o=1, *r, p, &b; end +!!! test_arg_combinations:2353 +def f o=1, &b; end +!!! test_arg_combinations:2360 +def f o=1, p, &b; end +!!! test_arg_combinations:2369 +def f *r, &b; end +!!! test_arg_combinations:2376 +def f *r, p, &b; end +!!! test_arg_combinations:2385 +def f &b; end +!!! test_arg_combinations:2391 +def f ; end !!! test_arg_duplicate_ignored:2972 +def foo(_, _); end +!!! test_arg_duplicate_ignored:2986 def foo(_a, _a); end -!!! test_arg_label:3012 +!!! test_arg_label:3026 def foo() a:b end -!!! test_arg_label:3019 +!!! test_arg_label:3033 def foo a:b end -!!! test_arg_label:3026 +!!! test_arg_label:3040 f { || a:b } -!!! test_arg_scope:2238 +!!! test_arg_scope:2252 lambda{|;a|a} -!!! test_args_args_assocs:4077 +!!! test_args_args_assocs:4137 fun(foo, :foo => 1) -!!! test_args_args_assocs:4083 +!!! test_args_args_assocs:4143 fun(foo, :foo => 1, &baz) -!!! test_args_args_assocs_comma:4092 +!!! test_args_args_assocs_comma:4152 foo[bar, :baz => 1,] -!!! test_args_args_comma:3941 +!!! test_args_args_comma:4001 foo[bar,] -!!! test_args_args_star:3908 +!!! test_args_args_star:3968 fun(foo, *bar) -!!! test_args_args_star:3913 +!!! test_args_args_star:3973 fun(foo, *bar, &baz) -!!! test_args_assocs:4001 +!!! test_args_assocs:4061 fun(:foo => 1) -!!! test_args_assocs:4006 +!!! test_args_assocs:4066 fun(:foo => 1, &baz) -!!! test_args_assocs:4012 +!!! test_args_assocs:4072 self[:bar => 1] -!!! test_args_assocs:4021 +!!! test_args_assocs:4081 self.[]= foo, :a => 1 -!!! test_args_assocs:4031 +!!! test_args_assocs:4091 yield(:foo => 42) -!!! test_args_assocs:4039 +!!! test_args_assocs:4099 super(:foo => 42) -!!! test_args_assocs_comma:4068 +!!! test_args_assocs_comma:4128 foo[:baz => 1,] -!!! test_args_assocs_legacy:3951 +!!! test_args_assocs_legacy:4011 fun(:foo => 1) -!!! test_args_assocs_legacy:3956 +!!! test_args_assocs_legacy:4016 fun(:foo => 1, &baz) -!!! test_args_assocs_legacy:3962 +!!! test_args_assocs_legacy:4022 self[:bar => 1] -!!! test_args_assocs_legacy:3971 +!!! test_args_assocs_legacy:4031 self.[]= foo, :a => 1 -!!! test_args_assocs_legacy:3981 +!!! test_args_assocs_legacy:4041 yield(:foo => 42) -!!! test_args_assocs_legacy:3989 +!!! test_args_assocs_legacy:4049 super(:foo => 42) -!!! test_args_block_pass:3934 +!!! test_args_block_pass:3994 fun(&bar) -!!! test_args_cmd:3901 +!!! test_args_cmd:3961 fun(f bar) -!!! test_args_star:3921 +!!! test_args_star:3981 fun(*bar) -!!! test_args_star:3926 +!!! test_args_star:3986 fun(*bar, &baz) -!!! test_array_assocs:629 +!!! test_array_assocs:643 [ 1 => 2 ] -!!! test_array_assocs:637 +!!! test_array_assocs:651 [ 1, 2 => 3 ] -!!! test_array_plain:589 +!!! test_array_plain:603 [1, 2] -!!! test_array_splat:598 +!!! test_array_splat:612 [1, *foo, 2] -!!! test_array_splat:611 +!!! test_array_splat:625 [1, *foo] -!!! test_array_splat:622 +!!! test_array_splat:636 [*foo] -!!! test_array_symbols:695 +!!! test_array_symbols:709 %i[foo bar] -!!! test_array_symbols_empty:732 +!!! test_array_symbols_empty:746 %i[] -!!! test_array_symbols_empty:740 +!!! test_array_symbols_empty:754 %I() -!!! test_array_symbols_interp:706 +!!! test_array_symbols_interp:720 %I[foo #{bar}] -!!! test_array_symbols_interp:721 +!!! test_array_symbols_interp:735 %I[foo#{bar}] -!!! test_array_words:647 +!!! test_array_words:661 %w[foo bar] -!!! test_array_words_empty:682 +!!! test_array_words_empty:696 %w[] -!!! test_array_words_empty:689 +!!! test_array_words_empty:703 %W() -!!! test_array_words_interp:657 -%W[foo #{bar}] !!! test_array_words_interp:671 +%W[foo #{bar}] +!!! test_array_words_interp:685 %W[foo #{bar}foo#@baz] -!!! test_asgn_cmd:1126 +!!! test_asgn_cmd:1140 foo = m foo -!!! test_asgn_cmd:1130 +!!! test_asgn_cmd:1144 foo = bar = m foo -!!! test_asgn_mrhs:1449 +!!! test_asgn_mrhs:1463 foo = bar, 1 -!!! test_asgn_mrhs:1456 +!!! test_asgn_mrhs:1470 foo = *bar -!!! test_asgn_mrhs:1461 +!!! test_asgn_mrhs:1475 foo = baz, *bar -!!! test_back_ref:995 +!!! test_back_ref:1009 $+ -!!! test_bang:3434 +!!! test_bang:3448 !foo -!!! test_bang_cmd:3448 +!!! test_bang_cmd:3462 !m foo -!!! test_begin_cmdarg:5526 +!!! test_begin_cmdarg:5658 p begin 1.times do 1 end end -!!! test_beginless_erange_after_newline:935 +!!! test_beginless_erange_after_newline:949 foo ...100 -!!! test_beginless_irange_after_newline:923 +!!! test_beginless_irange_after_newline:937 foo ..100 -!!! test_beginless_range:903 +!!! test_beginless_range:917 ..100 -!!! test_beginless_range:912 +!!! test_beginless_range:926 ...100 -!!! test_blockarg:2187 +!!! test_block_arg_combinations:2531 +f{ } +!!! test_block_arg_combinations:2537 +f{ | | } +!!! test_block_arg_combinations:2541 +f{ |;a| } +!!! test_block_arg_combinations:2546 +f{ |; +a +| } +!!! test_block_arg_combinations:2552 +f{ || } +!!! test_block_arg_combinations:2561 +f{ |a| } +!!! test_block_arg_combinations:2571 +f{ |a, c| } +!!! test_block_arg_combinations:2580 +f{ |a,| } +!!! test_block_arg_combinations:2585 +f{ |a, &b| } +!!! test_block_arg_combinations:2599 +f{ |a, *s, &b| } +!!! test_block_arg_combinations:2610 +f{ |a, *, &b| } +!!! test_block_arg_combinations:2621 +f{ |a, *s| } +!!! test_block_arg_combinations:2631 +f{ |a, *| } +!!! test_block_arg_combinations:2640 +f{ |*s, &b| } +!!! test_block_arg_combinations:2651 +f{ |*, &b| } +!!! test_block_arg_combinations:2662 +f{ |*s| } +!!! test_block_arg_combinations:2672 +f{ |*| } +!!! test_block_arg_combinations:2678 +f{ |&b| } +!!! test_block_arg_combinations:2689 +f{ |a, o=1, o1=2, *r, &b| } +!!! test_block_arg_combinations:2700 +f{ |a, o=1, *r, p, &b| } +!!! test_block_arg_combinations:2711 +f{ |a, o=1, &b| } +!!! test_block_arg_combinations:2720 +f{ |a, o=1, p, &b| } +!!! test_block_arg_combinations:2730 +f{ |a, *r, p, &b| } +!!! test_block_arg_combinations:2740 +f{ |o=1, *r, &b| } +!!! test_block_arg_combinations:2749 +f{ |o=1, *r, p, &b| } +!!! test_block_arg_combinations:2759 +f{ |o=1, &b| } +!!! test_block_arg_combinations:2767 +f{ |o=1, p, &b| } +!!! test_block_arg_combinations:2776 +f{ |*r, p, &b| } +!!! test_block_kwarg:2867 +f{ |foo:| } +!!! test_block_kwarg_combinations:2840 +f{ |foo: 1, bar: 2, **baz, &b| } +!!! test_block_kwarg_combinations:2850 +f{ |foo: 1, &b| } +!!! test_block_kwarg_combinations:2858 +f{ |**baz, &b| } +!!! test_blockarg:2201 def f(&block); end -!!! test_break:5037 +!!! test_break:5169 break(foo) -!!! test_break:5051 +!!! test_break:5183 break foo -!!! test_break:5057 +!!! test_break:5189 break() -!!! test_break:5064 +!!! test_break:5196 break -!!! test_break_block:5072 +!!! test_break_block:5204 break fun foo do end -!!! test_bug_435:7067 +!!! test_bug_435:7252 "#{-> foo {}}" -!!! test_bug_447:7046 +!!! test_bug_447:7231 m [] do end -!!! test_bug_447:7055 +!!! test_bug_447:7240 m [], 1 do end -!!! test_bug_452:7080 +!!! test_bug_452:7265 td (1_500).toString(); td.num do; end -!!! test_bug_466:7096 +!!! test_bug_466:7281 foo "#{(1+1).to_i}" do; end -!!! test_bug_473:7113 +!!! test_bug_473:7298 m "#{[]}" -!!! test_bug_480:7124 +!!! test_bug_480:7309 m "#{}#{()}" -!!! test_bug_481:7136 +!!! test_bug_481:7321 m def x(); end; 1.tap do end -!!! test_bug_ascii_8bit_in_literal:5880 +!!! test_bug_ascii_8bit_in_literal:6031 # coding:utf-8 "\xD0\xBF\xD1\x80\xD0\xBE\xD0\xB2\xD0\xB5\xD1\x80\xD0\xBA\xD0\xB0" -!!! test_bug_cmd_string_lookahead:5752 +!!! test_bug_cmd_string_lookahead:5903 desc "foo" do end -!!! test_bug_cmdarg:5549 +!!! test_bug_cmdarg:5681 assert dogs -!!! test_bug_cmdarg:5554 +!!! test_bug_cmdarg:5686 assert do: true -!!! test_bug_cmdarg:5562 +!!! test_bug_cmdarg:5694 f x: -> do meth do end end -!!! test_bug_def_no_paren_eql_begin:5799 +!!! test_bug_def_no_paren_eql_begin:5950 def foo =begin =end end -!!! test_bug_do_block_in_call_args:5762 +!!! test_bug_do_block_in_call_args:5913 bar def foo; self.each do end end -!!! test_bug_do_block_in_cmdarg:5777 +!!! test_bug_do_block_in_cmdarg:5928 tap (proc do end) -!!! test_bug_do_block_in_hash_brace:6569 +!!! test_bug_do_block_in_hash_brace:6720 p :foo, {a: proc do end, b: proc do end} -!!! test_bug_do_block_in_hash_brace:6587 +!!! test_bug_do_block_in_hash_brace:6738 p :foo, {:a => proc do end, b: proc do end} -!!! test_bug_do_block_in_hash_brace:6605 +!!! test_bug_do_block_in_hash_brace:6756 p :foo, {"a": proc do end, b: proc do end} -!!! test_bug_do_block_in_hash_brace:6623 +!!! test_bug_do_block_in_hash_brace:6774 p :foo, {proc do end => proc do end, b: proc do end} -!!! test_bug_do_block_in_hash_brace:6643 +!!! test_bug_do_block_in_hash_brace:6794 p :foo, {** proc do end, b: proc do end} -!!! test_bug_heredoc_do:5835 +!!! test_bug_heredoc_do:5986 f <<-TABLE do TABLE end -!!! test_bug_interp_single:5789 +!!! test_bug_interp_single:5940 "#{1}" -!!! test_bug_interp_single:5793 +!!! test_bug_interp_single:5944 %W"#{1}" -!!! test_bug_lambda_leakage:6550 +!!! test_bug_lambda_leakage:6701 ->(scope) {}; scope -!!! test_bug_regex_verification:6563 +!!! test_bug_regex_verification:6714 /#)/x -!!! test_bug_rescue_empty_else:5813 +!!! test_bug_rescue_empty_else:5964 begin; rescue LoadError; else; end -!!! test_bug_while_not_parens_do:5805 +!!! test_bug_while_not_parens_do:5956 while not (true) do end -!!! test_case_cond:4844 +!!! test_case_cond:4976 case; when foo; 'foo'; end -!!! test_case_cond_else:4857 +!!! test_case_cond_else:4989 case; when foo; 'foo'; else 'bar'; end -!!! test_case_expr:4816 +!!! test_case_expr:4948 case foo; when 'bar'; bar; end -!!! test_case_expr_else:4830 +!!! test_case_expr_else:4962 case foo; when 'bar'; bar; else baz; end -!!! test_casgn_scoped:1192 +!!! test_casgn_scoped:1206 Bar::Foo = 10 -!!! test_casgn_toplevel:1181 +!!! test_casgn_toplevel:1195 ::Foo = 10 -!!! test_casgn_unscoped:1203 +!!! test_casgn_unscoped:1217 Foo = 10 -!!! test_character:248 +!!! test_character:250 ?a -!!! test_class:1827 +!!! test_class:1841 class Foo; end -!!! test_class:1837 +!!! test_class:1851 class Foo end -!!! test_class_definition_in_while_cond:6870 +!!! test_class_definition_in_while_cond:7055 while class Foo; tap do end; end; break; end -!!! test_class_definition_in_while_cond:6882 +!!! test_class_definition_in_while_cond:7067 while class Foo a = tap do end; end; break; end -!!! test_class_definition_in_while_cond:6895 +!!! test_class_definition_in_while_cond:7080 while class << self; tap do end; end; break; end -!!! test_class_definition_in_while_cond:6907 +!!! test_class_definition_in_while_cond:7092 while class << self; a = tap do end; end; break; end -!!! test_class_super:1848 +!!! test_class_super:1862 class Foo < Bar; end -!!! test_class_super_label:1860 +!!! test_class_super_label:1874 class Foo < a:b; end -!!! test_comments_before_leading_dot__27:7750 +!!! test_comments_before_leading_dot__27:7941 a # # .foo -!!! test_comments_before_leading_dot__27:7757 +!!! test_comments_before_leading_dot__27:7948 a # # .foo -!!! test_comments_before_leading_dot__27:7764 +!!! test_comments_before_leading_dot__27:7955 a # # &.foo -!!! test_comments_before_leading_dot__27:7771 +!!! test_comments_before_leading_dot__27:7962 a # # &.foo -!!! test_complex:156 +!!! test_complex:158 42i -!!! test_complex:162 +!!! test_complex:164 42ri -!!! test_complex:168 +!!! test_complex:170 42.1i -!!! test_complex:174 +!!! test_complex:176 42.1ri -!!! test_cond_begin:4686 +!!! test_cond_begin:4746 if (bar); foo; end -!!! test_cond_begin_masgn:4695 +!!! test_cond_begin_masgn:4755 if (bar; a, b = foo); end -!!! test_cond_eflipflop:4758 +!!! test_cond_eflipflop:4854 if foo...bar; end -!!! test_cond_eflipflop:4772 +!!! test_cond_eflipflop:4884 !(foo...bar) -!!! test_cond_iflipflop:4735 +!!! test_cond_eflipflop_with_beginless_range:4903 +if ...bar; end +!!! test_cond_eflipflop_with_endless_range:4893 +if foo...; end +!!! test_cond_iflipflop:4795 if foo..bar; end -!!! test_cond_iflipflop:4749 +!!! test_cond_iflipflop:4825 !(foo..bar) -!!! test_cond_match_current_line:4781 +!!! test_cond_iflipflop_with_beginless_range:4844 +if ..bar; end +!!! test_cond_iflipflop_with_endless_range:4834 +if foo..; end +!!! test_cond_match_current_line:4913 if /wat/; end -!!! test_cond_match_current_line:4801 +!!! test_cond_match_current_line:4933 !/wat/ -!!! test_const_op_asgn:1536 +!!! test_const_op_asgn:1550 A += 1 -!!! test_const_op_asgn:1542 +!!! test_const_op_asgn:1556 ::A += 1 -!!! test_const_op_asgn:1550 +!!! test_const_op_asgn:1564 B::A += 1 -!!! test_const_op_asgn:1558 +!!! test_const_op_asgn:1572 def x; self::A ||= 1; end -!!! test_const_op_asgn:1567 +!!! test_const_op_asgn:1581 def x; ::A ||= 1; end -!!! test_const_scoped:1020 +!!! test_const_scoped:1034 Bar::Foo -!!! test_const_toplevel:1011 +!!! test_const_toplevel:1025 ::Foo -!!! test_const_unscoped:1029 +!!! test_const_unscoped:1043 Foo -!!! test_control_meta_escape_chars_in_regexp__since_31:10686 +!!! test_control_meta_escape_chars_in_regexp__since_31:11030 /\c\xFF/ -!!! test_control_meta_escape_chars_in_regexp__since_31:10692 +!!! test_control_meta_escape_chars_in_regexp__since_31:11036 /\c\M-\xFF/ -!!! test_control_meta_escape_chars_in_regexp__since_31:10698 +!!! test_control_meta_escape_chars_in_regexp__since_31:11042 /\C-\xFF/ -!!! test_control_meta_escape_chars_in_regexp__since_31:10704 +!!! test_control_meta_escape_chars_in_regexp__since_31:11048 /\C-\M-\xFF/ -!!! test_control_meta_escape_chars_in_regexp__since_31:10710 +!!! test_control_meta_escape_chars_in_regexp__since_31:11054 /\M-\xFF/ -!!! test_control_meta_escape_chars_in_regexp__since_31:10716 +!!! test_control_meta_escape_chars_in_regexp__since_31:11060 /\M-\C-\xFF/ -!!! test_control_meta_escape_chars_in_regexp__since_31:10722 +!!! test_control_meta_escape_chars_in_regexp__since_31:11066 /\M-\c\xFF/ -!!! test_cpath:1807 +!!! test_cpath:1821 module ::Foo; end -!!! test_cpath:1813 +!!! test_cpath:1827 module Bar::Foo; end -!!! test_cvar:973 +!!! test_cvar:987 @@foo -!!! test_cvasgn:1106 +!!! test_cvasgn:1120 @@var = 10 -!!! test_dedenting_heredoc:297 +!!! test_dedenting_heredoc:299 p <<~E E -!!! test_dedenting_heredoc:304 +!!! test_dedenting_heredoc:306 p <<~E E -!!! test_dedenting_heredoc:311 +!!! test_dedenting_heredoc:313 p <<~E x E -!!! test_dedenting_heredoc:318 +!!! test_dedenting_heredoc:320 p <<~E ð E -!!! test_dedenting_heredoc:325 +!!! test_dedenting_heredoc:327 p <<~E x y E -!!! test_dedenting_heredoc:334 +!!! test_dedenting_heredoc:336 p <<~E x y E -!!! test_dedenting_heredoc:343 +!!! test_dedenting_heredoc:345 p <<~E x y E -!!! test_dedenting_heredoc:352 +!!! test_dedenting_heredoc:354 p <<~E x y E -!!! test_dedenting_heredoc:361 +!!! test_dedenting_heredoc:363 p <<~E x y E -!!! test_dedenting_heredoc:370 +!!! test_dedenting_heredoc:372 p <<~E x y E -!!! test_dedenting_heredoc:380 +!!! test_dedenting_heredoc:382 p <<~E x y E -!!! test_dedenting_heredoc:390 +!!! test_dedenting_heredoc:392 p <<~E x \ y E -!!! test_dedenting_heredoc:399 +!!! test_dedenting_heredoc:401 p <<~E x \ y E -!!! test_dedenting_heredoc:408 +!!! test_dedenting_heredoc:410 p <<~"E" x #{foo} E -!!! test_dedenting_heredoc:419 +!!! test_dedenting_heredoc:421 p <<~`E` x #{foo} E -!!! test_dedenting_heredoc:430 +!!! test_dedenting_heredoc:432 p <<~"E" x #{" y"} E -!!! test_dedenting_interpolating_heredoc_fake_line_continuation:459 +!!! test_dedenting_interpolating_heredoc_fake_line_continuation:461 <<~'FOO' baz\\ qux FOO -!!! test_dedenting_non_interpolating_heredoc_line_continuation:451 +!!! test_dedenting_non_interpolating_heredoc_line_continuation:453 <<~'FOO' baz\ qux FOO -!!! test_def:1899 +!!! test_def:1913 def foo; end -!!! test_def:1907 +!!! test_def:1921 def String; end -!!! test_def:1911 +!!! test_def:1925 def String=; end -!!! test_def:1915 +!!! test_def:1929 def until; end -!!! test_def:1919 +!!! test_def:1933 def BEGIN; end -!!! test_def:1923 +!!! test_def:1937 def END; end -!!! test_defined:1058 +!!! test_defined:1072 defined? foo -!!! test_defined:1064 +!!! test_defined:1078 defined?(foo) -!!! test_defined:1072 +!!! test_defined:1086 defined? @foo -!!! test_defs:1929 +!!! test_defs:1943 def self.foo; end -!!! test_defs:1937 +!!! test_defs:1951 def self::foo; end -!!! test_defs:1945 +!!! test_defs:1959 def (foo).foo; end -!!! test_defs:1949 +!!! test_defs:1963 def String.foo; end -!!! test_defs:1954 +!!! test_defs:1968 def String::foo; end -!!! test_empty_stmt:60 -!!! test_endless_method:9786 +!!! test_emit_arg_inside_procarg0_legacy:2807 +f{ |a| } +!!! test_empty_stmt:62 +!!! test_endless_comparison_method:10736:0 +def ===(other) = do_something +!!! test_endless_comparison_method:10736:1 +def ==(other) = do_something +!!! test_endless_comparison_method:10736:2 +def !=(other) = do_something +!!! test_endless_comparison_method:10736:3 +def <=(other) = do_something +!!! test_endless_comparison_method:10736:4 +def >=(other) = do_something +!!! test_endless_comparison_method:10736:5 +def !=(other) = do_something +!!! test_endless_method:10085 def foo() = 42 -!!! test_endless_method:9798 +!!! test_endless_method:10097 def inc(x) = x + 1 -!!! test_endless_method:9811 +!!! test_endless_method:10110 def obj.foo() = 42 -!!! test_endless_method:9823 +!!! test_endless_method:10122 def obj.inc(x) = x + 1 -!!! test_endless_method_command_syntax:9880 +!!! test_endless_method_command_syntax:10179 def foo = puts "Hello" -!!! test_endless_method_command_syntax:9892 +!!! test_endless_method_command_syntax:10191 def foo() = puts "Hello" -!!! test_endless_method_command_syntax:9904 +!!! test_endless_method_command_syntax:10203 def foo(x) = puts x -!!! test_endless_method_command_syntax:9917 +!!! test_endless_method_command_syntax:10216 def obj.foo = puts "Hello" -!!! test_endless_method_command_syntax:9931 +!!! test_endless_method_command_syntax:10230 def obj.foo() = puts "Hello" -!!! test_endless_method_command_syntax:9945 +!!! test_endless_method_command_syntax:10244 def rescued(x) = raise "to be caught" rescue "instance #{x}" -!!! test_endless_method_command_syntax:9964 +!!! test_endless_method_command_syntax:10263 def self.rescued(x) = raise "to be caught" rescue "class #{x}" -!!! test_endless_method_command_syntax:9985 +!!! test_endless_method_command_syntax:10284 def obj.foo(x) = puts x -!!! test_endless_method_forwarded_args_legacy:9840 +!!! test_endless_method_forwarded_args_legacy:10139 def foo(...) = bar(...) -!!! test_endless_method_with_rescue_mod:9855 +!!! test_endless_method_with_rescue_mod:10154 def m() = 1 rescue 2 -!!! test_endless_method_with_rescue_mod:9866 +!!! test_endless_method_with_rescue_mod:10165 def self.m() = 1 rescue 2 -!!! test_endless_method_without_args:10404 +!!! test_endless_method_without_args:10748 def foo = 42 -!!! test_endless_method_without_args:10412 +!!! test_endless_method_without_args:10756 def foo = 42 rescue nil -!!! test_endless_method_without_args:10423 +!!! test_endless_method_without_args:10767 def self.foo = 42 -!!! test_endless_method_without_args:10432 +!!! test_endless_method_without_args:10776 def self.foo = 42 rescue nil -!!! test_ensure:5261 +!!! test_ensure:5393 begin; meth; ensure; bar; end -!!! test_ensure_empty:5274 +!!! test_ensure_empty:5406 begin ensure end -!!! test_false:96 +!!! test_false:98 false -!!! test_float:129 +!!! test_find_pattern:10447 +case foo; in [*x, 1 => a, *y] then true; end +!!! test_find_pattern:10467 +case foo; in String(*, 1, *) then true; end +!!! test_find_pattern:10481 +case foo; in Array[*, 1, *] then true; end +!!! test_find_pattern:10495 +case foo; in *, 42, * then true; end +!!! test_float:131 1.33 -!!! test_float:134 +!!! test_float:136 -1.33 -!!! test_for:5002 +!!! test_for:5134 for a in foo do p a; end -!!! test_for:5014 +!!! test_for:5146 for a in foo; p a; end -!!! test_for_mlhs:5023 +!!! test_for_mlhs:5155 for a, b in foo; p a, b; end -!!! test_forward_arg:7899 +!!! test_forward_arg:8090 def foo(...); bar(...); end -!!! test_forward_arg_with_open_args:10745 +!!! test_forward_arg_with_open_args:11089 def foo ... end -!!! test_forward_arg_with_open_args:10752 +!!! test_forward_arg_with_open_args:11096 def foo a, b = 1, ... end -!!! test_forward_arg_with_open_args:10770 +!!! test_forward_arg_with_open_args:11114 def foo(a, ...) bar(...) end -!!! test_forward_arg_with_open_args:10781 +!!! test_forward_arg_with_open_args:11125 def foo a, ... bar(...) end -!!! test_forward_arg_with_open_args:10792 +!!! test_forward_arg_with_open_args:11136 def foo b = 1, ... bar(...) end -!!! test_forward_arg_with_open_args:10804 +!!! test_forward_arg_with_open_args:11148 def foo ...; bar(...); end -!!! test_forward_arg_with_open_args:10814 +!!! test_forward_arg_with_open_args:11158 def foo a, ...; bar(...); end -!!! test_forward_arg_with_open_args:10825 +!!! test_forward_arg_with_open_args:11169 def foo b = 1, ...; bar(...); end -!!! test_forward_arg_with_open_args:10837 +!!! test_forward_arg_with_open_args:11181 (def foo ... bar(...) end) -!!! test_forward_arg_with_open_args:10848 +!!! test_forward_arg_with_open_args:11192 (def foo ...; bar(...); end) -!!! test_forward_args_legacy:7863 +!!! test_forward_args_legacy:8054 def foo(...); bar(...); end -!!! test_forward_args_legacy:7875 +!!! test_forward_args_legacy:8066 def foo(...); super(...); end -!!! test_forward_args_legacy:7887 +!!! test_forward_args_legacy:8078 def foo(...); end -!!! test_forwarded_argument_with_kwrestarg:10962 +!!! test_forwarded_argument_with_kwrestarg:11332 def foo(argument, **); bar(argument, **); end -!!! test_forwarded_argument_with_restarg:10923 +!!! test_forwarded_argument_with_restarg:11267 def foo(argument, *); bar(argument, *); end -!!! test_forwarded_kwrestarg:10943 +!!! test_forwarded_kwrestarg:11287 def foo(**); bar(**); end -!!! test_forwarded_restarg:10905 +!!! test_forwarded_kwrestarg_with_additional_kwarg:11306 +def foo(**); bar(**, from_foo: true); end +!!! test_forwarded_restarg:11249 def foo(*); bar(*); end -!!! test_gvar:980 +!!! test_gvar:994 $foo -!!! test_gvasgn:1116 +!!! test_gvasgn:1130 $var = 10 -!!! test_hash_empty:750 +!!! test_hash_empty:764 { } -!!! test_hash_hashrocket:759 +!!! test_hash_hashrocket:773 { 1 => 2 } -!!! test_hash_hashrocket:768 +!!! test_hash_hashrocket:782 { 1 => 2, :foo => "bar" } -!!! test_hash_kwsplat:821 +!!! test_hash_kwsplat:835 { foo: 2, **bar } -!!! test_hash_label:776 +!!! test_hash_label:790 { foo: 2 } -!!! test_hash_label_end:789 +!!! test_hash_label_end:803 { 'foo': 2 } -!!! test_hash_label_end:802 +!!! test_hash_label_end:816 { 'foo': 2, 'bar': {}} -!!! test_hash_label_end:810 +!!! test_hash_label_end:824 f(a ? "a":1) -!!! test_hash_pair_value_omission:10040 +!!! test_hash_pair_value_omission:10339 {a:, b:} -!!! test_hash_pair_value_omission:10054 +!!! test_hash_pair_value_omission:10353 {puts:} -!!! test_hash_pair_value_omission:10065 +!!! test_hash_pair_value_omission:10364 +foo = 1; {foo:} +!!! test_hash_pair_value_omission:10376 +_foo = 1; {_foo:} +!!! test_hash_pair_value_omission:10388 {BAR:} -!!! test_heredoc:263 +!!! test_heredoc:265 <(**nil) {} -!!! test_kwoptarg:2124 +!!! test_kwoptarg:2138 def f(foo: 1); end -!!! test_kwrestarg_named:2135 +!!! test_kwoptarg_with_kwrestarg_and_forwarded_args:11482 +def f(a: nil, **); b(**) end +!!! test_kwrestarg_named:2149 def f(**foo); end -!!! test_kwrestarg_unnamed:2146 +!!! test_kwrestarg_unnamed:2160 def f(**); end -!!! test_lbrace_arg_after_command_args:7235 +!!! test_lbrace_arg_after_command_args:7420 let (:a) { m do; end } -!!! test_lparenarg_after_lvar__since_25:6679 +!!! test_lparenarg_after_lvar__since_25:6830 meth (-1.3).abs -!!! test_lparenarg_after_lvar__since_25:6688 +!!! test_lparenarg_after_lvar__since_25:6839 foo (-1.3).abs -!!! test_lvar:959 +!!! test_lvar:973 foo -!!! test_lvar_injecting_match:3778 +!!! test_lvar_injecting_match:3819 /(?bar)/ =~ 'bar'; match -!!! test_lvasgn:1084 +!!! test_lvasgn:1098 var = 10; var -!!! test_masgn:1247 +!!! test_marg_combinations:2454 +def f (((a))); end +!!! test_marg_combinations:2460 +def f ((a, a1)); end +!!! test_marg_combinations:2465 +def f ((a, *r)); end +!!! test_marg_combinations:2470 +def f ((a, *r, p)); end +!!! test_marg_combinations:2475 +def f ((a, *)); end +!!! test_marg_combinations:2480 +def f ((a, *, p)); end +!!! test_marg_combinations:2485 +def f ((*r)); end +!!! test_marg_combinations:2490 +def f ((*r, p)); end +!!! test_marg_combinations:2495 +def f ((*)); end +!!! test_marg_combinations:2500 +def f ((*, p)); end +!!! test_masgn:1261 foo, bar = 1, 2 -!!! test_masgn:1258 +!!! test_masgn:1272 (foo, bar) = 1, 2 -!!! test_masgn:1268 +!!! test_masgn:1282 foo, bar, baz = 1, 2 -!!! test_masgn_attr:1390 +!!! test_masgn_attr:1404 self.a, self[1, 2] = foo -!!! test_masgn_attr:1403 +!!! test_masgn_attr:1417 self::a, foo = foo -!!! test_masgn_attr:1411 +!!! test_masgn_attr:1425 self.A, foo = foo -!!! test_masgn_cmd:1439 +!!! test_masgn_cmd:1453 foo, bar = m foo -!!! test_masgn_const:1421 +!!! test_masgn_const:1435 self::A, foo = foo -!!! test_masgn_const:1429 +!!! test_masgn_const:1443 ::A, foo = foo -!!! test_masgn_nested:1365 -a, (b, c) = foo !!! test_masgn_nested:1379 +a, (b, c) = foo +!!! test_masgn_nested:1393 ((b, )) = foo -!!! test_masgn_splat:1279 +!!! test_masgn_splat:1293 @foo, @@bar = *foo -!!! test_masgn_splat:1288 +!!! test_masgn_splat:1302 a, b = *foo, bar -!!! test_masgn_splat:1296 +!!! test_masgn_splat:1310 a, *b = bar -!!! test_masgn_splat:1302 +!!! test_masgn_splat:1316 a, *b, c = bar -!!! test_masgn_splat:1313 +!!! test_masgn_splat:1327 a, * = bar -!!! test_masgn_splat:1319 +!!! test_masgn_splat:1333 a, *, c = bar -!!! test_masgn_splat:1330 +!!! test_masgn_splat:1344 *b = bar -!!! test_masgn_splat:1336 +!!! test_masgn_splat:1350 *b, c = bar -!!! test_masgn_splat:1346 +!!! test_masgn_splat:1360 * = bar -!!! test_masgn_splat:1352 +!!! test_masgn_splat:1366 *, c, d = bar -!!! test_method_definition_in_while_cond:6816 +!!! test_method_definition_in_while_cond:7001 while def foo; tap do end; end; break; end -!!! test_method_definition_in_while_cond:6828 +!!! test_method_definition_in_while_cond:7013 while def self.foo; tap do end; end; break; end -!!! test_method_definition_in_while_cond:6841 +!!! test_method_definition_in_while_cond:7026 while def foo a = tap do end; end; break; end -!!! test_method_definition_in_while_cond:6854 +!!! test_method_definition_in_while_cond:7039 while def self.foo a = tap do end; end; break; end -!!! test_module:1789 +!!! test_module:1803 module Foo; end -!!! test_multiple_pattern_matches:11086 +!!! test_multiple_args_with_trailing_comma:2786 +f{ |a, b,| } +!!! test_multiple_pattern_matches:11456 {a: 0} => a: {a: 0} => a: -!!! test_multiple_pattern_matches:11102 +!!! test_multiple_pattern_matches:11472 {a: 0} in a: {a: 0} in a: -!!! test_newline_in_hash_argument:11035 +!!! test_newline_in_hash_argument:11405 obj.set foo: 1 -!!! test_newline_in_hash_argument:11046 +!!! test_newline_in_hash_argument:11416 obj.set "foo": 1 -!!! test_newline_in_hash_argument:11057 +!!! test_newline_in_hash_argument:11427 case foo in a: 0 @@ -1240,585 +983,870 @@ in "b": 0 true end -!!! test_next:5131 +!!! test_next:5263 next(foo) -!!! test_next:5145 +!!! test_next:5277 next foo -!!! test_next:5151 +!!! test_next:5283 next() -!!! test_next:5158 +!!! test_next:5290 next -!!! test_next_block:5166 +!!! test_next_block:5298 next fun foo do end -!!! test_nil:66 +!!! test_nil:68 nil -!!! test_nil_expression:73 +!!! test_nil_expression:75 () -!!! test_nil_expression:80 +!!! test_nil_expression:82 begin end -!!! test_non_lvar_injecting_match:3793 +!!! test_non_lvar_injecting_match:3853 /#{1}(?bar)/ =~ 'bar' -!!! test_not:3462 +!!! test_not:3476 not foo -!!! test_not:3468 +!!! test_not:3482 not(foo) -!!! test_not:3474 +!!! test_not:3488 not() -!!! test_not_cmd:3488 +!!! test_not_cmd:3502 not m foo -!!! test_not_masgn__24:4672 +!!! test_not_masgn__24:4732 !(a, b = foo) -!!! test_nth_ref:1002 +!!! test_nth_ref:1016 $10 -!!! test_numbered_args_after_27:7358 +!!! test_numbered_args_after_27:7543 m { _1 + _9 } -!!! test_numbered_args_after_27:7373 +!!! test_numbered_args_after_27:7558 m do _1 + _9 end -!!! test_numbered_args_after_27:7390 +!!! test_numbered_args_after_27:7575 -> { _1 + _9} -!!! test_numbered_args_after_27:7405 +!!! test_numbered_args_after_27:7590 -> do _1 + _9 end -!!! test_numparam_outside_block:7512 +!!! test_numparam_outside_block:7697 class A; _1; end -!!! test_numparam_outside_block:7520 +!!! test_numparam_outside_block:7705 module A; _1; end -!!! test_numparam_outside_block:7528 +!!! test_numparam_outside_block:7713 class << foo; _1; end -!!! test_numparam_outside_block:7536 +!!! test_numparam_outside_block:7721 def self.m; _1; end -!!! test_numparam_outside_block:7545 +!!! test_numparam_outside_block:7730 _1 -!!! test_op_asgn:1606 +!!! test_numparam_ruby_bug_19025:10696 +p { [_1 **2] } +!!! test_op_asgn:1620 foo.a += 1 -!!! test_op_asgn:1616 +!!! test_op_asgn:1630 foo::a += 1 -!!! test_op_asgn:1622 +!!! test_op_asgn:1636 foo.A += 1 -!!! test_op_asgn_cmd:1630 +!!! test_op_asgn_cmd:1644 foo.a += m foo -!!! test_op_asgn_cmd:1636 +!!! test_op_asgn_cmd:1650 foo::a += m foo -!!! test_op_asgn_cmd:1642 +!!! test_op_asgn_cmd:1656 foo.A += m foo -!!! test_op_asgn_cmd:1654 +!!! test_op_asgn_cmd:1668 foo::A += m foo -!!! test_op_asgn_index:1664 +!!! test_op_asgn_index:1678 foo[0, 1] += 2 -!!! test_op_asgn_index_cmd:1678 +!!! test_op_asgn_index_cmd:1692 foo[0, 1] += m foo -!!! test_optarg:2074 +!!! test_optarg:2088 def f foo = 1; end -!!! test_optarg:2084 +!!! test_optarg:2098 def f(foo=1, bar=2); end -!!! test_or:4461 +!!! test_or:4521 foo or bar -!!! test_or:4467 +!!! test_or:4527 foo || bar -!!! test_or_asgn:1724 +!!! test_or_asgn:1738 foo.a ||= 1 -!!! test_or_asgn:1734 +!!! test_or_asgn:1748 foo[0, 1] ||= 2 -!!! test_parser_bug_272:6528 +!!! test_parser_bug_272:6679 a @b do |c|;end -!!! test_parser_bug_490:7151 +!!! test_parser_bug_490:7336 def m; class << self; class C; end; end; end -!!! test_parser_bug_490:7162 +!!! test_parser_bug_490:7347 def m; class << self; module M; end; end; end -!!! test_parser_bug_490:7173 +!!! test_parser_bug_490:7358 def m; class << self; A = nil; end; end -!!! test_parser_bug_507:7265 +!!! test_parser_bug_507:7450 m = -> *args do end -!!! test_parser_bug_518:7277 +!!! test_parser_bug_518:7462 class A < B end -!!! test_parser_bug_525:7287 +!!! test_parser_bug_525:7472 m1 :k => m2 do; m3() do end; end -!!! test_parser_bug_604:7737 +!!! test_parser_bug_604:7928 m a + b do end -!!! test_parser_bug_640:443 +!!! test_parser_bug_640:445 <<~FOO baz\ qux FOO -!!! test_parser_bug_645:9774 +!!! test_parser_bug_645:10073 -> (arg={}) {} -!!! test_parser_bug_830:10630 +!!! test_parser_bug_830:10974 /\(/ -!!! test_parser_drops_truncated_parts_of_squiggly_heredoc:10446 +!!! test_parser_bug_989:11684 + <<-HERE + content + HERE +!!! test_parser_drops_truncated_parts_of_squiggly_heredoc:10790 <<~HERE #{} HERE -!!! test_pattern_matching__FILE__LINE_literals:9473 +!!! test_parser_slash_slash_n_escaping_in_literals:7512:0 +'a\ +b' +!!! test_parser_slash_slash_n_escaping_in_literals:7512:1 +<<-'HERE' +a\ +b +HERE +!!! test_parser_slash_slash_n_escaping_in_literals:7512:2 +%q{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:3 +"a\ +b" +!!! test_parser_slash_slash_n_escaping_in_literals:7512:4 +<<-"HERE" +a\ +b +HERE +!!! test_parser_slash_slash_n_escaping_in_literals:7512:5 +%{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:6 +%Q{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:7 +%w{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:8 +%W{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:9 +%i{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:10 +%I{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:11 +:'a\ +b' +!!! test_parser_slash_slash_n_escaping_in_literals:7512:12 +%s{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:13 +:"a\ +b" +!!! test_parser_slash_slash_n_escaping_in_literals:7512:14 +/a\ +b/ +!!! test_parser_slash_slash_n_escaping_in_literals:7512:15 +%r{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:16 +%x{a\ +b} +!!! test_parser_slash_slash_n_escaping_in_literals:7512:17 +`a\ +b` +!!! test_parser_slash_slash_n_escaping_in_literals:7512:18 +<<-`HERE` +a\ +b +HERE +!!! test_pattern_matching__FILE__LINE_literals:9760 case [__FILE__, __LINE__ + 1, __ENCODING__] in [__FILE__, __LINE__, __ENCODING__] end -!!! test_pattern_matching_blank_else:9390 +!!! test_pattern_matching_blank_else:9627 case 1; in 2; 3; else; end -!!! test_pattern_matching_else:9376 +!!! test_pattern_matching_const_pattern:9490 +case foo; in A(1, 2) then true; end +!!! test_pattern_matching_const_pattern:9507 +case foo; in A(x:) then true; end +!!! test_pattern_matching_const_pattern:9523 +case foo; in A() then true; end +!!! test_pattern_matching_const_pattern:9538 +case foo; in A[1, 2] then true; end +!!! test_pattern_matching_const_pattern:9555 +case foo; in A[x:] then true; end +!!! test_pattern_matching_const_pattern:9571 +case foo; in A[] then true; end +!!! test_pattern_matching_constants:9456 +case foo; in A then true; end +!!! test_pattern_matching_constants:9466 +case foo; in A::B then true; end +!!! test_pattern_matching_constants:9477 +case foo; in ::A then true; end +!!! test_pattern_matching_else:9613 case 1; in 2; 3; else; 4; end -!!! test_pattern_matching_single_line:9540 +!!! test_pattern_matching_explicit_array_match:8891 +case foo; in [x] then nil; end +!!! test_pattern_matching_explicit_array_match:8903 +case foo; in [x,] then nil; end +!!! test_pattern_matching_explicit_array_match:8915 +case foo; in [x, y] then true; end +!!! test_pattern_matching_explicit_array_match:8928 +case foo; in [x, y,] then true; end +!!! test_pattern_matching_explicit_array_match:8941 +case foo; in [x, y, *] then true; end +!!! test_pattern_matching_explicit_array_match:8955 +case foo; in [x, y, *z] then true; end +!!! test_pattern_matching_explicit_array_match:8969 +case foo; in [x, *y, z] then true; end +!!! test_pattern_matching_explicit_array_match:8983 +case foo; in [x, *, y] then true; end +!!! test_pattern_matching_explicit_array_match:8997 +case foo; in [*x, y] then true; end +!!! test_pattern_matching_explicit_array_match:9010 +case foo; in [*, x] then true; end +!!! test_pattern_matching_expr_in_paren:9443 +case foo; in (1) then true; end +!!! test_pattern_matching_hash:9025 +case foo; in {} then true; end +!!! test_pattern_matching_hash:9034 +case foo; in a: 1 then true; end +!!! test_pattern_matching_hash:9044 +case foo; in { a: 1 } then true; end +!!! test_pattern_matching_hash:9056 +case foo; in { a: 1, } then true; end +!!! test_pattern_matching_hash:9068 +case foo; in a: then true; end +!!! test_pattern_matching_hash:9080 +case foo; in **a then true; end +!!! test_pattern_matching_hash:9094 +case foo; in ** then true; end +!!! test_pattern_matching_hash:9106 +case foo; in a: 1, b: 2 then true; end +!!! test_pattern_matching_hash:9117 +case foo; in a:, b: then true; end +!!! test_pattern_matching_hash:9128 +case foo; in a: 1, _a:, ** then true; end +!!! test_pattern_matching_hash:9140 +case foo; + in {a: 1 + } + false + ; end +!!! test_pattern_matching_hash:9156 +case foo; + in {a: + 2} + false + ; end +!!! test_pattern_matching_hash:9171 +case foo; + in {Foo: 42 + } + false + ; end +!!! test_pattern_matching_hash:9186 +case foo; + in a: {b:}, c: + p c + ; end +!!! test_pattern_matching_hash:9203 +case foo; + in {a: + } + true + ; end +!!! test_pattern_matching_hash_with_string_keys:9242 +case foo; in "a": then true; end +!!! test_pattern_matching_hash_with_string_keys:9253 +case foo; in "#{ 'a' }": then true; end +!!! test_pattern_matching_hash_with_string_keys:9264 +case foo; in "#{ %q{a} }": then true; end +!!! test_pattern_matching_hash_with_string_keys:9275 +case foo; in "#{ %Q{a} }": then true; end +!!! test_pattern_matching_hash_with_string_keys:9288 +case foo; in "a": 1 then true; end +!!! test_pattern_matching_hash_with_string_keys:9297 +case foo; in "#{ 'a' }": 1 then true; end +!!! test_pattern_matching_hash_with_string_keys:9308 +case foo; in "#{ %q{a} }": 1 then true; end +!!! test_pattern_matching_hash_with_string_keys:9319 +case foo; in "#{ %Q{a} }": 1 then true; end +!!! test_pattern_matching_if_unless_modifiers:8753 +case foo; in x if true; nil; end +!!! test_pattern_matching_if_unless_modifiers:8767 +case foo; in x unless true; nil; end +!!! test_pattern_matching_implicit_array_match:8796 +case foo; in x, then nil; end +!!! test_pattern_matching_implicit_array_match:8806 +case foo; in *x then nil; end +!!! test_pattern_matching_implicit_array_match:8819 +case foo; in * then nil; end +!!! test_pattern_matching_implicit_array_match:8830 +case foo; in x, y then nil; end +!!! test_pattern_matching_implicit_array_match:8841 +case foo; in x, y, then nil; end +!!! test_pattern_matching_implicit_array_match:8852 +case foo; in x, *y, z then nil; end +!!! test_pattern_matching_implicit_array_match:8864 +case foo; in *x, y, z then nil; end +!!! test_pattern_matching_implicit_array_match:8876 +case foo; in 1, "a", [], {} then nil; end +!!! test_pattern_matching_keyword_variable:9370 +case foo; in self then true; end +!!! test_pattern_matching_lambda:9380 +case foo; in ->{ 42 } then true; end +!!! test_pattern_matching_match_alt:9587 +case foo; in 1 | 2 then true; end +!!! test_pattern_matching_match_as:9599 +case foo; in 1 => a then true; end +!!! test_pattern_matching_nil_pattern:9783 +case foo; in **nil then true; end +!!! test_pattern_matching_no_body:8745 +case foo; in 1; end +!!! test_pattern_matching_numbered_parameter:9654 +1.then { 1 in ^_1 } +!!! test_pattern_matching_pin_variable:8783 +case foo; in ^foo then nil; end +!!! test_pattern_matching_ranges:9393 +case foo; in 1..2 then true; end +!!! test_pattern_matching_ranges:9401 +case foo; in 1.. then true; end +!!! test_pattern_matching_ranges:9409 +case foo; in ..2 then true; end +!!! test_pattern_matching_ranges:9417 +case foo; in 1...2 then true; end +!!! test_pattern_matching_ranges:9425 +case foo; in 1... then true; end +!!! test_pattern_matching_ranges:9433 +case foo; in ...2 then true; end +!!! test_pattern_matching_single_line:9827 1 => [a]; a -!!! test_pattern_matching_single_line:9552 +!!! test_pattern_matching_single_line:9839 1 in [a]; a -!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9566 +!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9853 [1, 2] => a, b; a -!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9581 +!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9868 {a: 1} => a:; a -!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9596 +!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9883 [1, 2] in a, b; a -!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9611 +!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9898 {a: 1} in a:; a -!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9626 +!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9913 {key: :value} in key: value; value -!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9643 +!!! test_pattern_matching_single_line_allowed_omission_of_parentheses:9930 {key: :value} => key: value; value -!!! test_postexe:5486 +!!! test_pattern_matching_single_match:8730 +case foo; in x then x; end +!!! test_pin_expr:10800 +case foo; in ^(42) then nil; end +!!! test_pin_expr:10814 +case foo; in { foo: ^(42) } then nil; end +!!! test_pin_expr:10831 +case foo; in ^(0+0) then nil; end +!!! test_pin_expr:10847 +case foo; in ^@a; end +!!! test_pin_expr:10856 +case foo; in ^@@TestPatternMatching; end +!!! test_pin_expr:10865 +case foo; in ^$TestPatternMatching; end +!!! test_pin_expr:10874 +case foo; in ^(1 +); end +!!! test_postexe:5618 END { 1 } -!!! test_preexe:5467 +!!! test_preexe:5599 BEGIN { 1 } -!!! test_procarg0:2803 +!!! test_procarg0:2817 m { |foo| } -!!! test_procarg0:2812 +!!! test_procarg0:2826 m { |(foo, bar)| } -!!! test_range_endless:869 +!!! test_procarg0_legacy:2796 +f{ |a| } +!!! test_range_endless:883 1.. -!!! test_range_endless:877 +!!! test_range_endless:891 1... -!!! test_range_exclusive:861 +!!! test_range_exclusive:875 1...2 -!!! test_range_inclusive:853 +!!! test_range_inclusive:867 1..2 -!!! test_rational:142 +!!! test_rational:144 42r -!!! test_rational:148 +!!! test_rational:150 42.1r -!!! test_redo:5178 +!!! test_redo:5310 redo -!!! test_regex_interp:551 +!!! test_regex_interp:553 /foo#{bar}baz/ -!!! test_regex_plain:541 +!!! test_regex_plain:543 /source/im -!!! test_resbody_list:5398 +!!! test_resbody_list:5530 begin; meth; rescue Exception; bar; end -!!! test_resbody_list_mrhs:5411 +!!! test_resbody_list_mrhs:5543 begin; meth; rescue Exception, foo; bar; end -!!! test_resbody_list_var:5444 +!!! test_resbody_list_var:5576 begin; meth; rescue foo => ex; bar; end -!!! test_resbody_var:5426 +!!! test_resbody_var:5558 begin; meth; rescue => ex; bar; end -!!! test_resbody_var:5434 +!!! test_resbody_var:5566 begin; meth; rescue => @ex; bar; end -!!! test_rescue:5188 +!!! test_rescue:5320 begin; meth; rescue; foo; end -!!! test_rescue_else:5203 +!!! test_rescue_else:5335 begin; meth; rescue; foo; else; bar; end -!!! test_rescue_else_ensure:5302 +!!! test_rescue_else_ensure:5434 begin; meth; rescue; baz; else foo; ensure; bar end -!!! test_rescue_ensure:5286 +!!! test_rescue_ensure:5418 begin; meth; rescue; baz; ensure; bar; end -!!! test_rescue_in_lambda_block:6928 +!!! test_rescue_in_lambda_block:7113 -> do rescue; end -!!! test_rescue_mod:5319 +!!! test_rescue_mod:5451 meth rescue bar -!!! test_rescue_mod_asgn:5331 +!!! test_rescue_mod_asgn:5463 foo = meth rescue bar -!!! test_rescue_mod_masgn:5345 +!!! test_rescue_mod_masgn:5477 foo, bar = meth rescue [1, 2] -!!! test_rescue_mod_op_assign:5365 +!!! test_rescue_mod_op_assign:5497 foo += meth rescue bar -!!! test_rescue_without_begin_end:5381 +!!! test_rescue_without_begin_end:5513 meth do; foo; rescue; bar; end -!!! test_restarg_named:2094 +!!! test_restarg_named:2108 def f(*foo); end -!!! test_restarg_unnamed:2104 +!!! test_restarg_unnamed:2118 def f(*); end -!!! test_retry:5457 +!!! test_retry:5589 retry -!!! test_return:5084 +!!! test_return:5216 return(foo) -!!! test_return:5098 +!!! test_return:5230 return foo -!!! test_return:5104 +!!! test_return:5236 return() -!!! test_return:5111 +!!! test_return:5243 return -!!! test_return_block:5119 +!!! test_return_block:5251 return fun foo do end -!!! test_ruby_bug_10279:5905 +!!! test_ruby_bug_10279:6056 {a: if true then 42 end} -!!! test_ruby_bug_10653:5915 +!!! test_ruby_bug_10653:6066 true ? 1.tap do |n| p n end : 0 -!!! test_ruby_bug_10653:5945 +!!! test_ruby_bug_10653:6096 false ? raise {} : tap {} -!!! test_ruby_bug_10653:5958 +!!! test_ruby_bug_10653:6109 false ? raise do end : tap do end -!!! test_ruby_bug_11107:5973 +!!! test_ruby_bug_11107:6124 p ->() do a() do end end -!!! test_ruby_bug_11380:5985 +!!! test_ruby_bug_11380:6136 p -> { :hello }, a: 1 do end -!!! test_ruby_bug_11873:6353 +!!! test_ruby_bug_11873:6504 a b{c d}, "x" do end -!!! test_ruby_bug_11873:6367 +!!! test_ruby_bug_11873:6518 a b(c d), "x" do end -!!! test_ruby_bug_11873:6380 +!!! test_ruby_bug_11873:6531 a b{c(d)}, "x" do end -!!! test_ruby_bug_11873:6394 +!!! test_ruby_bug_11873:6545 a b(c(d)), "x" do end -!!! test_ruby_bug_11873:6407 +!!! test_ruby_bug_11873:6558 a b{c d}, /x/ do end -!!! test_ruby_bug_11873:6421 +!!! test_ruby_bug_11873:6572 a b(c d), /x/ do end -!!! test_ruby_bug_11873:6434 +!!! test_ruby_bug_11873:6585 a b{c(d)}, /x/ do end -!!! test_ruby_bug_11873:6448 +!!! test_ruby_bug_11873:6599 a b(c(d)), /x/ do end -!!! test_ruby_bug_11873:6461 +!!! test_ruby_bug_11873:6612 a b{c d}, /x/m do end -!!! test_ruby_bug_11873:6475 +!!! test_ruby_bug_11873:6626 a b(c d), /x/m do end -!!! test_ruby_bug_11873:6488 +!!! test_ruby_bug_11873:6639 a b{c(d)}, /x/m do end -!!! test_ruby_bug_11873:6502 +!!! test_ruby_bug_11873:6653 a b(c(d)), /x/m do end -!!! test_ruby_bug_11873_b:6050 +!!! test_ruby_bug_11873_a:6168:0 +a b{c d}, :e do end +!!! test_ruby_bug_11873_a:6168:1 +a b{c d}, 1 do end +!!! test_ruby_bug_11873_a:6168:2 +a b{c d}, 1.0 do end +!!! test_ruby_bug_11873_a:6168:3 +a b{c d}, 1.0r do end +!!! test_ruby_bug_11873_a:6168:4 +a b{c d}, 1.0i do end +!!! test_ruby_bug_11873_a:6173:0 +a b{c(d)}, :e do end +!!! test_ruby_bug_11873_a:6173:1 +a b{c(d)}, 1 do end +!!! test_ruby_bug_11873_a:6173:2 +a b{c(d)}, 1.0 do end +!!! test_ruby_bug_11873_a:6173:3 +a b{c(d)}, 1.0r do end +!!! test_ruby_bug_11873_a:6173:4 +a b{c(d)}, 1.0i do end +!!! test_ruby_bug_11873_a:6187:0 +a b(c d), :e do end +!!! test_ruby_bug_11873_a:6187:1 +a b(c d), 1 do end +!!! test_ruby_bug_11873_a:6187:2 +a b(c d), 1.0 do end +!!! test_ruby_bug_11873_a:6187:3 +a b(c d), 1.0r do end +!!! test_ruby_bug_11873_a:6187:4 +a b(c d), 1.0i do end +!!! test_ruby_bug_11873_a:6192:0 +a b(c(d)), :e do end +!!! test_ruby_bug_11873_a:6192:1 +a b(c(d)), 1 do end +!!! test_ruby_bug_11873_a:6192:2 +a b(c(d)), 1.0 do end +!!! test_ruby_bug_11873_a:6192:3 +a b(c(d)), 1.0r do end +!!! test_ruby_bug_11873_a:6192:4 +a b(c(d)), 1.0i do end +!!! test_ruby_bug_11873_b:6201 p p{p(p);p p}, tap do end -!!! test_ruby_bug_11989:6069 +!!! test_ruby_bug_11989:6220 p <<~"E" x\n y E -!!! test_ruby_bug_11990:6078 +!!! test_ruby_bug_11990:6229 p <<~E " y" x E -!!! test_ruby_bug_12073:6089 +!!! test_ruby_bug_12073:6240 a = 1; a b: 1 -!!! test_ruby_bug_12073:6102 +!!! test_ruby_bug_12073:6253 def foo raise; raise A::B, ''; end -!!! test_ruby_bug_12402:6116 +!!! test_ruby_bug_12402:6267 foo = raise(bar) rescue nil -!!! test_ruby_bug_12402:6127 +!!! test_ruby_bug_12402:6278 foo += raise(bar) rescue nil -!!! test_ruby_bug_12402:6139 +!!! test_ruby_bug_12402:6290 foo[0] += raise(bar) rescue nil -!!! test_ruby_bug_12402:6153 +!!! test_ruby_bug_12402:6304 foo.m += raise(bar) rescue nil -!!! test_ruby_bug_12402:6166 +!!! test_ruby_bug_12402:6317 foo::m += raise(bar) rescue nil -!!! test_ruby_bug_12402:6179 +!!! test_ruby_bug_12402:6330 foo.C += raise(bar) rescue nil -!!! test_ruby_bug_12402:6192 +!!! test_ruby_bug_12402:6343 foo::C ||= raise(bar) rescue nil -!!! test_ruby_bug_12402:6205 +!!! test_ruby_bug_12402:6356 foo = raise bar rescue nil -!!! test_ruby_bug_12402:6216 +!!! test_ruby_bug_12402:6367 foo += raise bar rescue nil -!!! test_ruby_bug_12402:6228 +!!! test_ruby_bug_12402:6379 foo[0] += raise bar rescue nil -!!! test_ruby_bug_12402:6242 +!!! test_ruby_bug_12402:6393 foo.m += raise bar rescue nil -!!! test_ruby_bug_12402:6255 +!!! test_ruby_bug_12402:6406 foo::m += raise bar rescue nil -!!! test_ruby_bug_12402:6268 +!!! test_ruby_bug_12402:6419 foo.C += raise bar rescue nil -!!! test_ruby_bug_12402:6281 +!!! test_ruby_bug_12402:6432 foo::C ||= raise bar rescue nil -!!! test_ruby_bug_12669:6296 +!!! test_ruby_bug_12669:6447 a = b = raise :x -!!! test_ruby_bug_12669:6305 +!!! test_ruby_bug_12669:6456 a += b = raise :x -!!! test_ruby_bug_12669:6314 +!!! test_ruby_bug_12669:6465 a = b += raise :x -!!! test_ruby_bug_12669:6323 +!!! test_ruby_bug_12669:6474 a += b += raise :x -!!! test_ruby_bug_12686:6334 +!!! test_ruby_bug_12686:6485 f (g rescue nil) -!!! test_ruby_bug_13547:7018 +!!! test_ruby_bug_13547:7203 meth[] {} -!!! test_ruby_bug_14690:7250 +!!! test_ruby_bug_14690:7435 let () { m(a) do; end } -!!! test_ruby_bug_15789:7622 +!!! test_ruby_bug_15789:7807 m ->(a = ->{_1}) {a} -!!! test_ruby_bug_15789:7636 +!!! test_ruby_bug_15789:7821 m ->(a: ->{_1}) {a} -!!! test_ruby_bug_9669:5889 +!!! test_ruby_bug_9669:6040 def a b: return end -!!! test_ruby_bug_9669:5895 +!!! test_ruby_bug_9669:6046 o = { a: 1 } -!!! test_sclass:1884 +!!! test_sclass:1898 class << foo; nil; end -!!! test_self:952 +!!! test_self:966 self -!!! test_send_attr_asgn:3528 +!!! test_send_attr_asgn:3542 foo.a = 1 -!!! test_send_attr_asgn:3536 +!!! test_send_attr_asgn:3550 foo::a = 1 -!!! test_send_attr_asgn:3544 +!!! test_send_attr_asgn:3558 foo.A = 1 -!!! test_send_attr_asgn:3552 +!!! test_send_attr_asgn:3566 foo::A = 1 -!!! test_send_attr_asgn_conditional:3751 +!!! test_send_attr_asgn_conditional:3792 a&.b = 1 -!!! test_send_binary_op:3308 +!!! test_send_binary_op:3322 foo + 1 -!!! test_send_binary_op:3314 +!!! test_send_binary_op:3328 foo - 1 -!!! test_send_binary_op:3318 +!!! test_send_binary_op:3332 foo * 1 -!!! test_send_binary_op:3322 +!!! test_send_binary_op:3336 foo / 1 -!!! test_send_binary_op:3326 +!!! test_send_binary_op:3340 foo % 1 -!!! test_send_binary_op:3330 +!!! test_send_binary_op:3344 foo ** 1 -!!! test_send_binary_op:3334 +!!! test_send_binary_op:3348 foo | 1 -!!! test_send_binary_op:3338 +!!! test_send_binary_op:3352 foo ^ 1 -!!! test_send_binary_op:3342 +!!! test_send_binary_op:3356 foo & 1 -!!! test_send_binary_op:3346 +!!! test_send_binary_op:3360 foo <=> 1 -!!! test_send_binary_op:3350 +!!! test_send_binary_op:3364 foo < 1 -!!! test_send_binary_op:3354 +!!! test_send_binary_op:3368 foo <= 1 -!!! test_send_binary_op:3358 +!!! test_send_binary_op:3372 foo > 1 -!!! test_send_binary_op:3362 +!!! test_send_binary_op:3376 foo >= 1 -!!! test_send_binary_op:3366 +!!! test_send_binary_op:3380 foo == 1 -!!! test_send_binary_op:3376 +!!! test_send_binary_op:3390 foo != 1 -!!! test_send_binary_op:3382 +!!! test_send_binary_op:3396 foo === 1 -!!! test_send_binary_op:3386 +!!! test_send_binary_op:3400 foo =~ 1 -!!! test_send_binary_op:3396 +!!! test_send_binary_op:3410 foo !~ 1 -!!! test_send_binary_op:3402 +!!! test_send_binary_op:3416 foo << 1 -!!! test_send_binary_op:3406 +!!! test_send_binary_op:3420 foo >> 1 -!!! test_send_block_chain_cmd:3201 +!!! test_send_block_chain_cmd:3215 meth 1 do end.fun bar -!!! test_send_block_chain_cmd:3212 +!!! test_send_block_chain_cmd:3226 meth 1 do end.fun(bar) -!!! test_send_block_chain_cmd:3225 +!!! test_send_block_chain_cmd:3239 meth 1 do end::fun bar -!!! test_send_block_chain_cmd:3236 +!!! test_send_block_chain_cmd:3250 meth 1 do end::fun(bar) -!!! test_send_block_chain_cmd:3249 +!!! test_send_block_chain_cmd:3263 meth 1 do end.fun bar do end -!!! test_send_block_chain_cmd:3261 +!!! test_send_block_chain_cmd:3275 meth 1 do end.fun(bar) {} -!!! test_send_block_chain_cmd:3273 +!!! test_send_block_chain_cmd:3287 meth 1 do end.fun {} -!!! test_send_block_conditional:3759 +!!! test_send_block_conditional:3800 foo&.bar {} -!!! test_send_call:3721 +!!! test_send_call:3762 foo.(1) -!!! test_send_call:3731 +!!! test_send_call:3772 foo::(1) -!!! test_send_conditional:3743 +!!! test_send_conditional:3784 a&.b -!!! test_send_index:3562 +!!! test_send_index:3576 foo[1, 2] -!!! test_send_index_asgn:3591 +!!! test_send_index_asgn:3605 foo[1, 2] = 3 -!!! test_send_index_asgn_legacy:3603 +!!! test_send_index_asgn_kwarg:3629 +foo[:kw => arg] = 3 +!!! test_send_index_asgn_kwarg_legacy:3642 +foo[:kw => arg] = 3 +!!! test_send_index_asgn_legacy:3617 foo[1, 2] = 3 -!!! test_send_index_cmd:3584 +!!! test_send_index_cmd:3598 foo[m bar] -!!! test_send_index_legacy:3573 +!!! test_send_index_legacy:3587 foo[1, 2] -!!! test_send_lambda:3615 +!!! test_send_lambda:3656 ->{ } -!!! test_send_lambda:3625 +!!! test_send_lambda:3666 -> * { } -!!! test_send_lambda:3636 +!!! test_send_lambda:3677 -> do end -!!! test_send_lambda_args:3648 +!!! test_send_lambda_args:3689 ->(a) { } -!!! test_send_lambda_args:3662 +!!! test_send_lambda_args:3703 -> (a) { } -!!! test_send_lambda_args_noparen:3686 +!!! test_send_lambda_args_noparen:3727 -> a: 1 { } -!!! test_send_lambda_args_noparen:3695 +!!! test_send_lambda_args_noparen:3736 -> a: { } -!!! test_send_lambda_args_shadow:3673 +!!! test_send_lambda_args_shadow:3714 ->(a; foo, bar) { } -!!! test_send_lambda_legacy:3707 +!!! test_send_lambda_legacy:3748 ->{ } -!!! test_send_op_asgn_conditional:3770 +!!! test_send_op_asgn_conditional:3811 a&.b &&= 1 -!!! test_send_plain:3105 +!!! test_send_plain:3119 foo.fun -!!! test_send_plain:3112 +!!! test_send_plain:3126 foo::fun -!!! test_send_plain:3119 +!!! test_send_plain:3133 foo::Fun() -!!! test_send_plain_cmd:3128 +!!! test_send_plain_cmd:3142 foo.fun bar -!!! test_send_plain_cmd:3135 +!!! test_send_plain_cmd:3149 foo::fun bar -!!! test_send_plain_cmd:3142 +!!! test_send_plain_cmd:3156 foo::Fun bar -!!! test_send_self:3044 +!!! test_send_self:3058 fun -!!! test_send_self:3050 +!!! test_send_self:3064 fun! -!!! test_send_self:3056 +!!! test_send_self:3070 fun(1) -!!! test_send_self_block:3066 +!!! test_send_self_block:3080 fun { } -!!! test_send_self_block:3070 +!!! test_send_self_block:3084 fun() { } -!!! test_send_self_block:3074 +!!! test_send_self_block:3088 fun(1) { } -!!! test_send_self_block:3078 +!!! test_send_self_block:3092 fun do end -!!! test_send_unary_op:3412 +!!! test_send_unary_op:3426 -foo -!!! test_send_unary_op:3418 +!!! test_send_unary_op:3432 +foo -!!! test_send_unary_op:3422 +!!! test_send_unary_op:3436 ~foo -!!! test_slash_newline_in_heredocs:7186 +!!! test_slash_newline_in_heredocs:7371 <<~E 1 \ 2 3 E -!!! test_slash_newline_in_heredocs:7194 +!!! test_slash_newline_in_heredocs:7379 <<-E 1 \ 2 3 E -!!! test_space_args_arg:4132 +!!! test_space_args_arg:4192 fun (1) -!!! test_space_args_arg_block:4146 +!!! test_space_args_arg_block:4206 fun (1) {} -!!! test_space_args_arg_block:4160 +!!! test_space_args_arg_block:4220 foo.fun (1) {} -!!! test_space_args_arg_block:4176 +!!! test_space_args_arg_block:4236 foo::fun (1) {} -!!! test_space_args_arg_call:4198 +!!! test_space_args_arg_call:4258 fun (1).to_i -!!! test_space_args_arg_newline:4138 +!!! test_space_args_arg_newline:4198 fun (1 ) -!!! test_space_args_block:4430 +!!! test_space_args_block:4490 fun () {} -!!! test_space_args_cmd:4125 +!!! test_space_args_cmd:4185 fun (f bar) -!!! test_string___FILE__:241 +!!! test_string___FILE__:243 __FILE__ -!!! test_string_concat:226 +!!! test_string_concat:228 "foo#@a" "bar" -!!! test_string_dvar:215 +!!! test_string_dvar:217 "#@a #@@a #$a" -!!! test_string_interp:200 +!!! test_string_interp:202 "foo#{bar}baz" -!!! test_string_plain:184 +!!! test_string_plain:186 'foobar' -!!! test_string_plain:191 +!!! test_string_plain:193 %q(foobar) -!!! test_super:3807 +!!! test_super:3867 super(foo) -!!! test_super:3815 +!!! test_super:3875 super foo -!!! test_super:3821 +!!! test_super:3881 super() -!!! test_super_block:3839 +!!! test_super_block:3899 super foo, bar do end -!!! test_super_block:3845 +!!! test_super_block:3905 super do end -!!! test_symbol_interp:484 +!!! test_symbol_interp:486 :"foo#{bar}baz" -!!! test_symbol_plain:469 +!!! test_symbol_plain:471 :foo -!!! test_symbol_plain:475 +!!! test_symbol_plain:477 :'foo' -!!! test_ternary:4605 +!!! test_ternary:4665 foo ? 1 : 2 -!!! test_ternary_ambiguous_symbol:4614 +!!! test_ternary_ambiguous_symbol:4674 t=1;(foo)?t:T -!!! test_trailing_forward_arg:8022 +!!! test_trailing_forward_arg:8237 def foo(a, b, ...); bar(a, 42, ...); end -!!! test_true:89 +!!! test_true:91 true -!!! test_unary_num_pow_precedence:3505 +!!! test_unary_num_pow_precedence:3519 +2.0 ** 10 -!!! test_unary_num_pow_precedence:3512 +!!! test_unary_num_pow_precedence:3526 -2 ** 10 -!!! test_unary_num_pow_precedence:3519 +!!! test_unary_num_pow_precedence:3533 -2.0 ** 10 -!!! test_undef:2003 +!!! test_undef:2017 undef foo, :bar, :"foo#{1}" -!!! test_unless:4529 +!!! test_unless:4589 unless foo then bar; end -!!! test_unless:4537 +!!! test_unless:4597 unless foo; bar; end -!!! test_unless_else:4573 +!!! test_unless_else:4633 unless foo then bar; else baz; end -!!! test_unless_else:4582 +!!! test_unless_else:4642 unless foo; bar; else baz; end -!!! test_unless_mod:4546 +!!! test_unless_mod:4606 bar unless foo -!!! test_until:4948 +!!! test_until:5080 until foo do meth end -!!! test_until:4955 +!!! test_until:5087 until foo; meth end -!!! test_until_mod:4963 +!!! test_until_mod:5095 meth until foo -!!! test_until_post:4978 +!!! test_until_post:5110 begin meth end until foo -!!! test_var_and_asgn:1714 +!!! test_var_and_asgn:1728 a &&= 1 -!!! test_var_op_asgn:1498 +!!! test_var_op_asgn:1512 a += 1 -!!! test_var_op_asgn:1504 +!!! test_var_op_asgn:1518 @a |= 1 -!!! test_var_op_asgn:1510 +!!! test_var_op_asgn:1524 @@var |= 10 -!!! test_var_op_asgn:1514 +!!! test_var_op_asgn:1528 def a; @@var |= 10; end -!!! test_var_op_asgn_cmd:1521 +!!! test_var_op_asgn_cmd:1535 foo += m foo -!!! test_var_or_asgn:1706 +!!! test_var_or_asgn:1720 a ||= 1 -!!! test_when_multi:4895 +!!! test_when_multi:5027 case foo; when 'bar', 'baz'; bar; end -!!! test_when_splat:4904 +!!! test_when_splat:5036 case foo; when 1, *baz; bar; when *foo; end -!!! test_when_then:4883 +!!! test_when_then:5015 case foo; when 'bar' then bar; end -!!! test_while:4924 +!!! test_while:5056 while foo do meth end -!!! test_while:4932 +!!! test_while:5064 while foo; meth end -!!! test_while_mod:4941 +!!! test_while_mod:5073 meth while foo -!!! test_while_post:4970 +!!! test_while_post:5102 begin meth end while foo -!!! test_xstring_interp:524 +!!! test_xstring_interp:526 `foo#{bar}baz` -!!! test_xstring_plain:515 +!!! test_xstring_plain:517 `foobar` -!!! test_yield:3855 +!!! test_yield:3915 yield(foo) -!!! test_yield:3863 +!!! test_yield:3923 yield foo -!!! test_yield:3869 +!!! test_yield:3929 yield() -!!! test_yield:3877 +!!! test_yield:3937 yield -!!! test_zsuper:3831 +!!! test_zsuper:3891 super diff --git a/test/translation/parser_test.rb b/test/translation/parser_test.rb index 1df98f47..dd88322e 100644 --- a/test/translation/parser_test.rb +++ b/test/translation/parser_test.rb @@ -8,109 +8,83 @@ module SyntaxTree module Translation class ParserTest < Minitest::Test - known_failures = [ - # I think this may be a bug in the parser gem's precedence calculation. - # Unary plus appears to be parsed as part of the number literal in - # CRuby, but parser is parsing it as a separate operator. - "test_unary_num_pow_precedence:3505", - - # Not much to be done about this. Basically, regular expressions with - # named capture groups that use the =~ operator inject local variables - # into the current scope. In the parser gem, it detects this and changes - # future references to that name to be a local variable instead of a - # potential method call. CRuby does not do this. - "test_lvar_injecting_match:3778", - - # This is failing because CRuby is not marking values captured in hash - # patterns as local variables, while the parser gem is. - "test_pattern_matching_hash:8971", - - # This is not actually allowed in the CRuby parser but the parser gem - # thinks it is allowed. - "test_pattern_matching_hash_with_string_keys:9016", - "test_pattern_matching_hash_with_string_keys:9027", - "test_pattern_matching_hash_with_string_keys:9038", - "test_pattern_matching_hash_with_string_keys:9060", - "test_pattern_matching_hash_with_string_keys:9071", - "test_pattern_matching_hash_with_string_keys:9082", - - # This happens with pattern matching where you're matching a literal - # value inside parentheses, which doesn't really do anything. Ripper - # doesn't capture that this value is inside a parentheses, so it's hard - # to translate properly. - "test_pattern_matching_expr_in_paren:9206", - - # These are also failing because of CRuby not marking values captured in - # hash patterns as local variables. - "test_pattern_matching_single_line_allowed_omission_of_parentheses:*", - - # I'm not even sure what this is testing, because the code is invalid in - # CRuby. - "test_control_meta_escape_chars_in_regexp__since_31:*", - ] - - todo_failures = [ - "test_dedenting_heredoc:334", - "test_dedenting_heredoc:390", - "test_dedenting_heredoc:399", - "test_slash_newline_in_heredocs:7194", - "test_parser_slash_slash_n_escaping_in_literals:*", - "test_forwarded_restarg:*", - "test_forwarded_kwrestarg:*", - "test_forwarded_argument_with_restarg:*", - "test_forwarded_argument_with_kwrestarg:*" + skips = %w[ + test_args_assocs_legacy:4041 + test_args_assocs:4091 + test_args_assocs:4091 + test_break_block:5204 + test_break:5169 + test_break:5183 + test_break:5189 + test_break:5196 + test_control_meta_escape_chars_in_regexp__since_31:* + test_dedenting_heredoc:336 + test_dedenting_heredoc:392 + test_dedenting_heredoc:401 + test_forwarded_argument_with_kwrestarg:11332 + test_forwarded_argument_with_restarg:11267 + test_forwarded_kwrestarg_with_additional_kwarg:11306 + test_forwarded_kwrestarg:11287 + test_forwarded_restarg:11249 + test_hash_pair_value_omission:10364 + test_hash_pair_value_omission:10376 + test_if_while_after_class__since_32:11374 + test_if_while_after_class__since_32:11384 + test_kwoptarg_with_kwrestarg_and_forwarded_args:11482 + test_lvar_injecting_match:3819 + test_newline_in_hash_argument:11427 + test_next_block:5298 + test_next:5263 + test_next:5277 + test_next:5283 + test_next:5290 + test_next:5290 + test_parser_slash_slash_n_escaping_in_literals:* + test_pattern_matching_explicit_array_match:8903 + test_pattern_matching_explicit_array_match:8928 + test_pattern_matching_expr_in_paren:9443 + test_pattern_matching_hash_with_string_keys:* + test_pattern_matching_hash_with_string_keys:9264 + test_pattern_matching_hash:9186 + test_pattern_matching_implicit_array_match:8796 + test_pattern_matching_implicit_array_match:8841 + test_pattern_matching_numbered_parameter:9654 + test_pattern_matching_single_line_allowed_omission_of_parentheses:9868 + test_pattern_matching_single_line_allowed_omission_of_parentheses:9898 + test_redo:5310 + test_retry:5589 + test_send_index_asgn_kwarg_legacy:3642 + test_send_index_asgn_kwarg_legacy:3642 + test_send_index_asgn_kwarg:3629 + test_send_index_asgn_kwarg:3629 + test_slash_newline_in_heredocs:7379 + test_unary_num_pow_precedence:3519 + test_yield:3915 + test_yield:3923 + test_yield:3929 + test_yield:3937 ] - current_version = RUBY_VERSION.split(".")[0..1].join(".") - - if current_version <= "2.7" - # I'm not sure why this is failing on 2.7.0, but we'll turn it off for - # now until we have more time to investigate. - todo_failures.push( + if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.1.0") + skips.push( + "test_endless_method_forwarded_args_legacy:10139", + "test_forward_arg_with_open_args:11114", + "test_forward_arg:8090", + "test_forward_args_legacy:8054", + "test_forward_args_legacy:8066", + "test_forward_args_legacy:8078", "test_pattern_matching_hash:*", - "test_pattern_matching_single_line:9552" + "test_pattern_matching_single_line:9839", + "test_trailing_forward_arg:8237" ) end - - if current_version <= "3.0" - # In < 3.0, there are some changes to the way the parser gem handles - # forwarded args. We should eventually support this, but for now we're - # going to mark them as todo. - todo_failures.push( - "test_forward_arg:*", - "test_forward_args_legacy:*", - "test_endless_method_forwarded_args_legacy:*", - "test_trailing_forward_arg:*", - "test_forward_arg_with_open_args:10770", - ) - end - - if current_version == "3.1" - # This test actually fails on 3.1.0, even though it's marked as being - # since 3.1. So we're going to skip this test on 3.1, but leave it in - # for other versions. - known_failures.push( - "test_multiple_pattern_matches:11086", - "test_multiple_pattern_matches:11102" - ) - end - - if current_version < "3.2" || RUBY_ENGINE == "truffleruby" - known_failures.push( - "test_if_while_after_class__since_32:11004", - "test_if_while_after_class__since_32:11014", - "test_newline_in_hash_argument:11057" - ) - end - - all_failures = known_failures + todo_failures File .foreach(File.expand_path("parser.txt", __dir__), chomp: true) .slice_before { |line| line.start_with?("!!!") } .each do |(prefix, *lines)| name = prefix[4..] - next if all_failures.any? { |pattern| File.fnmatch?(pattern, name) } + next if skips.any? { |skip| File.fnmatch?(skip, name) } define_method(name) { assert_parses("#{lines.join("\n")}\n") } end