模块 Test::Unit::ErrorHandler
常量
- NOT_PASS_THROUGH_EXCEPTIONS
- NOT_PASS_THROUGH_EXCEPTION_NAMES
- PASS_THROUGH_EXCEPTIONS
- PASS_THROUGH_EXCEPTION_NAMES
公共类方法
included(base) 点击切换源代码
# File test-unit-3.6.7/lib/test/unit/error.rb, line 74 def included(base) base.exception_handler(:handle_all_exception) end
私有实例方法
add_error(exception) 点击切换源代码
# File test-unit-3.6.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) 点击切换源代码
# File test-unit-3.6.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) 点击切换源代码
# File test-unit-3.6.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