class TestFaultLocationDetector::TestInBlock

Public Class Methods

target_line_number() click to toggle source
# File test-unit-3.3.4/test/test-fault-location-detector.rb, line 139
def target_line_number
  @@target_line_number
end
target_line_number=(line_number) click to toggle source
# File test-unit-3.3.4/test/test-fault-location-detector.rb, line 143
def target_line_number=(line_number)
  @@target_line_number = line_number
end

Public Instance Methods

run_yield() { || ... } click to toggle source
# File test-unit-3.3.4/test/test-fault-location-detector.rb, line 148
def run_yield
  yield
end
test_failed() click to toggle source
# File test-unit-3.3.4/test/test-fault-location-detector.rb, line 152
def test_failed
  run_yield do
    self.class.target_line_number = __LINE__; assert_always_failed
  end
end
test_in_block() click to toggle source
# File test-unit-3.3.4/test/test-fault-location-detector.rb, line 134
def test_in_block
  test_case = Class.new(Test::Unit::TestCase) do
    include AlwaysFailAssertion

    class << self
      def target_line_number
        @@target_line_number
      end

      def target_line_number=(line_number)
        @@target_line_number = line_number
      end
    end

    def run_yield
      yield
    end

    def test_failed
      run_yield do
        self.class.target_line_number = __LINE__; assert_always_failed
      end
    end
  end

  fault = run_test_case(test_case)
  assert_detect(fault, test_case.target_line_number)
end