module Test::Unit::ErrorHandler

Constants

NOT_PASS_THROUGH_EXCEPTIONS
NOT_PASS_THROUGH_EXCEPTION_NAMES
PASS_THROUGH_EXCEPTIONS
PASS_THROUGH_EXCEPTION_NAMES

Public Class Methods

included(base) click to toggle source
# File test-unit-3.3.7/lib/test/unit/error.rb, line 74
def included(base)
  base.exception_handler(:handle_all_exception)
end

Private Instance Methods

add_error(exception) click to toggle source
# File test-unit-3.3.7/lib/test/unit/error.rb, line 119
def add_error(exception)
  error = Error.new(name, exception, :method_name => @method_name)
  current_result.add_error(error)
end
handle_all_exception(exception) click to toggle source
# File test-unit-3.3.7/lib/test/unit/error.rb, line 89
def handle_all_exception(exception)
  return false if pass_through_exception?(exception)

  problem_occurred
  add_error(exception)
  true
end
pass_through_exception?(exception) click to toggle source
# File test-unit-3.3.7/lib/test/unit/error.rb, line 97
def pass_through_exception?(exception)
  case exception
  when *NOT_PASS_THROUGH_EXCEPTIONS
    return false
  end
  case exception.class.name
  when *NOT_PASS_THROUGH_EXCEPTION_NAMES
    return false
  end

  case exception
  when *PASS_THROUGH_EXCEPTIONS
    return true
  end
  case exception.class.name
  when *PASS_THROUGH_EXCEPTION_NAMES
    return true
  end

  false
end