class Rails::TestUnit::TestParser

:nodoc:
method-style (def test_foo) and declarative-style (test “foo” do)
Parse a test file to extract the line ranges of all tests in both

def self.definition_for(method_obj)

the method was defined.
Helper to translate a method object into the path and line range where
:nodoc:
method-style (def test_foo) and declarative-style (test "foo" do)
Parse a test file to extract the line ranges of all tests in both
def self.definition_for(method_obj)
  path, begin_line = method_obj.source_location
  begins_to_ends = new(File.read(path), path).parse
  return unless end_line = begins_to_ends[begin_line]
  [path, (begin_line..end_line)]
end

def first_arg(arg, *)

def first_arg(arg, *)
  arg
end

def initialize(*)

def initialize(*)
  # A hash mapping the 1-indexed line numbers that tests start on to where they end.
  @begins_to_ends = {}
  super
end

def just_lineno(*)

def just_lineno(*)
  lineno
end

def on_args_add(parts, part)

def on_args_add(parts, part)
  parts << part
end

def on_args_add_block(args, *rest)

def on_args_add_block(args, *rest)
  args.first
end

def on_args_new

def on_args_new
  []
end

def on_command_call(*, begin_lineno, _args)

def on_command_call(*, begin_lineno, _args)
  begin_lineno
end

def on_def(begin_line, *)

instead.
name, which we have overridden to return the line number of the ident
This event's first argument gets the `ident` node containing the method
method test e.g. `def test_some_description`
def on_def(begin_line, *)
  @begins_to_ends[begin_line] = lineno
end

def on_method_add_block(begin_line, end_line)

def on_method_add_block(begin_line, end_line)
  if begin_line && end_line
    @begins_to_ends[begin_line] = end_line
  end
end

def parse

def parse
  super
  @begins_to_ends
end