Class: Test::Unit::Assertions::ThrowTagExtractor
- Inherits:
-
Object
- Object
- Test::Unit::Assertions::ThrowTagExtractor
- Defined in:
- lib/test/unit/assertions.rb
Constant Summary collapse
- UncaughtThrowPatterns =
{ NameError => /^uncaught throw `(.+)'$/, ArgumentError => /^uncaught throw (`.+'|.+)$/, ThreadError => /^uncaught throw `(.+)' in thread /, }
- @@have_uncaught_throw_error =
const_defined?(:UncaughtThrowError)
Instance Method Summary collapse
- #extract_tag ⇒ Object
-
#initialize(error) ⇒ ThrowTagExtractor
constructor
A new instance of ThrowTagExtractor.
Constructor Details
#initialize(error) ⇒ ThrowTagExtractor
Returns a new instance of ThrowTagExtractor.
817 818 819 |
# File 'lib/test/unit/assertions.rb', line 817 def initialize(error) @error = error end |
Instance Method Details
#extract_tag ⇒ Object
821 822 823 824 825 826 827 828 829 830 831 832 833 |
# File '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. tag = $1 end normalize_tag(tag) end |