Class: Test::TAP::TestCase
- Inherits:
-
Object
- Object
- Test::TAP::TestCase
- Defined in:
- lib/test/tap/test_case.rb
Instance Method Summary collapse
-
#initialize(line) ⇒ TestCase
constructor
A new instance of TestCase.
- #parse_details(yaml) ⇒ Object
- #run(result) {|Test::Unit::TestCase::STARTED, name| ... } ⇒ Object
Constructor Details
#initialize(line) ⇒ TestCase
Returns a new instance of TestCase.
7 8 9 |
# File 'lib/test/tap/test_case.rb', line 7 def initialize(line) @tap_line = line end |
Instance Method Details
#parse_details(yaml) ⇒ Object
29 30 31 |
# File 'lib/test/tap/test_case.rb', line 29 def parse_details yaml @details = YAML::load( yaml ) end |
#run(result) {|Test::Unit::TestCase::STARTED, name| ... } ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/test/tap/test_case.rb', line 11 def run(result) dummy, ok, failure, case_name, test_name = /^(ok|not ok) \d+ - ((?:\w+: )?)(\w+)::(.+)$/.match(@tap_line).to_a name = "#{sanitize_test_name test_name}(#{case_name})" yield(Test::Unit::TestCase::STARTED, name) if ok.nil? result.add_error( RuntimeError.new @tap_line) elsif ok == 'not ok' if failure.chomp(': ') == 'Failure' # If PHPUnit would return more info, we could fill this out result.add_failure(Test::Unit::Failure.new(name, [], )) else #TODO add_error end end result.add_run yield(Test::Unit::TestCase::FINISHED, name) end |