class TestFaultLocationDetector

Public Instance Methods

setup() click to toggle source
# File test-unit-3.3.4/test/test-fault-location-detector.rb, line 12
def setup
  @fetcher = Test::Unit::CodeSnippetFetcher.new
end

Private Instance Methods

assert_detect(fault, target_line_number) click to toggle source
# File test-unit-3.3.4/test/test-fault-location-detector.rb, line 24
def assert_detect(fault, target_line_number)
  detector = Test::Unit::FaultLocationDetector.new(fault, @fetcher)

  expected_backtrace_entries_until_detected = []
  fault.location.each do |backtrace_entry|
    expected_backtrace_entries_until_detected << backtrace_entry
    _, line_number, = detector.split_backtrace_entry(backtrace_entry)
    break if target_line_number == line_number
  end

  actual_backtrace_entries_until_detected = []
  fault.location.each do |backtrace_entry|
    actual_backtrace_entries_until_detected << backtrace_entry
    break if detector.target?(backtrace_entry)
  end

  assert_equal(expected_backtrace_entries_until_detected,
               actual_backtrace_entries_until_detected)
end
run_test_case(test_case) click to toggle source
# File test-unit-3.3.4/test/test-fault-location-detector.rb, line 17
def run_test_case(test_case)
  suite = test_case.suite
  result = Test::Unit::TestResult.new
  suite.run(result) {}
  result.faults[0]
end