class Minitest::Runnable

def self.inherited klass # :nodoc:

:nodoc:
re-open
def self.inherited klass # :nodoc:
  self.runnables << klass
  super
end

def self.methods_matching re

def self.methods_matching re
  public_instance_methods(true).grep(re).map(&:to_s)
end

def self.on_signal name, action # :nodoc:

:nodoc:
def self.on_signal name, action # :nodoc:
  supported = SIGNALS[name]
  old_trap = trap name do
    old_trap.call if old_trap.respond_to? :call
    action.call
  end if supported
  yield
ensure
  trap name, old_trap if supported
end

def self.reset # :nodoc:

:nodoc:
def self.reset # :nodoc:
  @@runnables = []
end

def self.run reporter, options = {}

def self.run reporter, options = {}
  pos = options[:filter]
  neg = options[:exclude]
  pos = Regexp.new $1 if pos.is_a?(String) && pos =~ %r%/(.*)/%
  neg = Regexp.new $1 if neg.is_a?(String) && neg =~ %r%/(.*)/%
  filtered_methods = self.runnable_methods
    .select { |m| !pos ||  pos === m || pos === "#{self}##{m}"  }
    .reject { |m|  neg && (neg === m || neg === "#{self}##{m}") }
  return if filtered_methods.empty?
  with_info_handler reporter do
    filtered_methods.each do |method_name|
      run_one_method self, method_name, reporter
    end
  end
end

def self.run_one_method klass, method_name, reporter

def self.run_one_method klass, method_name, reporter
  reporter.prerecord klass, method_name
  reporter.record Minitest.run_one_method(klass, method_name)
end

def self.runnable_methods

def self.runnable_methods
  raise NotImplementedError, "subclass responsibility"
end

def self.runnables

def self.runnables
  @@runnables
end

def self.test_order

def self.test_order
  :random
end

def self.with_info_handler reporter, &block # :nodoc:

:nodoc:
def self.with_info_handler reporter, &block # :nodoc:
  handler = lambda do
    unless reporter.passed? then
      warn "Current results:"
      warn ""
      warn reporter.reporters.first
      warn ""
    end
  end
  on_signal ::Minitest.info_signal, handler, &block
end

def failure # :nodoc:

:nodoc:
def failure # :nodoc:
  self.failures.first
end

def initialize name # :nodoc:

:nodoc:
def initialize name # :nodoc:
  self.name       = name
  self.failures   = []
  self.assertions = 0
  # lazy initializer for metadata
end

def marshal_dump # :nodoc:

:nodoc:
def marshal_dump # :nodoc:
  unless @@marshal_dump_warned then
    warn ["Minitest::Runnable#marshal_dump is deprecated.",
          "You might be violating internals. From", caller.first].join " "
    @@marshal_dump_warned = true
  end
  [self.name, self.failures, self.assertions, self.time]
end

def marshal_load ary # :nodoc:

:nodoc:
def marshal_load ary # :nodoc:
  self.name, self.failures, self.assertions, self.time = ary
end

def metadata

def metadata
  @metadata ||= {}
end

def metadata?

def metadata?
  defined? @metadata
end

def name

def name
  @NAME
end

def name= o

def name= o
  @NAME = o
end

def passed?

def passed?
  raise NotImplementedError, "subclass responsibility"
end

def result_code

def result_code
  raise NotImplementedError, "subclass responsibility"
end

def run

def run
  raise NotImplementedError, "subclass responsibility"
end

def skipped?

def skipped?
  raise NotImplementedError, "subclass responsibility"
end

def time_it # :nodoc:

:nodoc:
def time_it # :nodoc:
  t0 = Minitest.clock_time
  yield
ensure
  self.time = Minitest.clock_time - t0
end