diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-16 13:55:09 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-16 13:55:09 +0000 |
commit | 0ebf9b176380e691d3505e6c96cb0e33c6d892e4 (patch) | |
tree | 830e7a0e1821edf0488e74e22ae4e0a0e520c74d /lib/test/unit/testresult.rb | |
parent | 7485e91f76b7149c421900934adb146913142f8c (diff) | |
download | ruby-0ebf9b176380e691d3505e6c96cb0e33c6d892e4.tar.gz |
* lib/test/unit: removed test/unit.
* lib/test/unit.rb: new compatibility layer using minitest.
* bin/testrb: use above.
* test/runner.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/test/unit/testresult.rb')
-rw-r--r-- | lib/test/unit/testresult.rb | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/lib/test/unit/testresult.rb b/lib/test/unit/testresult.rb deleted file mode 100644 index 3fe9b7c57f..0000000000 --- a/lib/test/unit/testresult.rb +++ /dev/null @@ -1,81 +0,0 @@ -#-- -# -# Author:: Nathaniel Talbott. -# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. -# License:: Ruby license. - -require 'test/unit/util/observable' - -module Test - module Unit - - # Collects Test::Unit::Failure and Test::Unit::Error so that - # they can be displayed to the user. To this end, observers - # can be added to it, allowing the dynamic updating of, say, a - # UI. - class TestResult - include Util::Observable - - CHANGED = "CHANGED" - FAULT = "FAULT" - - attr_reader(:run_count, :assertion_count) - - # Constructs a new, empty TestResult. - def initialize - @run_count, @assertion_count = 0, 0 - @failures, @errors = Array.new, Array.new - end - - # Records a test run. - def add_run - @run_count += 1 - notify_listeners(CHANGED, self) - end - - # Records a Test::Unit::Failure. - def add_failure(failure) - @failures << failure - notify_listeners(FAULT, failure) - notify_listeners(CHANGED, self) - end - - # Records a Test::Unit::Error. - def add_error(error) - @errors << error - notify_listeners(FAULT, error) - notify_listeners(CHANGED, self) - end - - # Records an individual assertion. - def add_assertion - @assertion_count += 1 - notify_listeners(CHANGED, self) - end - - # Returns a string contain the recorded runs, assertions, - # failures and errors in this TestResult. - def to_s - "#{run_count} tests, #{assertion_count} assertions, #{failure_count} failures, #{error_count} errors" - end - - # Returns whether or not this TestResult represents - # successful completion. - def passed? - return @failures.empty? && @errors.empty? - end - - # Returns the number of failures this TestResult has - # recorded. - def failure_count - return @failures.size - end - - # Returns the number of errors this TestResult has - # recorded. - def error_count - return @errors.size - end - end - end -end |