class Test::Unit::Assertions::ThrowTagExtractor

@private

Constants

UncaughtThrowPatterns

Public Class Methods

new(error) click to toggle source
# File test-unit-3.3.4/lib/test/unit/assertions.rb, line 758
def initialize(error)
  @error = error
end

Public Instance Methods

extract_tag() click to toggle source
# File test-unit-3.3.4/lib/test/unit/assertions.rb, line 762
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

Private Instance Methods

normalize_tag(tag) click to toggle source
# File test-unit-3.3.4/lib/test/unit/assertions.rb, line 777
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