class Test::Unit::Collector::Load

Attributes

base[R]
default_test_paths[R]
excludes[R]
patterns[R]

Public Class Methods

new() click to toggle source
Calls superclass method Test::Unit::Collector::new
# File test-unit-3.5.5/lib/test/unit/collector/load.rb, line 15
def initialize
  super
  @system_excludes = [/~\z/, /\A\.\#/]
  @system_directory_excludes = [/\A(?:CVS|\.svn|\.git)\z/]
  @patterns = [/\Atest[_\-].+\.rb\z/m, /[_\-]test\.rb\z/]
  @excludes = []
  @base = nil
  @default_test_paths = []
  @require_failed_infos = []
end

Public Instance Methods

base=(base) click to toggle source
# File test-unit-3.5.5/lib/test/unit/collector/load.rb, line 26
def base=(base)
  base = Pathname(base) unless base.nil?
  @base = base
end
collect(*froms) click to toggle source
# File test-unit-3.5.5/lib/test/unit/collector/load.rb, line 37
def collect(*froms)
  add_load_path(@base) do
    froms = @default_test_paths if froms.empty?
    froms = ["."] if froms.empty?
    test_suites = []
    already_gathered = find_test_cases
    froms.each do |from|
      from = resolve_path(from)
      if from.directory?
        test_suite = collect_recursive(from, already_gathered)
        test_suites << test_suite unless test_suite.tests.empty?
      else
        collect_file(from, test_suites, already_gathered)
      end
    end
    add_require_failed_test_suite(test_suites)

    if test_suites.size > 1
      test_suite = TestSuite.new("[#{froms.join(', ')}]")
      sort(test_suites).each do |sub_test_suite|
        test_suite << sub_test_suite
      end
    else
      test_suite = test_suites.first
    end

    adjust_ractor_tests(test_suite)

    test_suite
  end
end
default_test_paths=(paths) click to toggle source
# File test-unit-3.5.5/lib/test/unit/collector/load.rb, line 31
def default_test_paths=(paths)
  @default_test_paths = paths.collect do |path|
    Pathname(path)
  end
end
find_test_cases(ignore=[]) click to toggle source
# File test-unit-3.5.5/lib/test/unit/collector/load.rb, line 69
def find_test_cases(ignore=[])
  test_cases = []
  TestCase::DESCENDANTS.each do |test_case|
    test_cases << test_case unless ignore.include?(test_case)
  end
  ignore.concat(test_cases)
  test_cases
end