$57 GRAYBYTE WORDPRESS FILE MANAGER $86

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 104.21.43.35 | ADMIN IP 216.73.216.23
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/ruby18/lib64/ruby/1.8/test/unit/

HOME
Current File : /opt/alt/ruby18/lib64/ruby/1.8/test/unit//testresult.rb
#--
# 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


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2024 10.48 PM
root / linksafe
0755
collector
--
3 Mar 2024 10.48 PM
root / linksafe
0755
ui
--
3 Mar 2024 10.48 PM
root / linksafe
0755
util
--
3 Mar 2024 10.48 PM
root / linksafe
0755
assertionfailederror.rb
0.29 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
assertions.rb
17.8 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
autorunner.rb
6.584 KB
25 Feb 2007 2.08 PM
root / linksafe
0644
collector.rb
0.853 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
error.rb
1.4 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
failure.rb
1.287 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
testcase.rb
4.442 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
testresult.rb
2.029 KB
12 Feb 2007 11.01 PM
root / linksafe
0644
testsuite.rb
1.911 KB
12 Feb 2007 11.01 PM
root / linksafe
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF