diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-25 15:13:14 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-25 15:13:14 +0000 |
commit | d0233291bc8a5068e52c69c210e5979e5324b5bc (patch) | |
tree | 7d9459449c33792c63eeb7baa071e76352e0baab /trunk/lib/test/unit/ui/testrunnermediator.rb | |
parent | 0dc342de848a642ecce8db697b8fecd83a63e117 (diff) | |
parent | 72eaacaa15256ab95c3b52ea386f88586fb9da40 (diff) |
re-adding tag v1_9_0_4 as an alias of trunk@18848v1_9_0_4
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_9_0_4@18849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'trunk/lib/test/unit/ui/testrunnermediator.rb')
-rw-r--r-- | trunk/lib/test/unit/ui/testrunnermediator.rb | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/trunk/lib/test/unit/ui/testrunnermediator.rb b/trunk/lib/test/unit/ui/testrunnermediator.rb deleted file mode 100644 index 07bb462cc0..0000000000 --- a/trunk/lib/test/unit/ui/testrunnermediator.rb +++ /dev/null @@ -1,68 +0,0 @@ -#-- -# -# Author:: Nathaniel Talbott. -# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. -# License:: Ruby license. - -require 'test/unit' -require 'test/unit/util/observable' -require 'test/unit/testresult' - -module Test - module Unit - module UI # :nodoc: - - # Provides an interface to write any given UI against, - # hopefully making it easy to write new UIs. - class TestRunnerMediator - RESET = name + "::RESET" - STARTED = name + "::STARTED" - FINISHED = name + "::FINISHED" - - include Util::Observable - - # Creates a new TestRunnerMediator initialized to run - # the passed suite. - def initialize(suite) - @suite = suite - end - - # Runs the suite the TestRunnerMediator was created - # with. - def run_suite - Unit.run = true - begin_time = Time.now - notify_listeners(RESET, @suite.size) - result = create_result - notify_listeners(STARTED, result) - result_listener = result.add_listener(TestResult::CHANGED) do |updated_result| - notify_listeners(TestResult::CHANGED, updated_result) - end - - fault_listener = result.add_listener(TestResult::FAULT) do |fault| - notify_listeners(TestResult::FAULT, fault) - end - - @suite.run(result) do |channel, value| - notify_listeners(channel, value) - end - - result.remove_listener(TestResult::FAULT, fault_listener) - result.remove_listener(TestResult::CHANGED, result_listener) - end_time = Time.now - elapsed_time = end_time - begin_time - notify_listeners(FINISHED, elapsed_time) #"Finished in #{elapsed_time} seconds.") - return result - end - - private - # A factory method to create the result the mediator - # should run with. Can be overridden by subclasses if - # one wants to use a different result. - def create_result - return TestResult.new - end - end - end - end -end |