类 Test::Unit::Assertions::ThrowTagExtractor

@private

常量

UncaughtThrowPatterns

公共类方法

new(error) 点击切换源码
# File test-unit-3.6.7/lib/test/unit/assertions.rb, line 817
def initialize(error)
  @error = error
end

公共实例方法

extract_tag() 点击切换源码
# File test-unit-3.6.7/lib/test/unit/assertions.rb, line 821
def extract_tag
  tag = nil
  if @@have_uncaught_throw_error
    return nil unless @error.is_a?(UncaughtThrowError)
    tag = @error.tag
  else
    pattern = UncaughtThrowPatterns[@error.class]
    return nil if pattern.nil?
    return nil unless pattern =~ @error.message
    tag = $1
  end
  normalize_tag(tag)
end

私有实例方法

normalize_tag(tag) 点击切换源码
# File test-unit-3.6.7/lib/test/unit/assertions.rb, line 836
def normalize_tag(tag)
  case tag
  when /\A:/
    tag[1..-1].intern
  when /\A`(.+)'\z/
    $1.intern
  when String
    tag.intern
  else
    tag
  end
end