模块 Test::Unit::TestCasePendingSupport
公共类方法
included(base) 点击切换源代码
# File test-unit-3.6.7/lib/test/unit/pending.rb, line 58 def included(base) base.class_eval do include PendingHandler end end
公共实例方法
pend(message=nil) { || ... } 点击切换源代码
标记测试或测试的一部分为待定状态。
示例
def test_pending pend # Not reached here end def test_pending_with_here pend do # Ran here # Fails if the block doesn't raise any error. # Because it means the block is passed unexpectedly. end # Reached here end
# File test-unit-3.6.7/lib/test/unit/pending.rb, line 82 def pend(message=nil, &block) message ||= "pended." if block_given? pending = nil begin yield rescue Exception pending = Pending.new(name, filter_backtrace(caller), message, :method_name => @method_name) add_pending(pending) end unless pending flunk("Pending block should not be passed: #{message}") end else raise PendedError.new(message) end end
私有实例方法
add_pending(pending) 点击切换源代码
# File test-unit-3.6.7/lib/test/unit/pending.rb, line 102 def add_pending(pending) problem_occurred current_result.add_pending(pending) end