[前][次][番号順一覧][スレッド一覧]

ruby-changes:8145

From: yugui <ko1@a...>
Date: Sat, 4 Oct 2008 16:32:19 +0900 (JST)
Subject: [ruby-changes:8145] Ruby:r19673 (trunk): * test/mini/test_mini_test.rb: recovered. It had been temporarily removed at r19645.

yugui	2008-10-04 16:30:51 +0900 (Sat, 04 Oct 2008)

  New Revision: 19673

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19673

  Log:
    * test/mini/test_mini_test.rb: recovered. It had been temporarily removed at r19645.
    
    * test/mini/test_mini_mock.rb: ditto.
    
    * test/mini/test_mini_spec.rb: ditto.
    
    * lib/test/**/*: replaced by miniunit.
      miniunit had been temporarily reverted at r19643 but now recovred.

  Added files:
    trunk/lib/test/unit/deprecate.rb
    trunk/test/mini/test_mini_mock.rb
    trunk/test/mini/test_mini_spec.rb
    trunk/test/mini/test_mini_test.rb
  Removed files:
    trunk/lib/test/unit/assertionfailederror.rb
    trunk/lib/test/unit/autorunner.rb
    trunk/lib/test/unit/collector/dir.rb
    trunk/lib/test/unit/collector/objectspace.rb
    trunk/lib/test/unit/collector.rb
    trunk/lib/test/unit/failure.rb
    trunk/lib/test/unit/testresult.rb
    trunk/lib/test/unit/testsuite.rb
    trunk/lib/test/unit/ui/console/testrunner.rb
    trunk/lib/test/unit/ui/fox/testrunner.rb
    trunk/lib/test/unit/ui/gtk/testrunner.rb
    trunk/lib/test/unit/ui/gtk2/testrunner.rb
    trunk/lib/test/unit/ui/testrunnermediator.rb
    trunk/lib/test/unit/ui/testrunnerutilities.rb
    trunk/lib/test/unit/ui/tk/testrunner.rb
    trunk/lib/test/unit/util/backtracefilter.rb
    trunk/lib/test/unit/util/observable.rb
    trunk/lib/test/unit/util/procwrapper.rb
  Modified files:
    trunk/ChangeLog
    trunk/lib/test/unit/assertions.rb
    trunk/lib/test/unit/error.rb
    trunk/lib/test/unit/testcase.rb
    trunk/lib/test/unit.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19672)
+++ ChangeLog	(revision 19673)
@@ -1,3 +1,16 @@
+Sat Oct  4 15:52:17 2008  Yuki Sonoda (Yugui)  <yugui@y...>
+
+	* test/mini/test_mini_test.rb: recovered.
+	  It had been temporarily removed at r19645.
+
+	* test/mini/test_mini_mock.rb: ditto.
+
+	* test/mini/test_mini_spec.rb: ditto.
+
+	* lib/test/**/*: replaced by miniunit.
+	  miniunit had been temporarily reverted at r19643 but
+	  now recovred.
+
 Sat Oct  4 15:33:26 2008  Yuki Sonoda (Yugui)  <yugui@y...>
 
 	* common.mk (gdb-ruby): new target. it runs ruby under controlled by
Index: lib/test/unit/testresult.rb
===================================================================
--- lib/test/unit/testresult.rb	(revision 19672)
+++ lib/test/unit/testresult.rb	(revision 19673)
@@ -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
Index: lib/test/unit/autorunner.rb
===================================================================
--- lib/test/unit/autorunner.rb	(revision 19672)
+++ lib/test/unit/autorunner.rb	(revision 19673)
@@ -1,217 +0,0 @@
-require 'test/unit'
-require 'test/unit/ui/testrunnerutilities'
-require 'optparse'
-
-module Test
-  module Unit
-    class AutoRunner
-      def self.run(force_standalone=false, default_dir=nil, argv=ARGV, &block)
-        r = new(force_standalone || standalone?, &block)
-        r.base = default_dir
-        r.process_args(argv)
-        r.run
-      end
-      
-      def self.standalone?
-        return false unless("-e" == $0)
-        TestCase::DECENDANT_CLASSES.empty?
-      end
-
-      RUNNERS = {
-        :console => proc do |r|
-          require 'test/unit/ui/console/testrunner'
-          Test::Unit::UI::Console::TestRunner
-        end,
-        :gtk => proc do |r|
-          require 'test/unit/ui/gtk/testrunner'
-          Test::Unit::UI::GTK::TestRunner
-        end,
-        :gtk2 => proc do |r|
-          require 'test/unit/ui/gtk2/testrunner'
-          Test::Unit::UI::GTK2::TestRunner
-        end,
-        :fox => proc do |r|
-          require 'test/unit/ui/fox/testrunner'
-          Test::Unit::UI::Fox::TestRunner
-        end,
-        :tk => proc do |r|
-          require 'test/unit/ui/tk/testrunner'
-          Test::Unit::UI::Tk::TestRunner
-        end,
-      }
-
-      OUTPUT_LEVELS = [
-        [:silent, UI::SILENT],
-        [:progress, UI::PROGRESS_ONLY],
-        [:normal, UI::NORMAL],
-        [:verbose, UI::VERBOSE],
-      ]
-
-      COLLECTORS = {
-        :objectspace => proc do |r|
-          require 'test/unit/collector/objectspace'
-          c = Collector::ObjectSpace.new
-          c.filter = r.filters
-          c.collect($0.sub(/\.rb\Z/, ''))
-        end,
-        :dir => proc do |r|
-          require 'test/unit/collector/dir'
-          c = Collector::Dir.new
-          c.filter = r.filters
-          c.pattern.concat(r.pattern) if(r.pattern)
-          c.exclude.concat(r.exclude) if(r.exclude)
-          c.base = r.base
-          $:.push(r.base) if r.base
-          c.collect(*(r.to_run.empty? ? ['.'] : r.to_run))
-        end,
-      }
-
-      attr_reader :suite
-      attr_accessor :output_level, :filters, :to_run, :pattern, :exclude, :base, :workdir
-      attr_writer :runner, :collector
-
-      def initialize(standalone)
-        Unit.run = true
-        @standalone = standalone
-        @runner = RUNNERS[:console]
-        @collector = COLLECTORS[(standalone ? :dir : :objectspace)]
-        @filters = []
-        @to_run = []
-        @output_level = UI::NORMAL
-        @workdir = false
-        yield(self) if(block_given?)
-      end
-
-      def process_args(args = ARGV)
-        begin
-          options.order!(args) {|arg| @to_run << arg}
-        rescue OptionParser::ParseError => e
-          puts e
-          puts options
-          $! = nil
-          abort
-        else
-          @filters << proc{false} unless(@filters.empty?)
-        end
-        not @to_run.empty?
-      end
-
-      def options
-        @options ||= OptionParser.new do |o|
-          o.banner = "Test::Unit automatic runner."
-          o.banner << "\nUsage: #{$0} [options] [-- untouched arguments]"
-
-          o.on
-          o.on('-r', '--runner=RUNNER', RUNNERS,
-               "Use the given RUNNER.",
-               "(" + keyword_display(RUNNERS) + ")") do |r|
-            @runner = r
-          end
-
-          if(@standalone)
-            o.on('-b', '--basedir=DIR', "Base directory of test suites.") do |b|
-              @base = b
-            end
-
-            o.on('-w', '--workdir=DIR', "Working directory to run tests.") do |w|
-              @workdir = w
-            end
-
-            o.on('-a', '--add=TORUN', Array,
-                 "Add TORUN to the list of things to run;",
-                 "can be a file or a directory.") do |a|
-              @to_run.concat(a)
-            end
-
-            @pattern = []
-            o.on('-p', '--pattern=PATTERN', Regexp,
-                 "Match files to collect against PATTERN.") do |e|
-              @pattern << e
-            end
-
-            @exclude = []
-            o.on('-x', '--exclude=PATTERN', Regexp,
-                 "Ignore files to collect against PATTERN.") do |e|
-              @exclude << e
-            end
-          end
-
-          o.on('-n', '--name=NAME', String,
-               "Runs tests matching NAME.",
-               "(patterns may be used).") do |n|
-            n = (%r{\A/(.*)/\Z} =~ n ? Regexp.new($1) : n)
-            case n
-            when Regexp
-              @filters << proc{|t| n =~ t.method_name ? true : nil}
-            else
-              @filters << proc{|t| n == t.method_name ? true : nil}
-            end
-          end
-
-          o.on('-t', '--testcase=TESTCASE', String,
-               "Runs tests in TestCases matching TESTCASE.",
-               "(patterns may be used).") do |n|
-            n = (%r{\A/(.*)/\Z} =~ n ? Regexp.new($1) : n)
-            case n
-            when Regexp
-              @filters << proc{|t| n =~ t.class.name ? true : nil}
-            else
-              @filters << proc{|t| n == t.class.name ? true : nil}
-            end
-          end
-
-          o.on('-I', "--load-path=DIR[#{File::PATH_SEPARATOR}DIR...]",
-               "Appends directory list to $LOAD_PATH.") do |dirs|
-            $LOAD_PATH.concat(dirs.split(File::PATH_SEPARATOR))
-          end
-
-          o.on('-v', '--verbose=[LEVEL]', OUTPUT_LEVELS,
-               "Set the output level (default is verbose).",
-               "(" + keyword_display(OUTPUT_LEVELS) + ")") do |l|
-            @output_level = l || UI::VERBOSE
-          end
-
-          o.on('--',
-               "Stop processing options so that the",
-               "remaining options will be passed to the",
-               "test."){o.terminate}
-
-          o.on('-h', '--help', 'Display this help.'){puts o; exit}
-
-          o.on_tail
-          o.on_tail('Deprecated options:')
-
-          o.on_tail('--console', 'Console runner (use --runner).') do
-            warn("Deprecated option (--console).")
-            @runner = RUNNERS[:console]
-          end
-
-          o.on_tail('--gtk', 'GTK runner (use --runner).') do
-            warn("Deprecated option (--gtk).")
-            @runner = RUNNERS[:gtk]
-          end
-
-          o.on_tail('--fox', 'Fox runner (use --runner).') do
-            warn("Deprecated option (--fox).")
-            @runner = RUNNERS[:fox]
-          end
-
-          o.on_tail
-        end
-      end
-
-      def keyword_display(array)
-        list = array.collect {|e, *| e.to_s}
-        Array === array or list.sort!
-        list.collect {|e| e.sub(/^(.)([A-Za-z]+)(?=\w*$)/, '\\1[\\2]')}.join(", ")
-      end
-
-      def run
-        @suite = @collector[self]
-        result = @runner[self] or return false
-        Dir.chdir(@workdir) if @workdir
-        result.run(@suite, @output_level).passed?
-      end
-    end
-  end
-end
Index: lib/test/unit/assertionfailederror.rb
===================================================================
--- lib/test/unit/assertionfailederror.rb	(revision 19672)
+++ lib/test/unit/assertionfailederror.rb	(revision 19673)
@@ -1,14 +0,0 @@
-#--
-#
-# Author:: Nathaniel Talbott.
-# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
-# License:: Ruby license.
-
-module Test
-  module Unit
-
-    # Thrown by Test::Unit::Assertions when an assertion fails.
-    class AssertionFailedError < StandardError
-    end
-  end
-end
Index: lib/test/unit/collector.rb
===================================================================
--- lib/test/unit/collector.rb	(revision 19672)
+++ lib/test/unit/collector.rb	(revision 19673)
@@ -1,43 +0,0 @@
-module Test
-  module Unit
-    module Collector
-      def initialize
-        @filters = []
-      end
-
-      def filter=(filters)
-        @filters = case(filters)
-          when Proc
-            [filters]
-          when Array
-            filters
-        end
-      end
-
-      def add_suite(destination, suite)
-        to_delete = suite.tests.find_all{|t| !include?(t)}
-        to_delete.each{|t| suite.delete(t)}
-        destination << suite unless(suite.size == 0)
-      end
-
-      def include?(test)
-        return true if(@filters.empty?)
-        @filters.each do |filter|
-          result = filter[test]
-          if(result.nil?)
-            next
-          elsif(!result)
-            return false
-          else
-            return true
-          end
-        end
-        true
-      end
-
-      def sort(suites)
-        suites.sort_by{|s| s.name}
-      end
-    end
-  end
-end
Index: lib/test/unit/failure.rb
===================================================================
--- lib/test/unit/failure.rb	(revision 19672)
+++ lib/test/unit/failure.rb	(revision 19673)
@@ -1,51 +0,0 @@
-#--
-#
-# Author:: Nathaniel Talbott.
-# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
-# License:: Ruby license.
-
-module Test
-  module Unit
-
-    # Encapsulates a test failure. Created by Test::Unit::TestCase
-    # when an assertion fails.
-    class Failure
-      attr_reader :test_name, :location, :message
-      
-      SINGLE_CHARACTER = 'F'
-
-      # Creates a new Failure with the given location and
-      # message.
-      def initialize(test_name, location, message)
-        @test_name = test_name
-        @location = location
-        @message = message
-      end
-      
-      # Returns a single character representation of a failure.
-      def single_character_display
-        SINGLE_CHARACTER
-      end
-
-      # Returns a brief version of the error description.
-      def short_display
-        "#@test_name: #{@message.split("\n")[0]}"
-      end
-
-      # Returns a verbose version of the error description.
-      def long_display
-        location_display = if(location.size == 1)
-          location[0].sub(/\A(.+:\d+).*/, ' [\\1]')
-        else
-          "\n    [#{location.join("\n     ")}]"
-        end
-        "Failure:\n#@test_name#{location_display}:\n#@message"
-      end
-
-      # Overridden to return long_display.
-      def to_s
-        long_display
-      end
-    end
-  end
-end
Index: lib/test/unit/testsuite.rb
===================================================================
--- lib/test/unit/testsuite.rb	(revision 19672)
+++ lib/test/unit/testsuite.rb	(revision 19673)
@@ -1,76 +0,0 @@
-#--
-#
-# Author:: Nathaniel Talbott.
-# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
-# License:: Ruby license.
-
-module Test
-  module Unit
-
-    # A collection of tests which can be #run.
-    #
-    # Note: It is easy to confuse a TestSuite instance with
-    # something that has a static suite method; I know because _I_
-    # have trouble keeping them straight. Think of something that
-    # has a suite method as simply providing a way to get a
-    # meaningful TestSuite instance.
-    class TestSuite
-      attr_reader :name, :tests
-      
-      STARTED = name + "::STARTED"
-      FINISHED = name + "::FINISHED"
-
-      # Creates a new TestSuite with the given name.
-      def initialize(name="Unnamed TestSuite")
-        @name = name
-        @tests = []
-      end
-
-      # Runs the tests and/or suites contained in this
-      # TestSuite.
-      def run(result, &progress_block)
-        yield(STARTED, name)
-        @tests.each do |test|
-          test.run(result, &progress_block)
-        end
-        yield(FINISHED, name)
-      end
-
-      # Adds the test to the suite.
-      def <<(test)
-        @tests << test
-        self
-      end
-
-      def delete(test)
-        @tests.delete(test)
-      end
-
-      # Retuns the rolled up number of tests in this suite;
-      # i.e. if the suite contains other suites, it counts the
-      # tests within those suites, not the suites themselves.
-      def size
-        total_size = 0
-        @tests.each { |test| total_size += test.size }
-        total_size
-      end
-      
-      def empty?
-        tests.empty?
-      end
-
-      # Overridden to return the name given the suite at
-      # creation.
-      def to_s
-        @name
-      end
-      
-      # It's handy to be able to compare TestSuite instances.
-      def ==(other)
-        return false unless(other.kind_of?(self.class))
-        return false unless(@name == other.name)
-        @tests == other.tests
-      end
-    end
-  end
-end
Index: lib/test/unit/collector/dir.rb
===================================================================
--- lib/test/unit/collector/dir.rb	(revision 19672)
+++ lib/test/unit/collector/dir.rb	(revision 19673)
@@ -1,113 +0,0 @@
-require 'test/unit/testsuite'
-require 'test/unit/collector'
-
-module Test
-  module Unit
-    module Collector
-      class Dir
-        include Collector
-
-        attr_reader :pattern, :exclude
-        attr_accessor :base
-
-        def initialize(dir=::Dir, file=::File, object_space=nil, req=nil)
-          super()
-          @dir = dir
-          @file = file
-          @object_space = object_space
-          @req = req
-          @pattern = [/\btest_.*\.rb\Z/m]
-          @exclude = []
-        end
-
-        def collect(*from)
-          basedir = @base
-          $:.push(basedir) if basedir
-          if(from.empty?)
-            recursive_collect('.', find_test_cases)
-          elsif(from.size == 1)
-            recursive_collect(from.first, find_test_cases)
-          else
-            suites = []
-            from.each do |f|
-              suite = recursive_collect(f, find_test_cases)
-              suites << suite unless(suite.tests.empty?)
-            end
-            suite = TestSuite.new("[#{from.join(', ')}]")
-            sort(suites).each{|s| suite << s}
-            suite
-          end
-        ensure
-          $:.delete_at($:.rindex(basedir)) if basedir
-        end
-
-        def find_test_cases(ignore=[])
-          cases = []
-          if @object_space
-            @object_space.each_object(Class) do |c|
-              cases << c if(c < TestCase && !ignore.include?(c))
-            end
-          else
-            TestCase::DECENDANT_CLASSES.each do |c|
-              cases << c if !ignore.include?(c)
-            end
-          end
-          ignore.concat(cases)
-          cases
-        end
-
-        def recursive_collect(name, already_gathered)
-          sub_suites = []
-          path = realdir(name)
-          if @file.directory?(path)
-	    dir_name = name unless name == '.'
-            @dir.entries(path).each do |e|
-              next if(e == '.' || e == '..')
-              e_name = dir_name ? @file.join(dir_name, e) : e
-              if @file.directory?(realdir(e_name))
-                next if /\A(?:CVS|\.svn)\z/ =~ e
-                sub_suite = recursive_collect(e_name, already_gathered)
-                sub_suites << sub_suite unless(sub_suite.empty?)
-              else
-                next if /~\z/ =~ e_name or /\A\.\#/ =~ e
-                if @pattern and !@pattern.empty?
-                  next unless @pattern.any? {|pat| pat =~ e_name}
-                end
-                if @exclude and !@exclude.empty?
-                  next if @exclude.any? {|pat| pat =~ e_name}
-                end
-                collect_file(e_name, sub_suites, already_gathered)
-              end
-            end
-          else
-            collect_file(name, sub_suites, already_gathered)
-          end
-          suite = TestSuite.new(@file.basename(name))
-          sort(sub_suites).each{|s| suite << s}
-          suite
-        end
-
-        def collect_file(name, suites, already_gathered)
-          dir = @file.dirname(@file.expand_path(name, @base))
-          $:.unshift(dir)
-          if(@req)
-            @req.require(name)
-          else
-            require(name)
-          end
-          find_test_cases(already_gathered).each{|t| add_suite(suites, t.suite)}
-        ensure
-          $:.delete_at($:.index(dir)) if dir
-        end
-
-	def realdir(path)
-	  if @base
-	    @file.join(@base, path)
-	  else
-	    path
-	  end
-	end
-      end
-    end
-  end
-end
Index: lib/test/unit/collector/objectspace.rb
===================================================================
--- lib/test/unit/collector/objectspace.rb	(revision 19672)
+++ lib/test/unit/collector/objectspace.rb	(revision 19673)
@@ -1,40 +0,0 @@
-# Author:: Nathaniel Talbott.
-# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
-# License:: Ruby license.
-
-require 'test/unit/collector'
-
-module Test
-  module Unit
-    module Collector
-      class ObjectSpace
-        include Test::Unit::Collector
-        
-        NAME = 'collected from the subclasses of TestCase'
-        
-        def initialize(source=nil)
-          super()
-          @source = source
-        end
-        
-        def collect(name=NAME)
-          suite = TestSuite.new(name)
-          sub_suites = []
-          if @source
-            @source.each_object(Class) do |klass|
-              if(Test::Unit::TestCase > klass)
-                add_suite(sub_suites, klass.suite)
-              end
-            end
-          else
-            TestCase::DECENDANT_CLASSES.each do |klass|
-              add_suite(sub_suites, klass.suite)
-            end
-          end
-          sort(sub_suites).each{|s| suite << s}
-          suite
-        end
-      end
-    end
-  end
-end
Index: lib/test/unit/error.rb
===================================================================
--- lib/test/unit/error.rb	(revision 19672)
+++ lib/test/unit/error.rb	(revision 19673)
@@ -1,56 +1,17 @@
-#--
-#
-# Author:: Nathaniel Talbott.
-# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
-# License:: Ruby license.
+############################################################
+# This file is imported from a different project.
+# DO NOT make modifications in this repo.
+# File a patch instead and assign it to Ryan Davis
+############################################################
 
-require 'test/unit/util/backtracefilter'
+require 'test/unit/deprecate'
 
-module Test
-  module Unit
-
-    # Encapsulates an error in a test. Created by
-    # Test::Unit::TestCase when it rescues an exception thrown
-    # during the processing of a test.
-    class Error
-      include Util::BacktraceFilter
-
-      attr_reader(:test_name, :exception)
-
-      SINGLE_CHARACTER = 'E'
-
-      # Creates a new Error with the given test_name and
-      # exception.
-      def initialize(test_name, exception)
-        @test_name = test_name
-        @exception = exception
-      end
-
-      # Returns a single character representation of an error.
-      def single_character_display
-        SINGLE_CHARACTER
-      end
-
-      # Returns the message associated with the error.
-      def message
-        "#{@exception.class.name}: #{@exception.message}"
-      end
-
-      # Returns a brief version of the error description.
-      def short_display
-        "#@test_name: #{message.split("\n")[0]}"
-      end
-
-      # Returns a verbose version of the error description.
-      def long_display
-        backtrace = filter_backtrace(@exception.backtrace).join("\n    ")
-        "Error:\n#@test_name:\n#{message}\n    #{backtrace}"
-      end
-
-      # Overridden to return long_display.
-      def to_s
-        long_display
-      end
+# rails currently needs this file and this one method.
+module Test::Unit
+  class Error
+    def message
+      self.class.tu_deprecation_warning :message # 2009-06-01
+      "you're a loser"
     end
   end
 end
Index: lib/test/unit/assertions.rb
===================================================================
--- lib/test/unit/assertions.rb	(revision 19672)
+++ lib/test/unit/assertions.rb	(revision 19673)
@@ -1,622 +1,59 @@
-# Author:: Nathaniel Talbott.
-# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
-# License:: Ruby license.
+############################################################
+# This file is imported from a different project.
+# DO NOT make modifications in this repo.
+# File a patch instead and assign it to Ryan Davis
+############################################################
 
-require 'test/unit/assertionfailederror'
-require 'test/unit/util/backtracefilter'
+require 'mini/test'
+require 'test/unit/deprecate'
 
-module Test # :nodoc:
-  module Unit # :nodoc:
+module Test; end
+module Test::Unit # patch up bastards that that extend improperly.
+  if defined? Assertions then
+    warn "ARGH! someone defined Test::Unit::Assertions rather than requiring"
+    CRAP_ASSERTIONS = Assertions
+    remove_const :Assertions
 
-    ##
-    # Test::Unit::Assertions contains the standard Test::Unit assertions.
-    # Assertions is included in Test::Unit::TestCase.
-    #
-    # To include it in your own code and use its functionality, you simply
-    # need to rescue Test::Unit::AssertionFailedError. Additionally you may
-    # override add_assertion to get notified whenever an assertion is made.
-    #
-    # Notes:
-    # * The message to each assertion, if given, will be propagated with the
-    #   failure.
-    # * It is easy to add your own assertions based on assert_block().
-    #
-    # = Example Custom Assertion
-    #
-    #   def deny(boolean, message = nil)
-    #     message = build_message message, '<?> is not false or nil.', boolean
-    #     assert_block message do
-    #       not boolean
-    #     end
-    #   end
+    # this will break on junit and rubinius... *sigh*
+    ObjectSpace.each_object(Module) do |offender|
+      offender.send :include, ::Mini::Assertions if offender < CRAP_ASSERTIONS
+    end rescue nil
 
-    module Assertions
+    Test::Unit::TestCase.send :include, CRAP_ASSERTIONS
+  end
 
-      ##
-      # The assertion upon which all other assertions are based. Passes if the
-      # block yields true.
-      #
-      # Example:
-      #   assert_block "Couldn't do the thing" do
-      #     do_the_thing
-      #   end
+  Assertions = ::Mini::Assertions
 
-      public
-      def assert_block(message="assert_block failed.") # :yields: 
-        _wrap_assertion do
-          if (! yield)
-            raise AssertionFailedError.new(message.to_s)
-          end
-        end
-      end
+  module Assertions
+    def self.included mod
+      mod.send :include, Test::Unit::CRAP_ASSERTIONS
+    end if defined? Test::Unit::CRAP_ASSERTIONS
+  end
+end
 
-      ##
-      # Asserts that +boolean+ is not false or nil.
-      #
-      # Example:
-      #   assert [1, 2].include?(5)
+module Test::Unit
+  module Assertions # deprecations
+    tu_deprecate :assert_nothing_thrown, :assert_nothing_raised # 2009-06-01
+    tu_deprecate :assert_raise,          :assert_raises         # 2010-06-01
+    tu_deprecate :assert_not_equal,      :refute_equal          # 2009-06-01
+    tu_deprecate :assert_no_match,       :refute_match          # 2009-06-01
+    tu_deprecate :assert_not_nil,        :refute_nil            # 2009-06-01
+    tu_deprecate :assert_not_same,       :refute_same           # 2009-06-01
 
-      public
-      def assert(boolean, message=nil)
-        _wrap_assertion do
-          assert_block("assert should not be called with a block.") { !block_given? }
-          assert_block(build_message(message, "<?> is not true.", boolean)) { boolean }
-        end
-      end
+    def assert_nothing_raised _ = :ignored                      # 2009-06-01
+      self.class.tu_deprecation_warning :assert_nothing_raised
+      self._assertions += 1
+      yield
+    rescue => e
+      raise Mini::Assertion, exception_details(e, "Exception raised:")
+    end
 
-      ##
-      # Passes if +expected+ == +actual.
-      #
-      # Note that the ordering of arguments is important, since a helpful
-      # error message is generated when this one fails that tells you the
-      # values of expected and actual.
-      #
-      # Example:
-      #   assert_equal 'MY STRING', 'my string'.upcase
-
-      public
-      def assert_equal(expected, actual, message=nil)
-        full_message = build_message(message, <<EOT, expected, actual)
-<?> expected but was
-<?>.
-EOT
-        assert_block(full_message) { expected == actual }
-      end
-
-      private
-      def _check_exception_class(args) # :nodoc:
-        args.partition do |klass|
-          next if klass.instance_of?(Module)
-          assert(Exception >= klass, "Should expect a class of exception, #{klass}")
-          true
-        end
-      end
-
-      private
-      def _expected_exception?(actual_exception, exceptions, modules) # :nodoc:
-        exceptions.include?(actual_exception.class) or
-          modules.any? {|mod| actual_exception.is_a?(mod)}
-      end
-
-      ##
-      # Passes if the block raises one of the given exceptions.
-      #
-      # Example:
-      #   assert_raise RuntimeError, LoadError do
-      #     raise 'Boom!!!'
-      #   end
-
-      public
-      def assert_raise(*args)
-        _wrap_assertion do
-          if Module === args.last
-            message = ""
-          else
-            message = args.pop
-          end
-          exceptions, modules = _check_exception_class(args)
-          expected = args.size == 1 ? args.first : args
-          actual_exception = nil
-          full_message = build_message(message, "<?> exception expected but none was thrown.", expected)
-          assert_block(full_message) do
-            begin
-              yield
-            rescue Exception => actual_exception
-              break
-            end
-            false
-          end
-          full_message = build_message(message, "<?> exception expected but was\n?", expected, actual_exception)
-          assert_block(full_message) {_expected_exception?(actual_exception, exceptions, modules)}
-          actual_exception
-        end
-      end
-
-      ##
-      # Alias of assert_raise.
-      #
-      # Will be deprecated in 1.9, and removed in 2.0.
-
-      public
-      def assert_raises(*args, &block)
-        assert_raise(*args, &block)
-      end
-
-      ##
-      # Passes if +object+ .instance_of? +klass+
-      #
-      # Example:
-      #   assert_instance_of String, 'foo'
-
-      public
-      def assert_instance_of(klass, object, message="")
-        _wrap_assertion do
-          assert_equal(Class, klass.class, "assert_instance_of takes a Class as its first argument")
-          full_message = build_message(message, <<EOT, object, klass, object.class)
-<?> expected to be an instance of
-<?> but was
-<?>.
-EOT
-          assert_block(full_message){object.instance_of?(klass)}
-        end
-      end
-
-      ##
-      # Passes if +object+ is nil.
-      #
-      # Example:
-      #   assert_nil [1, 2].uniq!
-
-      public
-      def assert_nil(object, message="")
-        assert_equal(nil, object, message)
-      end
-
-      ##
-      # Passes if +object+ .kind_of? +klass+
-      #
-      # Example:
-      #   assert_kind_of Object, 'foo'
-
-      public
-      def assert_kind_of(klass, object, message="")
-        _wrap_assertion do
-          assert(klass.kind_of?(Module), "The first parameter to assert_kind_of should be a kind_of Module.")
-          full_message = build_message(message, "<?>\nexpected to be kind_of\\?\n<?> but was\n<?>.", object, klass, object.class)
-          assert_block(full_message){object.kind_of?(klass)}
-        end
-      end
-
-      ##
-      # Passes if +object+ .respond_to? +method+
-      #
-      # Example:
-      #   assert_respond_to 'bugbear', :slice
-
-      public
-      def assert_respond_to(object, method, message="")
-        _wrap_assertion do
-          full_message = build_message(nil, "<?>\ngiven as the method name argument to #assert_respond_to must be a Symbol or #respond_to\\?(:to_str).", method)
-
-          assert_block(full_message) do
-            method.kind_of?(Symbol) || method.respond_to?(:to_str)
-          end
-          full_message = build_message(message, <<EOT, object, object.class, method)
-<?>
-of type <?>
-expected to respond_to\\?<?>.
-EOT
-          assert_block(full_message) { object.respond_to?(method) }
-        end
-      end
-
-      ##
-      # Passes if +string+ =~ +pattern+.
-      #
-      # Example:
-      #   assert_match(/\d+/, 'five, 6, seven')
-
-      public
-      def assert_match(pattern, string, message="")
-        _wrap_assertion do
-          pattern = case(pattern)
-            when String
-              Regexp.new(Regexp.escape(pattern))
-            else
-              pattern
-          end
-          full_message = build_message(message, "<?> expected to be =~\n<?>.", string, pattern)
-          assert_block(full_message) { string =~ pattern }
-        end
-      end
-
-      ##
-      # Passes if +actual+ .equal? +expected+ (i.e. they are the same
-      # instance).
-      #
-      # Example:
-      #   o = Object.new
-      #   assert_same o, o
-
-      public
-      def assert_same(expected, actual, message="")
-        full_message = build_message(message, <<EOT, expected, expected.__id__, actual, actual.__id__)
-<?>
-with id <?> expected to be equal\\? to
-<?>
-with id <?>.
-EOT
-        assert_block(full_message) { actual.equal?(expected) }
-      end
-
-      ##
-      # Compares the +object1+ with +object2+ using +operator+.
-      #
-      # Passes if object1.__send__(operator, object2) is true.
-      #
-      # Example:
-      #   assert_operator 5, :>=, 4
-
-      public
-      def assert_operator(object1, operator, object2, message="")
-        _wrap_assertion do
-          full_message = build_message(nil, "<?>\ngiven as the operator for #assert_operator must be a Symbol or #respond_to\\?(:to_str).", operator)
-          assert_block(full_message){operator.kind_of?(Symbol) || operator.respond_to?(:to_str)}
-          full_message = build_message(message, <<EOT, object1, AssertionMessage.literal(operator), object2)
-<?> expected to be
-?
-<?>.
-EOT
-          assert_block(full_message) { object1.__send__(operator, object2) }
-        end
-      end
-
-      ##
-      # Passes if block does not raise an exception.
-      #
-      # Example:
-      #   assert_nothing_raised do
-      #     [1, 2].uniq
-      #   end
-
-      public
-      def assert_nothing_raised(*args)
-        _wrap_assertion do
-          if Module === args.last
-            message = ""
-          else
-            message = args.pop
-          end
-          exceptions, modules = _check_exception_class(args)
-          begin
-            yield
-          rescue Exception => e
-            if ((args.empty? && !e.instance_of?(AssertionFailedError)) ||
-                _expected_exception?(e, exceptions, modules))
-              assert_block(build_message(message, "Exception raised:\n?", e)){false}
-            else
-              raise
-            end
-          end
-          nil
-        end
-      end
-
-      ##
-      # Flunk always fails.
-      #
-      # Example:
-      #   flunk 'Not done testing yet.'
-
-      public
-      def flunk(message="Flunked")
-        assert_block(build_message(message)){false}
-      end
-
-      ##
-      # Passes if ! +actual+ .equal? +expected+
-      #
-      # Example:
-      #   assert_not_same Object.new, Object.new
-
-      public
-      def assert_not_same(expected, actual, message="")
-        full_message = build_message(message, <<EOT, expected, expected.__id__, actual, actual.__id__)
-<?>
-with id <?> expected to not be equal\\? to
-<?>
-with id <?>.
-EOT
-        assert_block(full_message) { !actual.equal?(expected) }
-      end
-
-      ##
-      # Passes if +expected+ != +actual+
-      #
-      # Example:
-      #   assert_not_equal 'some string', 5
-
-      public
-      def assert_not_equal(expected, actual, message="")
-        full_message = build_message(message, "<?> expected to be != to\n<?>.", expected, actual)
-        assert_block(full_message) { expected != actual }
-      end
-
-      ##
-      # Passes if ! +object+ .nil?
-      #
-      # Example:
-      #   assert_not_nil '1 two 3'.sub!(/two/, '2')
-
-      public
-      def assert_not_nil(object, message="")
-        full_message = build_message(message, "<?> expected to not be nil.", object)
-        assert_block(full_message){!object.nil?}
-      end
-
-      ##
-      # Passes if +regexp+ !~ +string+ 
-      #
-      # Example:
-      #   assert_no_match(/two/, 'one 2 three')
-
-      public
-      def assert_no_match(regexp, string, message="")
-        _wrap_assertion do
-          assert_instance_of(Regexp, regexp, "The first argument to assert_no_match should be a Regexp.")
-          full_message = build_message(message, "<?> expected to not match\n<?>.", regexp, string)
-          assert_block(full_message) { regexp !~ string }
-        end
-      end
-
-      UncaughtThrow = {
-        ArgumentError => /^uncaught throw (.+)$/,
-      } #`
-
-      ##
-      # Passes if the block throws +expected_object+
-      #
-      # Example:
-      #   assert_throws :done do
-      #     throw :done
-      #   end
-
-      public
-      def assert_throws(expected_object, message="", &proc)
-        _wrap_assertion do
-          assert_block("Should have passed a block to assert_throws."){block_given?}
-          caught = true
-          begin
-            catch(expected_object) do
-              proc.call
-              caught = false
-            end
-            full_message = build_message(message, "<?> should have been thrown.", expected_object)
-            assert_block(full_message){caught}
-          rescue ArgumentError => error
-            if UncaughtThrow[error.class] !~ error.message
-              raise error
-            end
-            full_message = build_message(message, "<?> expected to be thrown but\n<#$1> was thrown.", expected_object)
-            flunk(full_message)
-          end
-        end
-      end
-
-      ##
-      # Passes if block does not throw anything.
-      #
-      # Example:
-      #  assert_nothing_thrown do
-      #    [1, 2].uniq
-      #  end
-
-      public
-      def assert_nothing_thrown(message="", &proc)
-        _wrap_assertion do
-          assert(block_given?, "Should have passed a block to assert_nothing_thrown")
-          begin
-            proc.call
-          rescue ArgumentError => error
-            if UncaughtThrow[error.class] !~ error.message
-              raise error
-            end
-            full_message = build_message(message, "<#$1> was thrown when nothing was expected")
-            flunk(full_message)
-          end
-          assert(true, "Expected nothing to be thrown")
-        end
-      end
-
-      ##
-      # Passes if +expected_float+ and +actual_float+ are equal
-      # within +delta+ tolerance.
-      #
-      # Example:
-      #   assert_in_delta 0.05, (50000.0 / 10**6), 0.00001
-
-      public
-      def assert_in_delta(expected_float, actual_float, delta, message="")
-        _wrap_assertion do
-          {expected_float => "first float", actual_float => "second float", delta => "delta"}.each do |float, name|
-            assert_respond_to(float, :to_f, "The arguments must respond to to_f; the #{name} did not")
-          end
-          assert_operator(delta, :>=, 0.0, "The delta should not be negative")
-          full_message = build_message(message, <<EOT, expected_float, actual_float, delta)
-<?> and
-<?> expected to be within
-<?> of each other.
-EOT
-          assert_block(full_message) { (expected_float.to_f - actual_float.to_f).abs <= delta.to_f }
-        end
-      end
-
-      ##
-      # Passes if the method send returns a true value.
-      #
-      # +send_array+ is composed of:
-      # * A receiver
-      # * A method
-      # * Arguments to the method
-      #
-      # Example:
-      #   assert_send [[1, 2], :include?, 4]
-
-      public
-      def assert_send(send_array, message="")
-        _wrap_assertion do
-          assert_instance_of(Array, send_array, "assert_send requires an array of send information")
-          assert(send_array.size >= 2, "assert_send requires at least a receiver and a message name")
-          full_message = build_message(message, <<EOT, send_array[0], AssertionMessage.literal(send_array[1].to_s), send_array[2..-1])
-<?> expected to respond to
-<?(?)> with a true value.
-EOT
-          assert_block(full_message) { send_array[0].__send__(send_array[1], *send_array[2..-1]) }
-        end
-      end
-
-      ##
-      # Builds a failure message.  +head+ is added before the +template+ and
-      # +arguments+ replaces the '?'s positionally in the template.
-
-      public
-      def build_message(head, template=nil, *arguments) # :nodoc:
-        template &&= template.chomp
-        return AssertionMessage.new(head, template, arguments)
-      end
-
-      private
-      def _wrap_assertion # :nodoc:
-        @_assertion_wrapped ||= false
-        unless (@_assertion_wrapped)
-          @_assertion_wrapped = true
-          begin
-            add_assertion
-            return yield
-          ensure
-            @_assertion_wrapped = false
-          end
-        else
-          return yield
-        end
-      end
-      
-      ##
-      # Called whenever an assertion is made.  Define this in classes that
-      # include Test::Unit::Assertions to record assertion counts.
-
-      private
-      def add_assertion
-      end
-
-      ##
-      # Select whether or not to use the pretty-printer. If this option is set
-      # to false before any assertions are made, pp.rb will not be required.
-
-      public
-      def self.use_pp=(value)
-        AssertionMessage.use_pp = value
-      end
-      
-      # :stopdoc:
-
-      class AssertionMessage
-        @use_pp = true
-        class << self
-          attr_accessor :use_pp
-        end
-
-        class Literal
-          def initialize(value)
-            @value = value
-          end
-          
-          def inspect
-            @value.to_s
-          end
-        end
-
-        class Template
-          def self.create(string)
-            parts = (string ? string.scan(/(?=[^\\])\?|(?:\\\?|[^\?])+/m) : [])
-            self.new(parts)
-          end
-
-          attr_reader :count
-
-          def initialize(parts)
-            @parts = parts
-            @count = parts.find_all{|e| e == '?'}.size
-          end
-
-          def result(parameters)
-            raise "The number of parameters does not match the number of substitutions." if(parameters.size != count)
-            params = parameters.dup
-            @parts.collect{|e| e == '?' ? params.shift : e.gsub(/\\\?/m, '?')}.join('')
-          end
-        end
-
-        def self.literal(value)
-          Literal.new(value)
-        end
-
-        include Util::BacktraceFilter
-
-        def initialize(head, template_string, parameters)
-          @head = head
-          @template_string = template_string
-          @parameters = parameters
-        end
-
-        def convert(object)
-          case object
-            when Exception
-              <<EOM.chop
-Class: <#{convert(object.class)}>
-Message: <#{convert(object.message)}>
----Backtrace---
-#{filter_backtrace(object.backtrace).join("\n")}
----------------
-EOM
-            else
-              if(self.class.use_pp)
-                begin
-                  require 'pp'
-                rescue LoadError
-                  self.class.use_pp = false
-                  return object.inspect
-                end unless(defined?(PP))
-                PP.pp(object, '').chomp
-              else
-                object.inspect
-              end
-          end
-        end
-
-        def template
-          @template ||= Template.create(@template_string)
-        end
-
-        def add_period(string)
-          (string =~ /\.\Z/ ? string : string + '.')
-        end
-
-        def to_s
-          message_parts = []
-          if (@head)
-            head = @head.to_s 
-            unless(head.empty?)
-              message_parts << add_period(head)
-            end
-          end
-          tail = template.result(@parameters.collect{|e| convert(e)})
-          message_parts << tail unless(tail.empty?)
-          message_parts.join("\n")
-        end
-      end
-
-      # :startdoc:
-
+    def build_message(user_message, template_message, *args)    # 2009-06-01
+      self.class.tu_deprecation_warning :build_message
+      user_message ||= ''
+      user_message += ' ' unless user_message.empty?
+      msg = template_message.split(/<\?>/).zip(args.map { |o| o.inspect })
+      user_message + msg.join
     end
   end
 end
Index: lib/test/unit/testcase.rb
===================================================================
--- lib/test/unit/testcase.rb	(revision 19672)
+++ lib/test/unit/testcase.rb	(revision 19673)
@@ -1,163 +1,31 @@
-#--
-#
-# Author:: Nathaniel Talbott.
-# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
-# License:: Ruby license.
+############################################################
+# This file is imported from a different project.
+# DO NOT make modifications in this repo.
+# File a patch instead and assign it to Ryan Davis
+############################################################
 
-require 'test/unit/assertions'
-require 'test/unit/failure'
-require 'test/unit/error'
-require 'test/unit/testsuite'
-require 'test/unit/assertionfailederror'
-require 'test/unit/util/backtracefilter'
+require 'mini/test'
+require 'test/unit/deprecate'
 
-module Test
-  module Unit
+warn "require 'test/unit/testcase' has been deprecated" unless
+  caller.first =~ /test.unit.rb/
 
-    # Ties everything together. If you subclass and add your own
-    # test methods, it takes care of making them into tests and
-    # wrapping those tests into a suite. It also does the
-    # nitty-gritty of actually running an individual test and
-    # collecting its results into a Test::Unit::TestResult object.
-    class TestCase
-      include Assertions
-      include Util::BacktraceFilter
-      
-      attr_reader :method_name
-      
-      STARTED = name + "::STARTED"
-      FINISHED = name + "::FINISHED"
+module Test; end
+module Test::Unit # was ::Mini::Test, but rails' horrid code forced my hand
+  if defined? TestCase then
+    warn "ARGH! someone defined Test::Unit::TestCase rather than requiring"
+    remove_const :TestCase
+  end
 
-      ##
-      # These exceptions are not caught by #run.
+  AssertionFailedError = ::Mini::Assertion
 
-      PASSTHROUGH_EXCEPTIONS = [NoMemoryError, SignalException, Interrupt,
-                                SystemExit]
+  class TestCase < ::Mini::Test::TestCase
+    tu_deprecate :method_name, :name # 2009-06-01
 
-      DECENDANT_CLASSES = []
-      def self.inherited(decendant)
-        DECENDANT_CLASSES << decendant
-      end
-
-      # Creates a new instance of the fixture for running the
-      # test represented by test_method_name.
-      def initialize(test_method_name)
-        unless(respond_to?(test_method_name) && method(test_method_name).arity == 0)
-          throw :invalid_test
-        end
-        @method_name = test_method_name
-        @test_passed = true
-      end
-
-      # Rolls up all of the test* methods in the fixture into
-      # one suite, creating a new instance of the fixture for
-      # each method.
-      def self.suite
-        method_names = public_instance_methods(true).map { |m| m.to_s }
-        tests = method_names.delete_if {|method_name| method_name !~ /^test./}
-        suite = TestSuite.new(name)
-        tests.sort.each do
-          |test|
-          catch(:invalid_test) do
-            suite << new(test)
-          end
-        end
-        if (suite.empty?)
-          catch(:invalid_test) do
-            suite << new(:default_test)
-          end
-        end
-        return suite
-      end
-
-      # Runs the individual test method represented by this
-      # instance of the fixture, collecting statistics, failures
-      # and errors in result.
-      def run(result)
-        yield(STARTED, name)
-        @_result = result
-        begin
-          setup
-          __send__(@method_name)
-        rescue AssertionFailedError => e
-          add_failure(e.message, e.backtrace)
-        rescue Exception
-          raise if PASSTHROUGH_EXCEPTIONS.include? $!.class
-          add_error($!)
-        ensure
-          begin
-            teardown
-          rescue AssertionFailedError => e
-            add_failure(e.message, e.backtrace)
-          rescue Exception
-            raise if PASSTHROUGH_EXCEPTIONS.include? $!.class
-            add_error($!)
-          end
-        end
-        result.add_run
-        yield(FINISHED, name)
-      end
-
-      # Called before every test method runs. Can be used
-      # to set up fixture information.
-      def setup
-      end
-
-      # Called after every test method runs. Can be used to tear
-      # down fixture information.
-      def teardown
-      end
-      
-      def default_test
-        flunk("No tests were specified")
-      end
-
-      # Returns whether this individual test passed or
-      # not. Primarily for use in teardown so that artifacts
-      # can be left behind if the test fails.
-      def passed?
-        return @test_passed
-      end
-      private :passed?
-
-      def size # :nodoc:
-        1
-      end
-
-      def add_assertion # :nodoc:
-        @_result.add_assertion
-      end
-      private :add_assertion
-
-      def add_failure(message, all_locations=caller()) # :nodoc:
-        @test_passed = false
-        @_result.add_failure(Failure.new(name, filter_backtrace(all_locations), message))
-      end
-      private :add_failure
-
-      def add_error(exception) # :nodoc:
-        @test_passed = false
-        @_result.add_error(Error.new(name, exception))
-      end
-      private :add_error
-
-      # Returns a human-readable name for the specific test that
-      # this instance of TestCase represents.
-      def name
-        "#{@method_name}(#{self.class.name})"
-      end
-
-      # Overridden to return #name.
-      def to_s
-        name
-      end
-      
-      # It's handy to be able to compare TestCase instances.
-      def ==(other)
-        return false unless(other.kind_of?(self.class))
-        return false unless(@method_name == other.method_name)
-        self.class == other.class
-      end
+    def self.test_order              # 2009-06-01
+      :sorted
     end
   end
 end
+
+require 'test/unit/assertions' # brings in deprecated methods
Index: lib/test/unit/ui/testrunnermediator.rb
===================================================================
--- lib/test/unit/ui/testrunnermediator.rb	(revision 19672)
+++ lib/test/unit/ui/testrunnermediator.rb	(revision 19673)
@@ -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
Index: lib/test/unit/ui/testrunnerutilities.rb
===================================================================
--- lib/test/unit/ui/testrunnerutilities.rb	(revision 19672)
+++ lib/test/unit/ui/testrunnerutilities.rb	(revision 19673)
@@ -1,46 +0,0 @@
-#--
-#
-# Author:: Nathaniel Talbott.
-# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
-# License:: Ruby license.
-
-module Test
-  module Unit
-    module UI
-
-      SILENT = 0
-      PROGRESS_ONLY = 1
-      NORMAL = 2
-      VERBOSE = 3
-
-      # Provides some utilities common to most, if not all,
-      # TestRunners.
-      #
-      #--
-      #
-      # Perhaps there ought to be a TestRunner superclass? There
-      # seems to be a decent amount of shared code between test
-      # runners.
-
-      module TestRunnerUtilities
-
-        # Creates a new TestRunner and runs the suite.
-        def run(suite, output_level=NORMAL)
-          return new(suite, output_level).start
-        end
-
-        # Takes care of the ARGV parsing and suite
-        # determination necessary for running one of the
-        # TestRunners from the command line.
-        def start_command_line_test
-          if ARGV.empty?
-            puts "You should supply the name of a test suite file to the runner"
-            exit
-          end
-          require ARGV[0].gsub(/.+::/, '')
-          new(eval(ARGV[0])).start
-        end
-      end
-    end
-  end
-end
Index: lib/test/unit/ui/console/testrunner.rb
===================================================================
--- lib/test/unit/ui/console/testrunner.rb	(revision 19672)
+++ lib/test/unit/ui/console/testrunner.rb	(revision 19673)
@@ -1,130 +0,0 @@
-#--
-#
-# Author:: Nathaniel Talbott.
-# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
-# License:: Ruby license.
-
-require 'test/unit/ui/testrunnermediator'
-require 'test/unit/ui/testrunnerutilities'
-
-module Test
-  module Unit
-    module UI
-      module Console # :nodoc:
-
-        # Runs a Test::Unit::TestSuite on the console.
-        class TestRunner
-          extend TestRunnerUtilities
-
-          # Creates a new TestRunner for running the passed
-          # suite. If quiet_mode is true, the output while
-          # running is limited to progress dots, errors and
-          # failures, and the final result. io specifies
-          # where runner output should go to; defaults to
-          # STDOUT.
-          def initialize(suite, output_level=NORMAL, io=STDOUT)
-            if (suite.respond_to?(:suite))
-              @suite = suite.suite
-            else
-              @suite = suite
-            end
-            @output_level = output_level
-            @io = io
-            @already_outputted = false
-            @faults = []
-          end
-
-          # Begins the test run.
-          def start
-            setup_mediator
-            attach_to_mediator
-            return start_mediator
-          end
-
-          private
-          def setup_mediator # :nodoc:
-            @mediator = create_mediator(@suite)
-            suite_name = @suite.to_s
-            if ( @suite.kind_of?(Module) )
-              suite_name = @suite.name
-            end
-            output("Loaded suite #{suite_name}")
-          end
-          
-          def create_mediator(suite) # :nodoc:
-            return TestRunnerMediator.new(suite)
-          end
-          
-          def attach_to_mediator # :nodoc:
-            @mediator.add_listener(TestResult::FAULT, &method(:add_fault))
-            @mediator.add_listener(TestRunnerMediator::STARTED, &method(:started))
-            @mediator.add_listener(TestRunnerMediator::FINISHED, &method(:finished))
-            @mediator.add_listener(TestCase::STARTED, &method(:test_started))
-            @mediator.add_listener(TestCase::FINISHED, &method(:test_finished))
-          end
-          
-          def start_mediator # :nodoc:
-            return @mediator.run_suite
-          end
-          
-          def add_fault(fault) # :nodoc:
-            @faults << fault
-            output_single(fault.single_character_display, PROGRESS_ONLY)
-            @already_outputted = true
-          end
-          
-          def started(result)
-            @result = result
-            output("Started")
-          end
-          
-          def finished(elapsed_time)
-            nl
-            output("Finished in #{elapsed_time} seconds.")
-            @faults.each_with_index do |fault, index|
-              nl
-              output("%3d) %s" % [index + 1, fault.long_display])
-            end
-            nl
-            output(@result)
-          end
-          
-          def test_started(name)
-            $program_name = $0
-            alias $0 $program_name
-            $PROGRAM_NAME += "\0#{name}"
-            output_single(name + ": ", VERBOSE)
-          end
-          
-          def test_finished(name)
-            output_single(".", PROGRESS_ONLY) unless (@already_outputted)
-            nl(VERBOSE)
-            @already_outputted = false
-          end
-          
-          def nl(level=NORMAL)
-            output("", level)
-          end
-          
-          def output(something, level=NORMAL)
-            @io.puts(something) if (output?(level))
-            @io.flush
-          end
-          
-          def output_single(something, level=NORMAL)
-            @io.write(something) if (output?(level))
-            @io.flush
-          end
-          
-          def output?(level)
-            level <= @output_level
-          end
-        end
-      end
-    end
-  end
-end
-
-if __FILE__ == $0
-  Test::Unit::UI::Console::TestRunner.start_command_line_test
-end
Index: lib/test/unit/ui/gtk/testrunner.rb
===================================================================
--- lib/test/unit/ui/gtk/testrunner.rb	(revision 19672)
+++ lib/test/unit/ui/gtk/testrunner.rb	(revision 19673)
@@ -1,416 +0,0 @@
-#--
-#
-# Author:: Nathaniel Talbott.
-# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
-# License:: Ruby license.
-
-require 'gtk'
-require 'test/unit/ui/testrunnermediator'
-require 'test/unit/ui/testrunnerutilities'
-
-module Test
-  module Unit
-    module UI
-      module GTK # :nodoc:
-
-        # Runs a Test::Unit::TestSuite in a Gtk UI. Obviously,
-        # this one requires you to have Gtk
-        # (http://www.gtk.org/) and the Ruby Gtk extension
-        # (http://ruby-gnome.sourceforge.net/) installed.
-        class TestRunner
-          extend TestRunnerUtilities
-
-          # Creates a new TestRunner for running the passed
-          # suite.
-          def initialize(suite, output_level = NORMAL)
-            if (suite.respond_to?(:suite))
-              @suite = suite.suite
-            else
-              @suite = suite
-            end
-            @result = nil
-
-            @runner = Thread.current
-            @restart_signal = Class.new(Exception)
-            @viewer = Thread.start do
-              @runner.join rescue @runner.run
-              Gtk.main
-            end
-            @viewer.join rescue nil # wait deadlock to handshake
-          end
-
-          # Begins the test run.
-          def start
-            setup_mediator
-            setup_ui
-            attach_to_mediator
-            start_ui
-            @result
-          end
-
-          private
-          def setup_mediator # :nodoc:
-            @mediator = TestRunnerMediator.new(@suite)
-            suite_name = @suite.to_s
-            if ( @suite.kind_of?(Module) )
-              suite_name = @suite.name
-            end
-            suite_name_entry.set_text(suite_name)
-          end
-          
-          def attach_to_mediator # :nodoc:
-            run_button.signal_connect("clicked", nil, &method(:run_test))
-            @mediator.add_listener(TestRunnerMediator::RESET, &method(:reset_ui))
-            @mediator.add_listener(TestResult::FAULT, &method(:add_fault))
-            @mediator.add_listener(TestResult::CHANGED, &method(:result_changed))
-            @mediator.add_listener(TestRunnerMediator::STARTED, &method(:started))
-            @mediator.add_listener(TestCase::STARTED, &method(:test_started))
-            @mediator.add_listener(TestCase::FINISHED, &method(:test_finished))
-            @mediator.add_listener(TestRunnerMediator::FINISHED, &method(:finished))
-          end
-
-          def run_test(*)
-            @runner.raise(@restart_signal)
-          end
-          
-          def start_ui # :nodoc:
-            @viewer.run
-            running = false
-            begin
-              loop do
-                if (running ^= true)
-                  run_button.child.text = "Stop"
-                  @mediator.run_suite
-                else
-                  run_button.child.text = "Run"
-                  @viewer.join
-                  break
-                end
-              end
-            rescue @restart_signal
-              retry
-            rescue
-            end
-          end
-          
-          def stop(*) # :nodoc:
-            Gtk.main_quit
-          end
-          
-          def reset_ui(count) # :nodoc:
-            test_progress_bar.set_style(green_style)
-            test_progress_bar.configure(0, 0, count)
-            @red = false
-  
-            run_count_label.set_text("0")
-            assertion_count_label.set_text("0")
-            failure_count_label.set_text("0")
-            error_count_label.set_text("0")
-  
-            fault_list.remove_items(fault_list.children)
-          end
-          
-          def add_fault(fault) # :nodoc:
-            if ( ! @red )
-              test_progress_bar.set_style(red_style)
-              @red = true
-            end
-            item = FaultListItem.new(fault)
-            item.show
-            fault_list.append_items([item])
-          end
-          
-          def show_fault(fault) # :nodoc:
-            raw_show_fault(fault.long_display)
-          end
-          
-          def raw_show_fault(string) # :nodoc:
-            fault_detail_label.set_text(string)
-            outer_detail_sub_panel.queue_resize
-          end
-          
-          def clear_fault # :nodoc:
-            raw_show_fault("")
-          end
-          
-          def result_changed(result) # :nodoc:
-            run_count_label.set_text(result.run_count.to_s)
-            assertion_count_label.set_text(result.assertion_count.to_s)
-            failure_count_label.set_text(result.failure_count.to_s)
-            error_count_label.set_text(result.error_count.to_s)
-          end
-          
-          def started(result) # :nodoc:
-            @result = result
-            output_status("Started...")
-          end
-          
-          def test_started(test_name)
-            output_status("Running #{test_name}...")
-          end
-          
-          def test_finished(test_name)
-            test_progress_bar.set_value(test_progress_bar.get_value + 1)
-          end
-          
-          def finished(elapsed_time)
-            output_status("Finished in #{elapsed_time} seconds")
-          end
-          
-          def output_status(string) # :nodoc:
-            status_entry.set_text(string)
-          end
-  
-          def setup_ui # :nodoc:
-            main_window.signal_connect("destroy", nil, &method(:stop))
-            main_window.show_all
-            fault_list.signal_connect("select-child", nil) {
-              | list, item, data |
-              show_fault(item.fault)
-            }
-            fault_list.signal_connect("unselect-child", nil) {
-              clear_fault
-            }
-            @red = false
-          end
-          
-          def main_window # :nodoc:
-            lazy_initialize(:main_window) {
-              @main_window = Gtk::Window.new(Gtk::WINDOW_TOPLEVEL)
-              @main_window.set_title("Test::Unit TestRunner")
-              @main_window.set_usize(800, 600)
-              @main_window.set_uposition(20, 20)
-              @main_window.set_policy(true, true, false)
-              @main_window.add(main_panel)
-            }
-          end
-          
-          def main_panel # :nodoc:
-            lazy_initialize(:main_panel) {
-              @main_panel = Gtk::VBox.new(false, 0)
-              @main_panel.pack_start(suite_panel, false, false, 0)
-              @main_panel.pack_start(progress_panel, false, false, 0)
-              @main_panel.pack_start(info_panel, false, false, 0)
-              @main_panel.pack_start(list_panel, false, false, 0)
-              @main_panel.pack_start(detail_panel, true, true, 0)
-              @main_panel.pack_start(status_panel, false, false, 0)
-            }
-          end
-          
-          def suite_panel # :nodoc:
-            lazy_initialize(:suite_panel) {
-              @suite_panel = Gtk::HBox.new(false, 10)
-              @suite_panel.border_width(10)
-              @suite_panel.pack_start(Gtk::Label.new("Suite:"), false, false, 0)
-              @suite_panel.pack_start(suite_name_entry, true, true, 0)
-              @suite_panel.pack_start(run_button, false, false, 0)
-            }
-          end
-          
-          def suite_name_entry # :nodoc:
-            lazy_initialize(:suite_name_entry) {
-              @suite_name_entry = Gtk::Entry.new
-              @suite_name_entry.set_editable(false)
-            }
-          end
-          
-          def run_button # :nodoc:
-            lazy_initialize(:run_button) {
-              @run_button = Gtk::Button.new("Run")
-            }
-          end
-          
-          def progress_panel # :nodoc:
-            lazy_initialize(:progress_panel) {
-              @progress_panel = Gtk::HBox.new(false, 10)
-              @progress_panel.border_width(10)
-              @progress_panel.pack_start(test_progress_bar, true, true, 0)
-            }
-          end
-          
-          def test_progress_bar # :nodoc:
-            lazy_initialize(:test_progress_bar) {
-              @test_progress_bar = EnhancedProgressBar.new
-              @test_progress_bar.set_usize(@test_progress_bar.allocation.width,
-                                           info_panel.size_request.height)
-              @test_progress_bar.set_style(green_style)
-            }
-          end
-          
-          def green_style # :nodoc:
-            lazy_initialize(:green_style) {
-              @green_style = Gtk::Style.new
-              @green_style.set_bg(Gtk::STATE_PRELIGHT, 0x0000, 0xFFFF, 0x0000)
-            }
-          end
-          
-          def red_style # :nodoc:
-            lazy_initialize(:red_style) {
-              @red_style = Gtk::Style.new
-              @red_style.set_bg(Gtk::STATE_PRELIGHT, 0xFFFF, 0x0000, 0x0000)
-            }
-          end
-          
-          def info_panel # :nodoc:
-            lazy_initialize(:info_panel) {
-              @info_panel = Gtk::HBox.new(false, 0)
-              @info_panel.border_width(10)
-              @info_panel.pack_start(Gtk::Label.new("Runs:"), false, false, 0)
-              @info_panel.pack_start(run_count_label, true, false, 0)
-              @info_panel.pack_start(Gtk::Label.new("Assertions:"), false, false, 0)
-              @info_panel.pack_start(assertion_count_label, true, false, 0)
-              @info_panel.pack_start(Gtk::Label.new("Failures:"), false, false, 0)
-              @info_panel.pack_start(failure_count_label, true, false, 0)
-              @info_panel.pack_start(Gtk::Label.new("Errors:"), false, false, 0)
-              @info_panel.pack_start(error_count_label, true, false, 0)
-            }
-          end
-          
-          def run_count_label # :nodoc:
-            lazy_initialize(:run_count_label) {
-              @run_count_label = Gtk::Label.new("0")
-              @run_count_label.set_justify(Gtk::JUSTIFY_LEFT)
-            }
-          end
-          
-          def assertion_count_label # :nodoc:
-            lazy_initialize(:assertion_count_label) {
-              @assertion_count_label = Gtk::Label.new("0")
-              @assertion_count_label.set_justify(Gtk::JUSTIFY_LEFT)
-            }
-          end
-          
-          def failure_count_label # :nodoc:
-            lazy_initialize(:failure_count_label) {
-              @failure_count_label = Gtk::Label.new("0")
-              @failure_count_label.set_justify(Gtk::JUSTIFY_LEFT)
-            }
-          end
-          
-          def error_count_label # :nodoc:
-            lazy_initialize(:error_count_label) {
-              @error_count_label = Gtk::Label.new("0")
-              @error_count_label.set_justify(Gtk::JUSTIFY_LEFT)
-            }
-          end
-          
-          def list_panel # :nodoc:
-            lazy_initialize(:list_panel) {
-              @list_panel = Gtk::HBox.new
-              @list_panel.border_width(10)
-              @list_panel.pack_start(list_scrolled_window, true, true, 0)
-            }
-          end
-          
-          def list_scrolled_window # :nodoc:
-            lazy_initialize(:list_scrolled_window) {
-              @list_scrolled_window = Gtk::ScrolledWindow.new
-              @list_scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
-              @list_scrolled_window.set_usize(@list_scrolled_window.allocation.width, 150)
-              @list_scrolled_window.add_with_viewport(fault_list)
-            }
-          end
-          
-          def fault_list # :nodoc:
-            lazy_initialize(:fault_list) {
-              @fault_list = Gtk::List.new
-            }
-          end
-          
-          def detail_panel # :nodoc:
-            lazy_initialize(:detail_panel) {
-              @detail_panel = Gtk::HBox.new
-              @detail_panel.border_width(10)
-              @detail_panel.pack_start(detail_scrolled_window, true, true, 0)
-            }
-          end
-          
-          def detail_scrolled_window # :nodoc:
-            lazy_initialize(:detail_scrolled_window) {
-              @detail_scrolled_window = Gtk::ScrolledWindow.new
-              @detail_scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
-              @detail_scrolled_window.set_usize(400, @detail_scrolled_window.allocation.height)
-              @detail_scrolled_window.add_with_viewport(outer_detail_sub_panel)
-            }
-          end
-          
-          def outer_detail_sub_panel # :nodoc:
-            lazy_initialize(:outer_detail_sub_panel) {
-              @outer_detail_sub_panel = Gtk::VBox.new
-              @outer_detail_sub_panel.pack_start(inner_detail_sub_panel, false, false, 0)
-            }
-          end
-          
-          def inner_detail_sub_panel # :nodoc:
-            lazy_initialize(:inner_detail_sub_panel) {
-              @inner_detail_sub_panel = Gtk::HBox.new
-              @inner_detail_sub_panel.pack_start(fault_detail_label, false, false, 0)
-            }
-          end
-          
-          def fault_detail_label # :nodoc:
-            lazy_initialize(:fault_detail_label) {
-              @fault_detail_label = EnhancedLabel.new("")
-              style = Gtk::Style.new
-              font = Gdk::Font.font_load("-*-Courier New-medium-r-normal--*-120-*-*-*-*-*-*")
-              begin
-                style.set_font(font)
-              rescue ArgumentError; end
-              @fault_detail_label.set_style(style)
-              @fault_detail_label.set_justify(Gtk::JUSTIFY_LEFT)
-              @fault_detail_label.set_line_wrap(false)
-            }
-          end
-          
-          def status_panel # :nodoc:
-            lazy_initialize(:status_panel) {
-              @status_panel = Gtk::HBox.new
-              @status_panel.border_width(10)
-              @status_panel.pack_start(status_entry, true, true, 0)
-            }
-          end
-          
-          def status_entry # :nodoc:
-            lazy_initialize(:status_entry) {
-              @status_entry = Gtk::Entry.new
-              @status_entry.set_editable(false)
-            }
-          end
-  
-          def lazy_initialize(symbol) # :nodoc:
-            if (!instance_eval("defined?(@#{symbol.to_s})"))
-              yield
-            end
-            return instance_eval("@" + symbol.to_s)
-          end
-        end
-  
-        class EnhancedProgressBar < Gtk::ProgressBar # :nodoc: all
-          def set_style(style)
-            super
-            hide
-            show
-          end
-        end
-  
-        class EnhancedLabel < Gtk::Label # :nodoc: all
-          def set_text(text)
-            super(text.gsub(/\n\t/, "\n" + (" " * 4)))
-          end
-        end
-  
-        class FaultListItem < Gtk::ListItem # :nodoc: all
-          attr_reader(:fault)
-          def initialize(fault)
-            super(fault.short_display)
-            @fault = fault
-          end
-        end
-      end
-    end
-  end
-end
-
-if __FILE__ == $0
-  Test::Unit::UI::GTK::TestRunner.start_command_line_test
-end
Index: lib/test/unit/ui/gtk2/testrunner.rb
===================================================================
--- lib/test/unit/ui/gtk2/testrunner.rb	(revision 19672)
+++ lib/test/unit/ui/gtk2/testrunner.rb	(revision 19673)
@@ -1,465 +0,0 @@
-#--
-#
-# Author:: Kenta MURATA.
-# Copyright:: Copyright (c) 2000-2002 Kenta MURATA. All rights reserved.
-# License:: Ruby license.
-
-require "gtk2"
-require "test/unit/ui/testrunnermediator"
-require "test/unit/ui/testrunnerutilities"
-
-module Test
-  module Unit
-    module UI
-      module GTK2 # :nodoc: all
-
-        Gtk.init
-
-        class EnhancedLabel < Gtk::Label # :nodoc: all
-          def set_text(text)
-            super(text.gsub(/\n\t/, "\n    "))
-          end
-        end
-
-        class FaultList < Gtk::TreeView # :nodoc: all
-          def initialize
-            @faults = []
-            @model = Gtk::ListStore.new(String, String)
-            super(@model)
-            column = Gtk::TreeViewColumn.new
-            column.visible = false
-            append_column(column)
-            renderer = Gtk::CellRendererText.new
-            column = Gtk::TreeViewColumn.new("Failures", renderer, {:text => 1})
-            append_column(column)
-            selection.mode = Gtk::SELECTION_SINGLE
-            set_rules_hint(true)
-            set_headers_visible(false)
-          end # def initialize
-
-          def add_fault(fault)
-            @faults.push(fault)
-            iter = @model.append
-            iter.set_value(0, (@faults.length - 1).to_s)
-            iter.set_value(1, fault.short_display)
-          end # def add_fault(fault)
-
-          def get_fault(iter)
-            @faults[iter.get_value(0).to_i]
-          end # def get_fault
-
-          def clear
-            model.clear
-          end # def clear
-        end
-
-        class TestRunner
-          extend TestRunnerUtilities
-
-          def lazy_initialize(symbol) # :nodoc:
-            if !instance_eval("defined?(@#{symbol})") then
-              yield
-            end
-            return instance_eval("@#{symbol}")
-          end
-          private :lazy_initialize
-
-          def status_entry # :nodoc:
-            lazy_initialize(:status_entry) do
-              @status_entry = Gtk::Entry.new
-              @status_entry.editable = false
-            end
-          end
-          private :status_entry
-
-          def status_panel # :nodoc:
-            lazy_initialize(:status_panel) do
-              @status_panel = Gtk::HBox.new
-              @status_panel.border_width = 10
-              @status_panel.pack_start(status_entry, true, true, 0)
-            end
-          end
-          private :status_panel
-
-          def fault_detail_label # :nodoc:
-            lazy_initialize(:fault_detail_label) do
-              @fault_detail_label = EnhancedLabel.new("")
-#              style = Gtk::Style.new
-#              font = Gdk::Font.
-#               font_load("-*-Courier 10 Pitch-medium-r-normal--*-120-*-*-*-*-*-*")
-#              style.set_font(font)
-#              @fault_detail_label.style = style
-              @fault_detail_label.justify = Gtk::JUSTIFY_LEFT
-              @fault_detail_label.wrap = false
-            end
-          end
-          private :fault_detail_label
-
-          def inner_detail_sub_panel # :nodoc:
-            lazy_initialize(:inner_detail_sub_panel) do
-              @inner_detail_sub_panel = Gtk::HBox.new
-              @inner_detail_sub_panel.pack_start(fault_detail_label, false, false, 0)
-            end
-          end
-          private :inner_detail_sub_panel
-
-          def outer_detail_sub_panel # :nodoc:
-            lazy_initialize(:outer_detail_sub_panel) do
-              @outer_detail_sub_panel = Gtk::VBox.new
-              @outer_detail_sub_panel.pack_start(inner_detail_sub_panel, false, false, 0)
-            end
-          end
-          private :outer_detail_sub_panel
-
-          def detail_scrolled_window # :nodoc:
-            lazy_initialize(:detail_scrolled_window) do
-              @detail_scrolled_window = Gtk::ScrolledWindow.new
-              @detail_scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
-              @detail_scrolled_window.
-                set_size_request(400, @detail_scrolled_window.allocation.height)
-              @detail_scrolled_window.add_with_viewport(outer_detail_sub_panel)
-            end
-          end
-          private :detail_scrolled_window
-
-          def detail_panel # :nodoc:
-            lazy_initialize(:detail_panel) do
-              @detail_panel = Gtk::HBox.new
-              @detail_panel.border_width = 10
-              @detail_panel.pack_start(detail_scrolled_window, true, true, 0)
-            end
-          end
-          private :detail_panel
-
-          def fault_list # :nodoc:
-            lazy_initialize(:fault_list) do
-              @fault_list = FaultList.new
-            end
-          end
-          private :fault_list
-
-          def list_scrolled_window # :nodoc:
-            lazy_initialize(:list_scrolled_window) do
-              @list_scrolled_window = Gtk::ScrolledWindow.new
-              @list_scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
-              @list_scrolled_window.
-                set_size_request(@list_scrolled_window.allocation.width, 150)
-              @list_scrolled_window.add_with_viewport(fault_list)
-            end
-          end
-          private :list_scrolled_window
-
-          def list_panel # :nodoc:
-            lazy_initialize(:list_panel) do
-              @list_panel = Gtk::HBox.new
-              @list_panel.border_width = 10
-              @list_panel.pack_start(list_scrolled_window, true, true, 0)
-            end
-          end
-          private :list_panel
-
-          def error_count_label # :nodoc:
-            lazy_initialize(:error_count_label) do
-              @error_count_label = Gtk::Label.new("0")
-              @error_count_label.justify = Gtk::JUSTIFY_LEFT
-            end
-          end
-          private :error_count_label
-
-          def failure_count_label # :nodoc:
-            lazy_initialize(:failure_count_label) do
-              @failure_count_label = Gtk::Label.new("0")
-              @failure_count_label.justify = Gtk::JUSTIFY_LEFT
-            end
-          end
-          private :failure_count_label
-
-          def assertion_count_label # :nodoc:
-            lazy_initialize(:assertion_count_label) do
-              @assertion_count_label = Gtk::Label.new("0")
-              @assertion_count_label.justify = Gtk::JUSTIFY_LEFT
-            end
-          end
-          private :assertion_count_label
-
-          def run_count_label # :nodoc:
-            lazy_initialize(:run_count_label) do
-              @run_count_label = Gtk::Label.new("0")
-              @run_count_label.justify = Gtk::JUSTIFY_LEFT
-            end
-          end
-          private :run_count_label
-          
-          def info_panel # :nodoc:
-            lazy_initialize(:info_panel) do
-              @info_panel = Gtk::HBox.new(false, 0)
-              @info_panel.border_width = 10
-              @info_panel.pack_start(Gtk::Label.new("Runs:"), false, false, 0)
-              @info_panel.pack_start(run_count_label, true, false, 0)
-              @info_panel.pack_start(Gtk::Label.new("Assertions:"), false, false, 0)
-              @info_panel.pack_start(assertion_count_label, true, false, 0)
-              @info_panel.pack_start(Gtk::Label.new("Failures:"), false, false, 0)
-              @info_panel.pack_start(failure_count_label, true, false, 0)
-              @info_panel.pack_start(Gtk::Label.new("Errors:"), false, false, 0)
-              @info_panel.pack_start(error_count_label, true, false, 0)
-            end
-          end # def info_panel
-          private :info_panel
-
-          def green_style # :nodoc:
-            lazy_initialize(:green_style) do
-              @green_style = Gtk::Style.new
-              @green_style.set_bg(Gtk::STATE_PRELIGHT, 0x0000, 0xFFFF, 0x0000)
-            end
-          end # def green_style
-          private :green_style
-          
-          def red_style # :nodoc:
-            lazy_initialize(:red_style) do
-              @red_style = Gtk::Style.new
-              @red_style.set_bg(Gtk::STATE_PRELIGHT, 0xFFFF, 0x0000, 0x0000)
-            end
-          end # def red_style
-          private :red_style
-          
-          def test_progress_bar # :nodoc:
-            lazy_initialize(:test_progress_bar) {
-              @test_progress_bar = Gtk::ProgressBar.new
-              @test_progress_bar.fraction = 0.0
-              @test_progress_bar.
-                set_size_request(@test_progress_bar.allocation.width,
-                                 info_panel.size_request[1])
-              @test_progress_bar.style = green_style
-            }
-          end # def test_progress_bar
-          private :test_progress_bar
-          
-          def progress_panel # :nodoc:
-            lazy_initialize(:progress_panel) do
-              @progress_panel = Gtk::HBox.new(false, 10)
-              @progress_panel.border_width = 10
-              @progress_panel.pack_start(test_progress_bar, true, true, 0)
-            end
-          end # def progress_panel
-
-          def run_button # :nodoc:
-            lazy_initialize(:run_button) do
-              @run_button = Gtk::Button.new("Run")
-            end
-          end # def run_button
-
-          def suite_name_entry # :nodoc:
-            lazy_initialize(:suite_name_entry) do
-              @suite_name_entry = Gtk::Entry.new
-              @suite_name_entry.editable = false
-            end
-          end # def suite_name_entry
-          private :suite_name_entry
-
-          def suite_panel # :nodoc:
-            lazy_initialize(:suite_panel) do
-              @suite_panel = Gtk::HBox.new(false, 10)
-              @suite_panel.border_width = 10
-              @suite_panel.pack_start(Gtk::Label.new("Suite:"), false, false, 0)
-              @suite_panel.pack_start(suite_name_entry, true, true, 0)
-              @suite_panel.pack_start(run_button, false, false, 0)
-            end
-          end # def suite_panel
-          private :suite_panel
-
-          def main_panel # :nodoc:
-            lazy_initialize(:main_panel) do
-              @main_panel = Gtk::VBox.new(false, 0)
-              @main_panel.pack_start(suite_panel, false, false, 0)
-              @main_panel.pack_start(progress_panel, false, false, 0)
-              @main_panel.pack_start(info_panel, false, false, 0)
-              @main_panel.pack_start(list_panel, false, false, 0)
-              @main_panel.pack_start(detail_panel, true, true, 0)
-              @main_panel.pack_start(status_panel, false, false, 0)
-            end
-          end # def main_panel
-          private :main_panel
-
-          def main_window # :nodoc:
-            lazy_initialize(:main_window) do
-              @main_window = Gtk::Window.new(Gtk::Window::TOPLEVEL)
-              @main_window.set_title("Test::Unit TestRunner")
-              @main_window.set_default_size(800, 600)
-              @main_window.set_resizable(true)
-              @main_window.add(main_panel)
-            end
-          end # def main_window
-          private :main_window
-
-          def setup_ui # :nodoc:
-            main_window.signal_connect("destroy", nil) { stop }
-            main_window.show_all
-            fault_list.selection.signal_connect("changed", nil) do
-              |selection, data|
-              if selection.selected then
-                show_fault(fault_list.get_fault(selection.selected))
-              else
-                clear_fault
-              end
-            end
-          end # def setup_ui
-          private :setup_ui
-
-          def output_status(string) # :nodoc:
-            status_entry.set_text(string)
-          end # def output_status(string)
-          private :output_status
-
-          def finished(elapsed_time) # :nodoc:
-            test_progress_bar.fraction = 1.0
-            output_status("Finished in #{elapsed_time} seconds")
-          end # def finished(elapsed_time)
-          private :finished
-
-          def test_started(test_name) # :nodoc:
-            output_status("Running #{test_name}...")
-          end # def test_started(test_name)
-          private :test_started
-
-          def started(result) # :nodoc:
-            @result = result
-            output_status("Started...")
-          end # def started(result)
-          private :started
-
-          def test_finished(result) # :nodoc:
-            test_progress_bar.fraction += 1.0 / @count
-          end # def test_finished(result)
-
-          def result_changed(result) # :nodoc:
-            run_count_label.label = result.run_count.to_s
-            assertion_count_label.label = result.assertion_count.to_s
-            failure_count_label.label = result.failure_count.to_s
-            error_count_label.label = result.error_count.to_s
-          end # def result_changed(result)
-          private :result_changed
-
-          def clear_fault # :nodoc:
-            raw_show_fault("")
-          end # def clear_fault
-          private :clear_fault
-
-          def raw_show_fault(string) # :nodoc:
-            fault_detail_label.set_text(string)
-            outer_detail_sub_panel.queue_resize
-          end # def raw_show_fault(string)
-          private :raw_show_fault
-
-          def show_fault(fault) # :nodoc:
-            raw_show_fault(fault.long_display)
-          end # def show_fault(fault)
-          private :show_fault
-
-          def add_fault(fault) # :nodoc:
-            if not @red then
-              test_progress_bar.style = red_style
-              @red = true
-            end
-            fault_list.add_fault(fault)
-          end # def add_fault(fault)
-          private :add_fault
-
-          def reset_ui(count) # :nodoc:
-            test_progress_bar.style = green_style
-            test_progress_bar.fraction = 0.0
-            @count = count + 1
-            @red = false
-
-            run_count_label.set_text("0")
-            assertion_count_label.set_text("0")
-            failure_count_label.set_text("0")
-            error_count_label.set_text("0")
-
-            fault_list.clear
-          end # def reset_ui(count)
-          private :reset_ui
-
-          def stop # :nodoc:
-            Gtk.main_quit
-          end # def stop
-          private :stop
-
-          def run_test
-            @runner.raise(@restart_signal)
-          end
-          private :run_test
-
-          def start_ui # :nodoc
-            @viewer.run
-            running = false
-            begin
-              loop do
-                if (running ^= true)
-                  run_button.child.text = "Stop"
-                  @mediator.run_suite
-                else
-                  run_button.child.text = "Run"
-                  @viewer.join
-                  break
-                end
-              end
-            rescue @restart_signal
-              retry
-            rescue
-            end
-          end # def start_ui
-          private :start_ui
-
-          def attach_to_mediator
-            run_button.signal_connect("clicked", nil) { run_test }
-            @mediator.add_listener(TestRunnerMediator::RESET, &method(:reset_ui))
-            @mediator.add_listener(TestRunnerMediator::STARTED, &method(:started))
-            @mediator.add_listener(TestRunnerMediator::FINISHED, &method(:finished))
-            @mediator.add_listener(TestResult::FAULT, &method(:add_fault))
-            @mediator.add_listener(TestResult::CHANGED, &method(:result_changed))
-            @mediator.add_listener(TestCase::STARTED, &method(:test_started))
-            @mediator.add_listener(TestCase::FINISHED, &method(:test_finished))
-          end # def attach_to_mediator
-          private :attach_to_mediator
-
-          def setup_mediator
-            @mediator = TestRunnerMediator.new(@suite)
-            suite_name = @suite.to_s
-            if @suite.kind_of?(Module) then
-              suite_name = @suite.name
-            end
-            suite_name_entry.set_text(suite_name)
-          end # def setup_mediator
-          private :setup_mediator
-
-          def start
-            setup_mediator
-            setup_ui
-            attach_to_mediator
-            start_ui
-            @result
-          end # def start
-
-          def initialize(suite, output_level = NORMAL)
-            if suite.respond_to?(:suite) then
-              @suite = suite.suite
-            else
-              @suite = suite
-            end
-            @result = nil
-
-            @runner = Thread.current
-            @restart_signal = Class.new(Exception)
-            @viewer = Thread.start do
-              @runner.join rescue @runner.run
-              Gtk.main
-            end
-            @viewer.join rescue nil # wait deadlock to handshake
-          end # def initialize(suite)
-
-        end # class TestRunner
-
-      end # module GTK2
-    end # module UI
-  end # module Unit
-end # module Test
Index: lib/test/unit/ui/fox/testrunner.rb
===================================================================
--- lib/test/unit/ui/fox/testrunner.rb	(revision 19672)
+++ lib/test/unit/ui/fox/testrunner.rb	(revision 19673)
@@ -1,268 +0,0 @@
-#--
-#
-# Author:: Nathaniel Talbott.
-# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
-# License:: Ruby license.
-
-require 'fox'
-require 'test/unit/ui/testrunnermediator'
-require 'test/unit/ui/testrunnerutilities'
-
-include Fox
-
-module Test
-  module Unit
-    module UI
-      module Fox # :nodoc:
-
-        # Runs a Test::Unit::TestSuite in a Fox UI. Obviously,
-        # this one requires you to have Fox
-        # (http://www.fox-toolkit.org/fox.html) and the Ruby
-        # Fox extension (http://fxruby.sourceforge.net/)
-        # installed.
-        class TestRunner
-
-          extend TestRunnerUtilities
-          
-          RED_STYLE = FXRGBA(0xFF,0,0,0xFF) #0xFF000000
-          GREEN_STYLE = FXRGBA(0,0xFF,0,0xFF) #0x00FF0000
-
-          # Creates a new TestRunner for running the passed
-          # suite.
-          def initialize(suite, output_level = NORMAL)
-            if (suite.respond_to?(:suite))
-              @suite = suite.suite
-            else
-              @suite = suite
-            end
-
-            @result = nil
-            @red = false
-          end
-  
-          # Begins the test run.
-          def start
-            setup_ui
-            setup_mediator
-            attach_to_mediator
-            start_ui
-            @result
-          end
-
-          def setup_mediator # :nodoc:
-            @mediator = TestRunnerMediator.new(@suite)
-            suite_name = @suite.to_s
-            if ( @suite.kind_of?(Module) )
-              suite_name = @suite.name
-            end
-            @suite_name_entry.text = suite_name
-          end
-          
-          def attach_to_mediator # :nodoc:
-            @mediator.add_listener(TestRunnerMediator::RESET, &method(:reset_ui))
-            @mediator.add_listener(TestResult::FAULT, &method(:add_fault))
-            @mediator.add_listener(TestResult::CHANGED, &method(:result_changed))
-            @mediator.add_listener(TestRunnerMediator::STARTED, &method(:started))
-            @mediator.add_listener(TestCase::STARTED, &method(:test_started))
-            @mediator.add_listener(TestRunnerMediator::FINISHED, &method(:finished))
-          end
-  
-          def start_ui # :nodoc:
-            @application.create
-            @window.show(PLACEMENT_SCREEN)
-            @application.addTimeout(1) do
-              @mediator.run_suite
-            end
-            @application.run
-          end
-          
-          def stop # :nodoc:
-            @application.exit(0)
-          end
-          
-          def reset_ui(count) # :nodoc:
-            @test_progress_bar.barColor = GREEN_STYLE
-            @test_progress_bar.total = count
-            @test_progress_bar.progress = 0
-            @red = false
-  
-            @test_count_label.text = "0"
-            @assertion_count_label.text = "0"
-            @failure_count_label.text = "0"
-            @error_count_label.text = "0"
-  
-            @fault_list.clearItems
-          end
-          
-          def add_fault(fault) # :nodoc:
-            if ( ! @red )
-              @test_progress_bar.barColor = RED_STYLE
-              @red = true
-            end
-            item = FaultListItem.new(fault)
-            @fault_list.appendItem(item)
-          end
-          
-          def show_fault(fault) # :nodoc:
-            raw_show_fault(fault.long_display)
-          end
-          
-          def raw_show_fault(string) # :nodoc:
-            @detail_text.setText(string)
-          end
-          
-          def clear_fault # :nodoc:
-            raw_show_fault("")
-          end
-          
-          def result_changed(result) # :nodoc:
-            @test_progress_bar.progress = result.run_count
-  
-            @test_count_label.text = result.run_count.to_s
-            @assertion_count_label.text = result.assertion_count.to_s
-            @failure_count_label.text = result.failure_count.to_s
-            @error_count_label.text = result.error_count.to_s
-
-             # repaint now!
-             @info_panel.repaint
-             @application.flush
-          end
-          
-          def started(result) # :nodoc:
-            @result = result
-            output_status("Started...")
-          end
-          
-          def test_started(test_name)
-            output_status("Running #{test_name}...")
-          end
-          
-          def finished(elapsed_time)
-            output_status("Finished in #{elapsed_time} seconds")
-          end
-          
-          def output_status(string)
-            @status_entry.text = string
-            @status_entry.repaint
-          end
-  
-          def setup_ui # :nodoc:
-            @application = create_application
-            create_tooltip(@application)
-
-            @window = create_window(@application)
-            
-            @status_entry = create_entry(@window)
-            
-            main_panel = create_main_panel(@window)
-            
-            suite_panel = create_suite_panel(main_panel)
-            create_label(suite_panel, "Suite:")
-            @suite_name_entry = create_entry(suite_panel)
-            create_button(suite_panel, "&Run\tRun the current suite", proc { @mediator.run_suite })
-            
-            @test_progress_bar = create_progress_bar(main_panel)
-            
-            @info_panel = create_info_panel(main_panel)
-            create_label(@info_panel, "Tests:")
-            @test_count_label = create_label(@info_panel, "0")
-            create_label(@info_panel, "Assertions:")
-            @assertion_count_label = create_label(@info_panel, "0")
-            create_label(@info_panel, "Failures:")
-            @failure_count_label = create_label(@info_panel, "0")
-            create_label(@info_panel, "Errors:")
-            @error_count_label = create_label(@info_panel, "0")
-            
-            list_panel = create_list_panel(main_panel)
-            @fault_list = create_fault_list(list_panel)
-            
-            detail_panel = create_detail_panel(main_panel)
-            @detail_text = create_text(detail_panel)
-          end
-          
-          def create_application # :nodoc:
-            app = FXApp.new("TestRunner", "Test::Unit")
-            app.init([])
-            app
-          end
-          
-          def create_window(app)
-            FXMainWindow.new(app, "Test::Unit TestRunner", nil, nil, DECOR_ALL, 0, 0, 450)
-          end
-          
-          def create_tooltip(app)
-            FXTooltip.new(app)
-          end
-  
-          def create_main_panel(parent) # :nodoc:
-            panel = FXVerticalFrame.new(parent, LAYOUT_FILL_X | LAYOUT_FILL_Y)
-            panel.vSpacing = 10
-            panel
-          end
-  
-          def create_suite_panel(parent) # :nodoc:
-            FXHorizontalFrame.new(parent, LAYOUT_SIDE_LEFT | LAYOUT_FILL_X)
-          end
-          
-          def create_button(parent, text, action) # :nodoc:
-            FXButton.new(parent, text).connect(SEL_COMMAND, &action)
-          end
-          
-          def create_progress_bar(parent) # :nodoc:
-            FXProgressBar.new(parent, nil, 0, PROGRESSBAR_NORMAL | LAYOUT_FILL_X)
-          end
-          
-          def create_info_panel(parent) # :nodoc:
-            FXMatrix.new(parent, 1, MATRIX_BY_ROWS | LAYOUT_FILL_X)
-          end
-          
-          def create_label(parent, text)
-            FXLabel.new(parent, text, nil, JUSTIFY_CENTER_X | LAYOUT_FILL_COLUMN)
-          end
-          
-          def create_list_panel(parent) # :nodoc:
-            FXHorizontalFrame.new(parent, LAYOUT_FILL_X | FRAME_SUNKEN | FRAME_THICK)
-          end
-          
-          def create_fault_list(parent) # :nodoc:
-            list = FXList.new(parent, 10, nil, 0, LIST_SINGLESELECT | LAYOUT_FILL_X) #, 0, 0, 0, 150)
-            list.connect(SEL_COMMAND) do |sender, sel, ptr|
-              if sender.retrieveItem(sender.currentItem).selected?
-                show_fault(sender.retrieveItem(sender.currentItem).fault)
-              else
-                clear_fault
-              end
-            end
-            list
-          end
-          
-          def create_detail_panel(parent) # :nodoc:
-            FXHorizontalFrame.new(parent, LAYOUT_FILL_X | LAYOUT_FILL_Y | FRAME_SUNKEN | FRAME_THICK)
-          end
-          
-          def create_text(parent) # :nodoc:
-            FXText.new(parent, nil, 0, TEXT_READONLY | LAYOUT_FILL_X | LAYOUT_FILL_Y)
-          end
-          
-          def create_entry(parent) # :nodoc:
-            entry = FXTextField.new(parent, 30, nil, 0, TEXTFIELD_NORMAL | LAYOUT_SIDE_BOTTOM | LAYOUT_FILL_X)
-            entry.disable
-            entry
-          end
-        end
-  
-        class FaultListItem < FXListItem # :nodoc: all
-          attr_reader(:fault)
-          def initialize(fault)
-            super(fault.short_display)
-            @fault = fault
-          end
-        end
-      end
-    end
-  end
-end
-
-if __FILE__ == $0
-  Test::Unit::UI::Fox::TestRunner.start_command_line_test
-end
Index: lib/test/unit/ui/tk/testrunner.rb
===================================================================
--- lib/test/unit/ui/tk/testrunner.rb	(revision 19672)
+++ lib/test/unit/ui/tk/testrunner.rb	(revision 19673)
@@ -1,260 +0,0 @@
-#--
-#
-# Original Author:: Nathaniel Talbott.
-# Author:: Kazuhiro NISHIYAMA.
-# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
-# Copyright:: Copyright (c) 2003 Kazuhiro NISHIYAMA. All rights reserved.
-# License:: Ruby license.
-
-require 'tk'
-require 'test/unit/ui/testrunnermediator'
-require 'test/unit/ui/testrunnerutilities'
-
-module Test
-  module Unit
-    module UI
-      module Tk # :nodoc:
-
-        # Runs a Test::Unit::TestSuite in a Tk UI. Obviously,
-        # this one requires you to have Tk
-        # and the Ruby Tk extension installed.
-        class TestRunner
-          extend TestRunnerUtilities
-
-          # Creates a new TestRunner for running the passed
-          # suite.
-          def initialize(suite, output_level = NORMAL)
-            if (suite.respond_to?(:suite))
-              @suite = suite.suite
-            else
-              @suite = suite
-            end
-            @result = nil
-
-            @red = false
-            @fault_detail_list = []
-            @runner = Thread.current
-            @restart_signal = Class.new(Exception)
-            @viewer = Thread.start do
-              @runner.join rescue @runner.run
-              ::Tk.mainloop
-            end
-            @viewer.join rescue nil # wait deadlock to handshake
-          end
-
-          # Begins the test run.
-          def start
-            setup_ui
-            setup_mediator
-            attach_to_mediator
-            start_ui
-            @result
-          end
-
-          private
-          def setup_mediator # :nodoc:
-            @mediator = TestRunnerMediator.new(@suite)
-            suite_name = @suite.to_s
-            if ( @suite.kind_of?(Module) )
-              suite_name = @suite.name
-            end
-            @suite_name_entry.value = suite_name
-          end
-
-          def attach_to_mediator # :nodoc:
-            @run_button.command(method(:run_test))
-            @fault_list.bind('ButtonPress-1', proc{|y|
-              fault = @fault_detail_list[@fault_list.nearest(y)]
-              if fault
-                show_fault(fault)
-              end
-            }, '%y')
-            @mediator.add_listener(TestRunnerMediator::RESET, &method(:reset_ui))
-            @mediator.add_listener(TestResult::FAULT, &method(:add_fault))
-            @mediator.add_listener(TestResult::CHANGED, &method(:result_changed))
-            @mediator.add_listener(TestRunnerMediator::STARTED, &method(:started))
-            @mediator.add_listener(TestCase::STARTED, &method(:test_started))
-            @mediator.add_listener(TestRunnerMediator::FINISHED, &method(:finished))
-          end
-
-          def run_test
-            @runner.raise(@restart_signal)
-          end
-
-          def start_ui # :nodoc:
-            @viewer.run
-            running = false
-            begin
-              loop do
-                if (running ^= true)
-                  @run_button.configure('text'=>'Stop')
-                  @mediator.run_suite
-                else
-                  @run_button.configure('text'=>'Run')
-                  @viewer.join
-                  break
-                end
-              end
-            rescue @restart_signal
-              retry
-            rescue
-            end
-          end
-
-          def stop # :nodoc:
-            ::Tk.exit
-          end
-
-          def reset_ui(count) # :nodoc:
-            @test_total_count = count.to_f
-            @test_progress_bar.configure('background'=>'green')
-            @test_progress_bar.place('relwidth'=>(count.zero? ? 0 : 0/count))
-            @red = false
-
-            @test_count_label.value = 0
-            @assertion_count_label.value = 0
-            @failure_count_label.value = 0
-            @error_count_label.value = 0
-
-            @fault_list.delete(0, 'end')
-            @fault_detail_list = []
-            clear_fault
-          end
-
-          def add_fault(fault) # :nodoc:
-            if ( ! @red )
-              @test_progress_bar.configure('background'=>'red')
-              @red = true
-            end
-            @fault_detail_list.push fault
-            @fault_list.insert('end', fault.short_display)
-          end
-
-          def show_fault(fault) # :nodoc:
-            raw_show_fault(fault.long_display)
-          end
-
-          def raw_show_fault(string) # :nodoc:
-            @detail_text.value = string
-          end
-
-          def clear_fault # :nodoc:
-            raw_show_fault("")
-          end
-
-          def result_changed(result) # :nodoc:
-            @test_count_label.value = result.run_count
-            @test_progress_bar.place('relwidth'=>result.run_count/@test_total_count)
-            @assertion_count_label.value = result.assertion_count
-            @failure_count_label.value = result.failure_count
-            @error_count_label.value = result.error_count
-          end
-
-          def started(result) # :nodoc:
-            @result = result
-            output_status("Started...")
-          end
-
-          def test_started(test_name)
-            output_status("Running #{test_name}...")
-          end
-
-          def finished(elapsed_time)
-            output_status("Finished in #{elapsed_time} seconds")
-          end
-
-          def output_status(string) # :nodoc:
-            @status_entry.value = string
-          end
-
-          def setup_ui # :nodoc:
-            @status_entry = TkVariable.new
-            l = TkLabel.new(nil, 'textvariable'=>@status_entry, 'relief'=>'sunken')
-            l.pack('side'=>'bottom', 'fill'=>'x')
-
-            suite_frame = TkFrame.new.pack('fill'=>'x')
-
-            @run_button = TkButton.new(suite_frame, 'text'=>'Run')
-            @run_button.pack('side'=>'right')
-
-            TkLabel.new(suite_frame, 'text'=>'Suite:').pack('side'=>'left')
-            @suite_name_entry = TkVariable.new
-            l = TkLabel.new(suite_frame, 'textvariable'=>@suite_name_entry, 'relief'=>'sunken')
-            l.pack('side'=>'left', 'fill'=>'x', 'expand'=>true)
-
-            f = TkFrame.new(nil, 'relief'=>'sunken', 'borderwidth'=>3, 'height'=>20).pack('fill'=>'x', 'padx'=>1)
-            @test_progress_bar = TkFrame.new(f, 'background'=>'green').place('anchor'=>'nw', 'relwidth'=>0.0, 'relheight'=>1.0)
-
-            info_frame = TkFrame.new.pack('fill'=>'x')
-            @test_count_label = create_count_label(info_frame, 'Tests:')
-            @assertion_count_label = create_count_label(info_frame, 'Assertions:')
-            @failure_count_label = create_count_label(info_frame, 'Failures:')
-            @error_count_label = create_count_label(info_frame, 'Errors:')
-
-	    if (::Tk.info('command', TkPanedWindow::TkCommandNames[0]) != "")
-	      # use panedwindow
-	      paned_frame = TkPanedWindow.new("orient"=>"vertical").pack('fill'=>'both', 'expand'=>true)
-
-	      fault_list_frame = TkFrame.new(paned_frame)
-	      detail_frame = TkFrame.new(paned_frame)
-
-	      paned_frame.add(fault_list_frame, detail_frame)
-	    else
-	      # no panedwindow
-	      paned_frame = nil
-	      fault_list_frame = TkFrame.new.pack('fill'=>'both', 'expand'=>true)
-	      detail_frame = TkFrame.new.pack('fill'=>'both', 'expand'=>true)
-	    end
-
-	    TkGrid.rowconfigure(fault_list_frame, 0, 'weight'=>1, 'minsize'=>0)
-	    TkGrid.columnconfigure(fault_list_frame, 0, 'weight'=>1, 'minsize'=>0)
-
-            fault_scrollbar_y = TkScrollbar.new(fault_list_frame)
-            fault_scrollbar_x = TkScrollbar.new(fault_list_frame)
-            @fault_list = TkListbox.new(fault_list_frame)
-            @fault_list.yscrollbar(fault_scrollbar_y)
-            @fault_list.xscrollbar(fault_scrollbar_x)
-
-	    TkGrid.rowconfigure(detail_frame, 0, 'weight'=>1, 'minsize'=>0)
-	    TkGrid.columnconfigure(detail_frame, 0, 'weight'=>1, 'minsize'=>0)
-
-	    ::Tk.grid(@fault_list, fault_scrollbar_y, 'sticky'=>'news')
-	    ::Tk.grid(fault_scrollbar_x, 'sticky'=>'news')
-
-            detail_scrollbar_y = TkScrollbar.new(detail_frame)
-            detail_scrollbar_x = TkScrollbar.new(detail_frame)
-            @detail_text = TkText.new(detail_frame, 'height'=>10, 'wrap'=>'none') {
-              bindtags(bindtags - [TkText])
-	    }
-	    @detail_text.yscrollbar(detail_scrollbar_y)
-	    @detail_text.xscrollbar(detail_scrollbar_x)
-
-	    ::Tk.grid(@detail_text, detail_scrollbar_y, 'sticky'=>'news')
-	    ::Tk.grid(detail_scrollbar_x, 'sticky'=>'news')
-
-	    # rubber-style pane
-	    if paned_frame
-	      ::Tk.update
-	      @height = paned_frame.winfo_height
-	      paned_frame.bind('Configure', proc{|h|
-		paned_frame.sash_place(0, 0, paned_frame.sash_coord(0)[1] * h / @height)
-		@height = h
-	      }, '%h')
-	    end
-          end
-
-          def create_count_label(parent, label) # :nodoc:
-            TkLabel.new(parent, 'text'=>label).pack('side'=>'left', 'expand'=>true)
-            v = TkVariable.new(0)
-            TkLabel.new(parent, 'textvariable'=>v).pack('side'=>'left', 'expand'=>true)
-            v
-          end
-        end
-      end
-    end
-  end
-end
-
-if __FILE__ == $0
-  Test::Unit::UI::Tk::TestRunner.start_command_line_test
-end
Index: lib/test/unit/util/observable.rb
===================================================================
--- lib/test/unit/util/observable.rb	(revision 19672)
+++ lib/test/unit/util/observable.rb	(revision 19673)
@@ -1,90 +0,0 @@
-#--
-#
-# Author:: Nathaniel Talbott.
-# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
-# License:: Ruby license.
-
-require 'test/unit/util/procwrapper'
-
-module Test
-  module Unit
-    module Util # :nodoc:
-
-      # This is a utility class that allows anything mixing
-      # it in to notify a set of listeners about interesting
-      # events.
-      module Observable
-        # We use this for defaults since nil might mean something
-        NOTHING = "NOTHING/#{__id__}"
-
-        # Adds the passed proc as a listener on the
-        # channel indicated by channel_name. listener_key
-        # is used to remove the listener later; if none is
-        # specified, the proc itself is used.
-        #
-        # Whatever is used as the listener_key is
-        # returned, making it very easy to use the proc
-        # itself as the listener_key:
-        #
-        #  listener = add_listener("Channel") { ... }
-        #  remove_listener("Channel", listener)
-        def add_listener(channel_name, listener_key=NOTHING, &listener) # :yields: value
-          unless(block_given?)
-            raise ArgumentError.new("No callback was passed as a listener")
-          end
-      
-          key = listener_key
-          if (listener_key == NOTHING)
-            listener_key = listener
-            key = ProcWrapper.new(listener)
-          end
-      
-          channels[channel_name] ||= {}
-          channels[channel_name][key] = listener
-          return listener_key
-        end
-
-        # Removes the listener indicated by listener_key
-        # from the channel indicated by
-        # channel_name. Returns the registered proc, or
-        # nil if none was found.
-        def remove_listener(channel_name, listener_key)
-          channel = channels[channel_name]
-          return nil unless (channel)
-          key = listener_key
-          if (listener_key.instance_of?(Proc))
-            key = ProcWrapper.new(listener_key)
-          end
-          if (channel.has_key?(key))
-            return channel.delete(key)
-          end
-          return nil
-        end
-
-        # Calls all the procs registered on the channel
-        # indicated by channel_name. If value is
-        # specified, it is passed in to the procs,
-        # otherwise they are called with no arguments.
-        #
-        #--
-        #
-        # Perhaps this should be private? Would it ever
-        # make sense for an external class to call this
-        # method directly?
-        def notify_listeners(channel_name, *arguments)
-          channel = channels[channel_name]
-          return 0 unless (channel)
-          listeners = channel.values
-          listeners.each { |listener| listener.call(*arguments) }
-          return listeners.size
-        end
-
-        private
-        def channels # :nodoc:
-          @channels ||= {}
-          return @channels
-        end
-      end
-    end
-  end
-end
Index: lib/test/unit/util/procwrapper.rb
===================================================================
--- lib/test/unit/util/procwrapper.rb	(revision 19672)
+++ lib/test/unit/util/procwrapper.rb	(revision 19673)
@@ -1,48 +0,0 @@
-#--
-#
-# Author:: Nathaniel Talbott.
-# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
-# License:: Ruby license.
-
-module Test
-  module Unit
-    module Util
-
-      # Allows the storage of a Proc passed through '&' in a
-      # hash.
-      #
-      # Note: this may be inefficient, since the hash being
-      # used is not necessarily very good. In Observable,
-      # efficiency is not too important, since the hash is
-      # only accessed when adding and removing listeners,
-      # not when notifying.
-
-      class ProcWrapper
-
-        # Creates a new wrapper for a_proc.
-        def initialize(a_proc)
-          @a_proc = a_proc
-          @hash = a_proc.inspect.sub(/^(#<#{a_proc.class}:)/, '').sub(/(>)$/, '').hex
-        end
-
-        def hash # :nodoc:
-          return @hash
-        end
-
-        def ==(other) # :nodoc:
-          case(other)
-            when ProcWrapper
-              return @a_proc == other.to_proc
-            else
-              return super
-          end
-        end
-        alias :eql? :==
-
-        def to_proc # :nodoc:
-          return @a_proc
-        end
-      end
-    end
-  end
-end
Index: lib/test/unit/util/backtracefilter.rb
===================================================================
--- lib/test/unit/util/backtracefilter.rb	(revision 19672)
+++ lib/test/unit/util/backtracefilter.rb	(revision 19673)
@@ -1,40 +0,0 @@
-module Test
-  module Unit
-    module Util
-      module BacktraceFilter
-        TESTUNIT_FILE_SEPARATORS = %r{[\\/:]}
-        TESTUNIT_PREFIX = __FILE__.split(TESTUNIT_FILE_SEPARATORS)[0..-3]
-        TESTUNIT_RB_FILE = /\.rb\Z/
-        
-        def filter_backtrace(backtrace, prefix=nil)
-          return ["No backtrace"] unless(backtrace)
-          split_p = if(prefix)
-            prefix.split(TESTUNIT_FILE_SEPARATORS)
-          else
-            TESTUNIT_PREFIX
-          end
-          match = proc do |e|
-            split_e = e.split(TESTUNIT_FILE_SEPARATORS)[0, split_p.size]
-            next false unless(split_e[0..-2] == split_p[0..-2])
-            split_e[-1].sub(TESTUNIT_RB_FILE, '') == split_p[-1]
-          end
-          return backtrace unless(backtrace.detect(&match))
-          found_prefix = false
-          new_backtrace = backtrace.reverse.reject do |e|
-            if(match[e])
-              found_prefix = true
-              true
-            elsif(found_prefix)
-              false
-            else
-              true
-            end
-          end.reverse
-          new_backtrace = (new_backtrace.empty? ? backtrace : new_backtrace)
-          new_backtrace = new_backtrace.reject(&match)
-          new_backtrace.empty? ? backtrace : new_backtrace
-        end
-      end
-    end
-  end
-end
Index: lib/test/unit/deprecate.rb
===================================================================
--- lib/test/unit/deprecate.rb	(revision 0)
+++ lib/test/unit/deprecate.rb	(revision 19673)
@@ -0,0 +1,30 @@
+############################################################
+# This file is imported from a different project.
+# DO NOT make modifications in this repo.
+# File a patch instead and assign it to Ryan Davis
+############################################################
+
+class Module # define deprecation api
+  DEPS = Hash.new { |h,k| h[k] = {} }
+
+  def tu_deprecation_warning old, new = nil, kaller = nil
+    kaller ||= caller[1]
+    unless DEPS[old][kaller] then
+      msg = "#{self}##{old} deprecated. "
+      msg += new ? "Use ##{new}" : "No replacement is provided"
+      msg += ". From #{kaller}."
+      warn msg
+    end
+    DEPS[old][kaller] = true
+  end
+
+  def tu_deprecate old, new
+    class_eval <<-EOM
+      def #{old} *args, &block
+        cls, clr = self.class, caller.first
+        self.class.tu_deprecation_warning #{old.inspect}, #{new.inspect}, clr
+        #{new}(*args, &block)
+      end
+    EOM
+  end
+end
Index: lib/test/unit.rb
===================================================================
--- lib/test/unit.rb	(revision 19672)
+++ lib/test/unit.rb	(revision 19673)
@@ -1,280 +1,10 @@
-require 'test/unit/testcase'
-require 'test/unit/autorunner'
+############################################################
+# This file is imported from a different project.
+# DO NOT make modifications in this repo.
+# File a patch instead and assign it to Ryan Davis
+############################################################
 
-module Test # :nodoc:
-  #
-  # = Test::Unit - Ruby Unit Testing Framework
-  # 
-  # == Introduction
-  # 
-  # Unit testing is making waves all over the place, largely due to the
-  # fact that it is a core practice of XP. While XP is great, unit testing
-  # has been around for a long time and has always been a good idea. One
-  # of the keys to good unit testing, though, is not just writing tests,
-  # but having tests. What's the difference? Well, if you just _write_ a
-  # test and throw it away, you have no guarantee that something won't
-  # change later which breaks your code. If, on the other hand, you _have_
-  # tests (obviously you have to write them first), and run them as often
-  # as possible, you slowly build up a wall of things that cannot break
-  # without you immediately knowing about it. This is when unit testing
-  # hits its peak usefulness.
-  # 
-  # Enter Test::Unit, a framework for unit testing in Ruby, helping you to
-  # design, debug and evaluate your code by making it easy to write and
-  # have tests for it.
-  # 
-  # 
-  # == Notes
-  # 
-  # Test::Unit has grown out of and superceded Lapidary.
-  # 
-  # 
-  # == Feedback
-  # 
-  # I like (and do my best to practice) XP, so I value early releases,
-  # user feedback, and clean, simple, expressive code. There is always
-  # room for improvement in everything I do, and Test::Unit is no
-  # exception. Please, let me know what you think of Test::Unit as it
-  # stands, and what you'd like to see expanded/changed/improved/etc. If
-  # you find a bug, let me know ASAP; one good way to let me know what the
-  # bug is is to submit a new test that catches it :-) Also, I'd love to
-  # hear about any successes you have with Test::Unit, and any
-  # documentation you might add will be greatly appreciated. My contact
-  # info is below.
-  # 
-  # 
-  # == Contact Information
-  # 
-  # A lot of discussion happens about Ruby in general on the ruby-talk
-  # mailing list (http://www.ruby-lang.org/en/ml.html), and you can ask
-  # any questions you might have there. I monitor the list, as do many
-  # other helpful Rubyists, and you're sure to get a quick answer. Of
-  # course, you're also welcome to email me (Nathaniel Talbott) directly
-  # at mailto:testunit@t..., and I'll do my best to help you out.
-  # 
-  # 
-  # == Credits
-  # 
-  # I'd like to thank...
-  # 
-  # Matz, for a great language!
-  # 
-  # Masaki Suketa, for his work on RubyUnit, which filled a vital need in
-  # the Ruby world for a very long time. I'm also grateful for his help in
-  # polishing Test::Unit and getting the RubyUnit compatibility layer
-  # right. His graciousness in allowing Test::Unit to supercede RubyUnit
-  # continues to be a challenge to me to be more willing to defer my own
-  # rights.
-  # 
-  # Ken McKinlay, for his interest and work on unit testing, and for his
-  # willingness to dialog about it. He was also a great help in pointing
-  # out some of the holes in the RubyUnit compatibility layer.
-  # 
-  # Dave Thomas, for the original idea that led to the extremely simple
-  # "require 'test/unit'", plus his code to improve it even more by
-  # allowing the selection of tests from the command-line. Also, without
-  # RDoc, the documentation for Test::Unit would stink a lot more than it
-  # does now.
-  # 
-  # Everyone who's helped out with bug reports, feature ideas,
-  # encouragement to continue, etc. It's a real privilege to be a part of
-  # the Ruby community.
-  # 
-  # The guys at RoleModel Software, for putting up with me repeating, "But
-  # this would be so much easier in Ruby!" whenever we're coding in Java.
-  # 
-  # My Creator, for giving me life, and giving it more abundantly.
-  # 
-  # 
-  # == License
-  # 
-  # Test::Unit is copyright (c) 2000-2003 Nathaniel Talbott. It is free
-  # software, and is distributed under the Ruby license. See the COPYING
-  # file in the standard Ruby distribution for details.
-  # 
-  # 
-  # == Warranty
-  # 
-  # This software is provided "as is" and without any express or
-  # implied warranties, including, without limitation, the implied
-  # warranties of merchantibility and fitness for a particular
-  # purpose.
-  # 
-  # 
-  # == Author
-  # 
-  # Nathaniel Talbott.
-  # Copyright (c) 2000-2003, Nathaniel Talbott
-  #
-  # ----
-  #
-  # = Usage
-  #
-  # The general idea behind unit testing is that you write a _test_
-  # _method_ that makes certain _assertions_ about your code, working
-  # against a _test_ _fixture_. A bunch of these _test_ _methods_ are
-  # bundled up into a _test_ _suite_ and can be run any time the
-  # developer wants. The results of a run are gathered in a _test_
-  # _result_ and displayed to the user through some UI. So, lets break
-  # this down and see how Test::Unit provides each of these necessary
-  # pieces.
-  #
-  #
-  # == Assertions
-  #
-  # These are the heart of the framework. Think of an assertion as a
-  # statement of expected outcome, i.e. "I assert that x should be equal
-  # to y". If, when the assertion is executed, it turns out to be
-  # correct, nothing happens, and life is good. If, on the other hand,
-  # your assertion turns out to be false, an error is propagated with
-  # pertinent information so that you can go back and make your
-  # assertion succeed, and, once again, life is good. For an explanation
-  # of the current assertions, see Test::Unit::Assertions.
-  #
-  #
-  # == Test Method & Test Fixture
-  #
-  # Obviously, these assertions have to be called within a context that
-  # knows about them and can do something meaningful with their
-  # pass/fail value. Also, it's handy to collect a bunch of related
-  # tests, each test represented by a method, into a common test class
-  # that knows how to run them. The tests will be in a separate class
-  # from the code they're testing for a couple of reasons. First of all,
-  # it allows your code to stay uncluttered with test code, making it
-  # easier to maintain. Second, it allows the tests to be stripped out
-  # for deployment, since they're really there for you, the developer,
-  # and your users don't need them. Third, and most importantly, it
-  # allows you to set up a common test fixture for your tests to run
-  # against.
-  #
-  # What's a test fixture? Well, tests do not live in a vacuum; rather,
-  # they're run against the code they are testing. Often, a collection
-  # of tests will run against a common set of data, also called a
-  # fixture. If they're all bundled into the same test class, they can
-  # all share the setting up and tearing down of that data, eliminating
-  # unnecessary duplication and making it much easier to add related
-  # tests.
-  #
-  # Test::Unit::TestCase wraps up a collection of test methods together
-  # and allows you to easily set up and tear down the same test fixture
-  # for each test. This is done by overriding #setup and/or #teardown,
-  # which will be called before and after each test method that is
-  # run. The TestCase also knows how to collect the results of your
-  # assertions into a Test::Unit::TestResult, which can then be reported
-  # back to you... but I'm getting ahead of myself. To write a test,
-  # follow these steps:
-  #
-  # * Make sure Test::Unit is in your library path.
-  # * require 'test/unit' in your test script.
-  # * Create a class that subclasses Test::Unit::TestCase.
-  # * Add a method that begins with "test" to your class.
-  # * Make assertions in your test method.
-  # * Optionally define #setup and/or #teardown to set up and/or tear
-  #   down your common test fixture.
-  # * You can now run your test as you would any other Ruby
-  #   script... try it and see!
-  #
-  # A really simple test might look like this (#setup and #teardown are
-  # commented out to indicate that they are completely optional):
-  #
-  #     require 'test/unit'
-  #     
-  #     class TC_MyTest < Test::Unit::TestCase
-  #       # def setup
-  #       # end
-  #     
-  #       # def teardown
-  #       # end
-  #     
-  #       def test_fail
-  #         assert(false, 'Assertion was false.')
-  #       end
-  #     end
-  #
-  #
-  # == Test Runners
-  #
-  # So, now you have this great test class, but you still need a way to
-  # run it and view any failures that occur during the run. This is
-  # where Test::Unit::UI::Console::TestRunner (and others, such as
-  # Test::Unit::UI::GTK::TestRunner) comes into play. The console test
-  # runner is automatically invoked for you if you require 'test/unit'
-  # and simply run the file. To use another runner, or to manually
-  # invoke a runner, simply call its run class method and pass in an
-  # object that responds to the suite message with a
-  # Test::Unit::TestSuite. This can be as simple as passing in your
-  # TestCase class (which has a class suite method). It might look
-  # something like this:
-  #
-  #    require 'test/unit/ui/console/testrunner'
-  #    Test::Unit::UI::Console::TestRunner.run(TC_MyTest)
-  #
-  #
-  # == Test Suite
-  #
-  # As more and more unit tests accumulate for a given project, it
-  # becomes a real drag running them one at a time, and it also
-  # introduces the potential to overlook a failing test because you
-  # forget to run it. Suddenly it becomes very handy that the
-  # TestRunners can take any object that returns a Test::Unit::TestSuite
-  # in response to a suite method. The TestSuite can, in turn, contain
-  # other TestSuites or individual tests (typically created by a
-  # TestCase). In other words, you can easily wrap up a group of
-  # TestCases and TestSuites like this:
-  #
-  #  require 'test/unit/testsuite'
-  #  require 'tc_myfirsttests'
-  #  require 'tc_moretestsbyme'
-  #  require 'ts_anothersetoftests'
-  #
-  #  class TS_MyTests
-  #    def self.suite
-  #      suite = Test::Unit::TestSuite.new
-  #      suite << TC_MyFirstTests.suite
-  #      suite << TC_MoreTestsByMe.suite
-  #      suite << TS_AnotherSetOfTests.suite
-  #      return suite
-  #    end
-  #  end
-  #  Test::Unit::UI::Console::TestRunner.run(TS_MyTests)
-  #
-  # Now, this is a bit cumbersome, so Test::Unit does a little bit more
-  # for you, by wrapping these up automatically when you require
-  # 'test/unit'. What does this mean? It means you could write the above
-  # test case like this instead:
-  #
-  #  require 'test/unit'
-  #  require 'tc_myfirsttests'
-  #  require 'tc_moretestsbyme'
-  #  require 'ts_anothersetoftests'
-  #
-  # Test::Unit is smart enough to find all the test cases existing in
-  # the ObjectSpace and wrap them up into a suite for you. It then runs
-  # the dynamic suite using the console TestRunner.
-  #
-  #
-  # == Questions?
-  #
-  # I'd really like to get feedback from all levels of Ruby
-  # practitioners about typos, grammatical errors, unclear statements,
-  # missing points, etc., in this document (or any other).
-  #
+require 'mini/test'
+require 'test/unit/testcase' # pull in deprecated functionality
 
-  module Unit
-    # If set to false Test::Unit will not automatically run at exit.
-    def self.run=(flag)
-      @run = flag
-    end
-
-    # Automatically run tests at exit?
-    def self.run?
-      @run ||= false
-    end
-  end
-end
-
-at_exit do
-  unless $! || Test::Unit.run?
-    exit Test::Unit::AutoRunner.run
-  end
-end
+Mini::Test.autorun
Index: test/mini/test_mini_mock.rb
===================================================================
--- test/mini/test_mini_mock.rb	(revision 0)
+++ test/mini/test_mini_mock.rb	(revision 19673)
@@ -0,0 +1,82 @@
+############################################################
+# This file is imported from a different project.
+# DO NOT make modifications in this repo.
+# File a patch instead and assign it to Ryan Davis
+############################################################
+
+require 'mini/mock'
+
+Mini::Test.autorun
+
+class TestMiniMock < Mini::Test::TestCase
+  def setup
+    @mock = Mini::Mock.new.expect(:foo, nil)
+    @mock.expect(:meaning_of_life, 42)
+  end
+
+  def test_should_create_stub_method
+    assert_nil @mock.foo
+  end
+
+  def test_should_allow_return_value_specification
+    assert_equal 42, @mock.meaning_of_life
+  end
+
+  def test_should_blow_up_if_not_called
+    @mock.foo
+
+    util_verify_bad
+  end
+
+  def test_should_not_blow_up_if_everything_called
+    @mock.foo
+    @mock.meaning_of_life
+
+    assert @mock.verify
+  end
+
+  def test_should_allow_expectations_to_be_added_after_creation
+    @mock.expect(:bar, true)
+    assert @mock.bar
+  end
+
+  def test_should_not_verify_if_new_expected_method_is_not_called
+    @mock.foo
+    @mock.meaning_of_life
+    @mock.expect(:bar, true)
+
+    util_verify_bad
+  end
+
+  def test_should_not_verify_if_unexpected_method_is_called
+    assert_raises NoMethodError do
+      @mock.unexpected
+    end
+  end
+
+  def test_should_blow_up_on_wrong_number_of_arguments
+    @mock.foo
+    @mock.meaning_of_life
+    @mock.expect(:sum, 3, [1, 2])
+
+    assert_raises ArgumentError do
+      @mock.sum
+    end
+  end
+
+  def test_should_blow_up_on_wrong_arguments
+    @mock.foo
+    @mock.meaning_of_life
+    @mock.expect(:sum, 3, [1, 2])
+
+    @mock.sum(2, 4)
+
+    util_verify_bad
+  end
+
+  def util_verify_bad
+    assert_raises MockExpectationError do
+      @mock.verify
+    end
+  end
+end
Index: test/mini/test_mini_spec.rb
===================================================================
--- test/mini/test_mini_spec.rb	(revision 0)
+++ test/mini/test_mini_spec.rb	(revision 19673)
@@ -0,0 +1,155 @@
+############################################################
+# This file is imported from a different project.
+# DO NOT make modifications in this repo.
+# File a patch instead and assign it to Ryan Davis
+############################################################
+
+require 'mini/spec'
+
+Mini::Test.autorun
+
+describe Mini::Spec do
+  before do
+    @assertion_count = 5
+  end
+
+  after do
+    self._assertions.must_equal @assertion_count
+  end
+
+  it "needs to have all methods named well" do
+    @assertion_count = 2
+
+    methods = Object.public_instance_methods.find_all { |n| n =~ /^must|^wont/ }
+    methods.map! { |m| m.to_s } if Symbol === methods.first
+
+    musts, wonts = methods.sort.partition { |m| m =~ /^must/ }
+
+    expected_musts = %w(must_be
+                        must_be_close_to
+                        must_be_empty
+                        must_be_instance_of
+                        must_be_kind_of
+                        must_be_nil
+                        must_be_same_as
+                        must_be_within_delta
+                        must_be_within_epsilon
+                        must_equal
+                        must_include
+                        must_match
+                        must_raise
+                        must_respond_to
+                        must_send
+                        must_throw)
+
+    expected_wonts = expected_musts.map { |m| m.sub(/^must/, 'wont') }
+    expected_wonts.reject! { |m| m =~ /wont_(not|raise|throw|send)/ }
+
+    musts.must_equal expected_musts
+    wonts.must_equal expected_wonts
+  end
+
+  it "needs to verify equality" do
+    (6 * 7).must_equal(42).must_equal true
+    proc { (6 * 9).must_equal(42) }.must_raise Mini::Assertion
+  end
+
+  it "needs to verify floats within a delta" do
+    (6.0 * 7).must_be_close_to(42.0).must_equal true
+    proc { 42.002.must_be_close_to 42.0 }.must_raise Mini::Assertion
+  end
+
+  it "needs to verify types of objects" do
+    (6 * 7).must_be_instance_of(Fixnum).must_equal true
+    proc { (6 * 7).must_be_instance_of String }.must_raise Mini::Assertion
+  end
+
+  it "needs to verify kinds of objects" do
+    @assertion_count = 7
+
+    (6 * 7).must_be_kind_of(Fixnum).must_equal true
+    (6 * 7).must_be_kind_of(Numeric).must_equal true
+    proc { (6 * 7).must_be_kind_of String }.must_raise Mini::Assertion
+  end
+
+  it "needs to verify regexp matches" do
+    @assertion_count = 7
+    "blah".must_match(/\w+/).must_equal true
+    proc { "blah".must_match(/\d+/) }.must_raise Mini::Assertion
+  end
+
+  it "needs to verify nil" do
+    nil.must_be_nil.must_equal true
+    proc { 42.must_be_nil }.must_raise Mini::Assertion
+  end
+
+  it "needs to verify using any operator" do
+    41.must_be(:<, 42).must_equal true
+    proc { 42.must_be(:<, 41) }.must_raise Mini::Assertion
+  end
+
+  it "needs to catch an expected exception" do
+    @assertion_count = 4
+
+    proc { raise "blah" }.must_raise RuntimeError
+    proc { raise Mini::Assertion }.must_raise Mini::Assertion
+  end
+
+  it "needs to catch an unexpected exception" do
+    @assertion_count = 4
+
+    proc {
+      proc { raise Mini::Assertion }.must_raise(RuntimeError)
+    }.must_raise Mini::Assertion
+  end
+
+  it "needs raise if an expected exception is not raised" do
+    @assertion_count = 3
+
+    proc { proc { 42 }.must_raise(RuntimeError) }.must_raise Mini::Assertion
+  end
+
+  it "needs to be able to catch a Mini::Assertion exception" do
+    @assertion_count = 3
+
+    proc { 1.wont_equal 1 }.must_raise Mini::Assertion
+  end
+
+  it "needs to verify using respond_to" do
+    42.must_respond_to(:+).must_equal true
+    proc { 42.must_respond_to(:clear) }.must_raise Mini::Assertion
+  end
+
+  it "needs to verify identity" do
+    1.must_be_same_as(1).must_equal true
+    proc { 1.must_be_same_as 2 }.must_raise Mini::Assertion
+  end
+
+  it "needs to verify throw" do
+    @assertion_count = 8
+
+    proc { throw :blah }.must_throw(:blah).must_equal true
+    proc { proc { }.must_throw(:blah) }.must_raise Mini::Assertion
+    proc { proc { throw :xxx }.must_throw(:blah) }.must_raise Mini::Assertion
+  end
+
+  it "needs to verify inequality" do
+    42.wont_equal(6 * 9).must_equal false
+    proc { 1.wont_equal 1 }.must_raise Mini::Assertion
+  end
+
+  it "needs to verify mismatch" do
+    "blah".wont_match(/\d+/).must_equal false
+    proc { "blah".wont_match(/\w+/) }.must_raise Mini::Assertion
+  end
+
+  it "needs to verify non-nil" do
+    42.wont_be_nil.must_equal false
+    proc { nil.wont_be_nil }.must_raise Mini::Assertion
+  end
+
+  it "needs to verify non-identity" do
+    1.wont_be_same_as(2).must_equal false
+    proc { 1.wont_be_same_as 1 }.must_raise Mini::Assertion
+  end
+end
Index: test/mini/test_mini_test.rb
===================================================================
--- test/mini/test_mini_test.rb	(revision 0)
+++ test/mini/test_mini_test.rb	(revision 19673)
@@ -0,0 +1,857 @@
+############################################################
+# This file is imported from a different project.
+# DO NOT make modifications in this repo.
+# File a patch instead and assign it to Ryan Davis
+############################################################
+
+require 'stringio'
+require 'mini/test'
+
+Mini::Test.autorun
+
+class TestMiniTest < Mini::Test::TestCase
+
+  def setup
+    srand 42
+    Mini::Test::TestCase.reset
+    @tu = Mini::Test.new
+    @output = StringIO.new("")
+    Mini::Test.output = @output
+    assert_equal [0, 0], @tu.run_test_suites
+  end
+
+  def teardown
+    Mini::Test.output = $stdout
+    Object.send :remove_const, :ATestCase if defined? ATestCase
+  end
+
+  BT_MIDDLE = ["./lib/mini/test.rb:165:in `run_test_suites'",
+               "./lib/mini/test.rb:161:in `each'",
+               "./lib/mini/test.rb:161:in `run_test_suites'",
+               "./lib/mini/test.rb:158:in `each'",
+               "./lib/mini/test.rb:158:in `run_test_suites'",
+               "./lib/mini/test.rb:139:in `run'",
+               "./lib/mini/test.rb:106:in `run'"]
+
+  def test_filter_backtrace
+    # this is a semi-lame mix of relative paths.
+    # I cheated by making the autotest parts not have ./
+    bt = (["lib/autotest.rb:571:in `add_exception'",
+           "test/test_autotest.rb:62:in `test_add_exception'",
+           "./lib/mini/test.rb:165:in `__send__'"] +
+          BT_MIDDLE +
+          ["./lib/mini/test.rb:29",
+           "test/test_autotest.rb:422"])
+    bt = util_expand_bt bt
+
+    ex = ["lib/autotest.rb:571:in `add_exception'",
+          "test/test_autotest.rb:62:in `test_add_exception'"]
+    ex = util_expand_bt ex
+
+    fu = Mini::filter_backtrace(bt)
+
+    assert_equal ex, fu
+  end
+
+  def util_expand_bt bt
+    if RUBY_VERSION =~ /^1\.9/ then
+      bt.map { |f| (f =~ /^\./) ? File.expand_path(f) : f }
+    else
+      bt
+    end
+  end
+
+  def test_filter_backtrace_all_unit
+    bt = (["./lib/mini/test.rb:165:in `__send__'"] +
+          BT_MIDDLE +
+          ["./lib/mini/test.rb:29"])
+    ex = bt.clone
+    fu = Mini::filter_backtrace(bt)
+    assert_equal ex, fu
+  end
+
+  def test_filter_backtrace_unit_starts
+    bt = (["./lib/mini/test.rb:165:in `__send__'"] +
+          BT_MIDDLE +
+          ["./lib/mini/test.rb:29",
+           "-e:1"])
+
+    bt = util_expand_bt bt
+
+    ex = ["-e:1"]
+    fu = Mini::filter_backtrace(bt)
+    assert_equal ex, fu
+  end
+
+  def test_class_puke_with_assertion_failed
+    exception = Mini::Assertion.new "Oh no!"
+    exception.set_backtrace ["unhappy"]
+    assert_equal 'F', @tu.puke('SomeClass', 'method_name', exception)
+    assert_equal 1, @tu.failures
+    assert_match(/^Failure.*Oh no!/m, @tu.report.first)
+  end
+
+  def test_class_puke_with_failure_and_flunk_in_backtrace
+    exception = begin
+                  Mini::Test::TestCase.new('fake tc').flunk
+                rescue Mini::Assertion => failure
+                  failure
+                end
+    assert_equal 'F', @tu.puke('SomeClass', 'method_name', exception)
+    refute @tu.report.any?{|line| line =~ /in .flunk/}
+  end
+
+  def test_class_puke_with_non_failure_exception
+    exception = Exception.new("Oh no again!")
+    assert_equal 'E', @tu.puke('SomeClass', 'method_name', exception)
+    assert_equal 1, @tu.errors
+    assert_match(/^Exception.*Oh no again!/m, @tu.report.first)
+  end
+
+  def test_class_run_test_suites
+    tc = Class.new(Mini::Test::TestCase) do
+      def test_something
+        assert true
+      end
+    end
+
+    Object.const_set(:ATestCase, tc)
+
+    assert_equal [1, 1], @tu.run_test_suites
+  end
+
+  def test_run_failing # TODO: add error test
+    tc = Class.new(Mini::Test::TestCase) do
+      def test_something
+        assert true
+      end
+
+      def test_failure
+        assert false
+      end
+    end
+
+    Object.const_set(:ATestCase, tc)
+
+    @tu.run
+
+    expected = "Loaded suite blah
+Started
+F.
+Finished in 0.00
+
+  1) Failure:
+test_failure(ATestCase) [FILE:LINE]:
+Failed assertion, no message given.
+
+2 tests, 2 assertions, 1 failures, 0 errors, 0 skips
+"
+    util_assert_report expected
+  end
+
+  def test_run_error
+    tc = Class.new(Mini::Test::TestCase) do
+      def test_something
+        assert true
+      end
+
+      def test_error
+        raise "unhandled exception"
+      end
+    end
+
+    Object.const_set(:ATestCase, tc)
+
+    @tu.run
+
+    expected = "Loaded suite blah
+Started
+E.
+Finished in 0.00
+
+  1) Error:
+test_error(ATestCase):
+RuntimeError: unhandled exception
+    FILE:LINE:in `test_error'
+
+2 tests, 1 assertions, 0 failures, 1 errors, 0 skips
+"
+    util_assert_report expected
+  end
+
+  def test_run_error_teardown
+    tc = Class.new(Mini::Test::TestCase) do
+      def test_something
+        assert true
+      end
+
+      def teardown
+        raise "unhandled exception"
+      end
+    end
+
+    Object.const_set(:ATestCase, tc)
+
+    @tu.run
+
+    expected = "Loaded suite blah
+Started
+E
+Finished in 0.00
+
+  1) Error:
+test_something(ATestCase):
+RuntimeError: unhandled exception
+    FILE:LINE:in `teardown'
+
+1 tests, 1 assertions, 0 failures, 1 errors, 0 skips
+"
+    util_assert_report expected
+  end
+
+  def test_run_skip
+    tc = Class.new(Mini::Test::TestCase) do
+      def test_something
+        assert true
+      end
+
+      def test_skip
+        skip "not yet"
+      end
+    end
+
+    Object.const_set(:ATestCase, tc)
+
+    @tu.run
+
+    expected = "Loaded suite blah
+Started
+S.
+Finished in 0.00
+
+  1) Skipped:
+test_skip(ATestCase) [FILE:LINE]:
+not yet
+
+2 tests, 1 assertions, 0 failures, 0 errors, 1 skips
+"
+    util_assert_report expected
+  end
+
+  def util_assert_report expected = nil
+    expected ||= "Loaded suite blah
+Started
+.
+Finished in 0.00
+
+1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
+"
+    output = @output.string.sub(/Finished in .*/, "Finished in 0.00")
+    output.sub!(/Loaded suite .*/, 'Loaded suite blah')
+    output.sub!(/[\w\/\.]+:\d+/, 'FILE:LINE')
+    assert_equal(expected, output)
+  end
+
+  def test_run_failing_filtered
+    tc = Class.new(Mini::Test::TestCase) do
+      def test_something
+        assert true
+      end
+
+      def test_failure
+        assert false
+      end
+    end
+
+    Object.const_set(:ATestCase, tc)
+
+    @tu.run(%w(-n /something/))
+
+    util_assert_report
+  end
+
+  def test_run_passing
+    tc = Class.new(Mini::Test::TestCase) do
+      def test_something
+        assert true
+      end
+    end
+
+    Object.const_set(:ATestCase, tc)
+
+    @tu.run
+
+    util_assert_report
+  end
+end
+
+class TestMiniTestTestCase < Mini::Test::TestCase
+  def setup
+    Mini::Test::TestCase.reset
+
+    @tc = Mini::Test::TestCase.new 'fake tc'
+    @zomg = "zomg ponies!"
+    @assertion_count = 1
+  end
+
+  def teardown
+    assert_equal(@assertion_count, @tc._assertions,
+                 "expected #{@assertion_count} assertions to be fired during the test, not #{@tc._assertions}") if @tc._assertions
+    Object.send :remove_const, :ATestCase if defined? ATestCase
+  end
+
+  def test_class_inherited
+    @assertion_count = 0
+
+    Object.const_set(:ATestCase, Class.new(Mini::Test::TestCase))
+
+    assert_equal [ATestCase], Mini::Test::TestCase.test_suites
+  end
+
+  def test_class_test_suites
+    @assertion_count = 0
+
+    Object.const_set(:ATestCase, Class.new(Mini::Test::TestCase))
+
+    assert_equal 1, Mini::Test::TestCase.test_suites.size
+    assert_equal [ATestCase], Mini::Test::TestCase.test_suites
+  end
+
+  def test_class_asserts_match_refutes
+    @assertion_count = 0
+
+    methods = Mini::Assertions.public_instance_methods
+    methods.map! { |m| m.to_s } if Symbol === methods.first
+
+    ignores = %w(assert_block assert_no_match assert_not_equal assert_not_nil
+                 assert_not_same assert_nothing_thrown assert_raise
+                 assert_nothing_raised assert_raises assert_throws assert_send)
+    asserts = methods.grep(/^assert/).sort - ignores
+    refutes = methods.grep(/^refute/).sort - ignores
+
+    assert_empty refutes.map { |n| n.sub(/^refute/, 'assert') } - asserts
+    assert_empty asserts.map { |n| n.sub(/^assert/, 'refute') } - refutes
+  end
+
+  def test_assert
+    @assertion_count = 2
+
+    @tc.assert_equal true, @tc.assert(true), "returns true on success"
+  end
+
+  def test_assert__triggered
+    util_assert_triggered "Failed assertion, no message given." do
+      @tc.assert false
+    end
+  end
+
+  def test_assert__triggered_message
+    util_assert_triggered @zomg do
+      @tc.assert false, @zomg
+    end
+  end
+
+  def test_assert_block
+    @tc.assert_block do
+      true
+    end
+  end
+
+  def test_assert_block_triggered
+    util_assert_triggered 'Expected block to return true value.' do
+      @tc.assert_block do
+        false
+      end
+    end
+  end
+
+  def test_assert_empty
+    @assertion_count = 2
+
+    @tc.assert_empty []
+  end
+
+  def test_assert_empty_triggered
+    @assertion_count = 2
+
+    util_assert_triggered "Expected [1] to be empty." do
+      @tc.assert_empty [1]
+    end
+  end
+
+  def test_assert_equal
+    @tc.assert_equal 1, 1
+  end
+
+  def test_assert_equal_different
+    util_assert_triggered "Expected 1, not 2." do
+      @tc.assert_equal 1, 2
+    end
+  end
+
+  def test_assert_in_delta
+    @tc.assert_in_delta 0.0, 1.0 / 1000, 0.1
+  end
+
+  def test_assert_in_delta_triggered
+    util_assert_triggered 'Expected 0.0 - 0.001 (0.001) to be < 1.0e-06.' do
+      @tc.assert_in_delta 0.0, 1.0 / 1000, 0.000001
+    end
+  end
+
+  def test_assert_in_epsilon
+    @assertion_count = 8
+
+    @tc.assert_in_epsilon 10000, 9991
+    @tc.assert_in_epsilon 9991, 10000
+    @tc.assert_in_epsilon 1.0, 1.001
+    @tc.assert_in_epsilon 1.001, 1.0
+
+    @tc.assert_in_epsilon 10000, 9999.1, 0.0001
+    @tc.assert_in_epsilon 9999.1, 10000, 0.0001
+    @tc.assert_in_epsilon 1.0, 1.0001, 0.0001
+    @tc.assert_in_epsilon 1.0001, 1.0, 0.0001
+  end
+
+  def test_assert_in_epsilon_triggered
+    util_assert_triggered 'Expected 10000 - 9990 (10) to be < 9.99.' do
+      @tc.assert_in_epsilon 10000, 9990
+    end
+  end
+
+  def test_assert_includes
+    @assertion_count = 2
+
+    @tc.assert_includes [true], true
+  end
+
+  def test_assert_includes_triggered
+    @assertion_count = 4
+
+    e = @tc.assert_raises Mini::Assertion do
+      @tc.assert_includes [true], false
+    end
+
+    expected = "Expected [true] to include false."
+    assert_equal expected, e.message
+  end
+
+  def test_assert_instance_of
+    @tc.assert_instance_of String, "blah"
+  end
+
+  def test_assert_instance_of_triggered
+    util_assert_triggered 'Expected "blah" to be an instance of Array, not String.' do
+      @tc.assert_instance_of Array, "blah"
+    end
+  end
+
+  def test_assert_kind_of
+    @tc.assert_kind_of String, "blah"
+  end
+
+  def test_assert_kind_of_triggered
+    util_assert_triggered 'Expected "blah" to be a kind of Array, not String.' do
+      @tc.assert_kind_of Array, "blah"
+    end
+  end
+
+  def test_assert_match
+    @assertion_count = 2
+    @tc.assert_match "blah blah blah", /\w+/
+  end
+
+  def test_assert_match_triggered
+    @assertion_count = 2
+    util_assert_triggered 'Expected /\d+/ to match "blah blah blah".' do
+      @tc.assert_match "blah blah blah", /\d+/
+    end
+  end
+
+  def test_assert_nil
+    @tc.assert_nil nil
+  end
+
+  def test_assert_nil_triggered
+    util_assert_triggered 'Expected 42 to be nil.' do
+      @tc.assert_nil 42
+    end
+  end
+
+  def test_assert_operator
+    @tc.assert_operator 2, :>, 1
+  end
+
+  def test_assert_operator_triggered
+    util_assert_triggered "Expected 2 to be < 1." do
+      @tc.assert_operator 2, :<, 1
+    end
+  end
+
+  def test_assert_raises
+    @assertion_count = 2
+
+    @tc.assert_raises RuntimeError do
+      raise "blah"
+    end
+  end
+
+  def test_assert_raises_triggered_different
+    @assertion_count = 2
+
+    e = assert_raises Mini::Assertion do
+      @tc.assert_raises RuntimeError do
+        raise SyntaxError, "icky"
+      end
+    end
+
+    expected = "<[RuntimeError]> exception expected, not
+Class: <SyntaxError>
+Message: <\"icky\">
+---Backtrace---
+FILE:LINE:in `test_assert_raises_triggered_different'
+---------------.
+Expected [RuntimeError] to include SyntaxError."
+
+    assert_equal expected, expected.gsub(/[\w\/\.]+:\d+/, 'FILE:LINE')
+  end
+
+  def test_assert_raises_triggered_none
+    e = assert_raises Mini::Assertion do
+      @tc.assert_raises Mini::Assertion do
+        # do nothing
+      end
+    end
+
+    expected = "Mini::Assertion expected but nothing was raised."
+
+    assert_equal expected, e.message
+  end
+
+  def test_assert_respond_to
+    @tc.assert_respond_to "blah", :empty?
+  end
+
+  def test_assert_respond_to_triggered
+    util_assert_triggered 'Expected "blah" (String) to respond to #rawr!.' do
+      @tc.assert_respond_to "blah", :rawr!
+    end
+  end
+
+  def test_assert_same
+    @assertion_count = 3
+
+    o = "blah"
+    @tc.assert_same 1, 1
+    @tc.assert_same :blah, :blah
+    @tc.assert_same o, o
+  end
+
+  def test_assert_same_triggered
+    @assertion_count = 2
+
+    util_assert_triggered 'Expected 2 (0xXXX) to be the same as 1 (0xXXX).' do
+      @tc.assert_same 1, 2
+    end
+
+    s1 = "blah"
+    s2 = "blah"
+
+    util_assert_triggered 'Expected "blah" (0xXXX) to be the same as "blah" (0xXXX).' do
+      @tc.assert_same s1, s2
+    end
+  end
+
+  def test_assert_send
+    @tc.assert_send [1, :<, 2]
+  end
+
+  def test_assert_send_bad
+    util_assert_triggered "Expected 1.>(*[2]) to return true." do
+      @tc.assert_send [1, :>, 2]
+    end
+  end
+
+  def test_assert_throws
+    @tc.assert_throws(:blah) do
+      throw :blah
+    end
+  end
+
+  def test_assert_throws_different
+    util_assert_triggered 'Expected :blah to have been thrown, not :not_blah.' do
+      @tc.assert_throws(:blah) do
+        throw :not_blah
+      end
+    end
+  end
+
+  def test_assert_throws_unthrown
+    util_assert_triggered 'Expected :blah to have been thrown.' do
+      @tc.assert_throws(:blah) do
+        # do nothing
+      end
+    end
+  end
+
+  def test_capture_io
+    @assertion_count = 0
+
+    out, err = capture_io do
+      puts 'hi'
+      warn 'bye!'
+    end
+
+    assert_equal "hi\n", out
+    assert_equal "bye!\n", err
+  end
+
+  def test_flunk
+    util_assert_triggered 'Epic Fail!' do
+      @tc.flunk
+    end
+  end
+
+  def test_flunk_message
+    util_assert_triggered @zomg do
+      @tc.flunk @zomg
+    end
+  end
+
+  def test_message
+    @assertion_count = 0
+
+    assert_equal "blah2.",         @tc.message { "blah2" }.call
+    assert_equal "blah2.",         @tc.message("") { "blah2" }.call
+    assert_equal "blah1.\nblah2.", @tc.message("blah1") { "blah2" }.call
+  end
+
+  def test_pass
+    @tc.pass
+  end
+
+  def test_test_methods_sorted
+    @assertion_count = 0
+
+    sample_test_case = Class.new(Mini::Test::TestCase)
+
+    class << sample_test_case
+      def test_order; :sorted end
+    end
+
+    sample_test_case.instance_eval do
+      define_method :test_test3 do assert "does not matter" end
+      define_method :test_test2 do assert "does not matter" end
+      define_method :test_test1 do assert "does not matter" end
+    end
+
+    expected = %w(test_test1 test_test2 test_test3)
+    assert_equal expected, sample_test_case.test_methods
+  end
+
+  def test_test_methods_random
+    @assertion_count = 0
+
+    sample_test_case = Class.new(Mini::Test::TestCase)
+
+    class << sample_test_case
+      def test_order; :random end
+    end
+
+    sample_test_case.instance_eval do
+      define_method :test_test1 do assert "does not matter" end
+      define_method :test_test2 do assert "does not matter" end
+      define_method :test_test3 do assert "does not matter" end
+    end
+
+    srand 42
+    expected = %w(test_test1 test_test2 test_test3)
+    max = expected.size
+    expected = expected.sort_by { rand(max) }
+
+    srand 42
+    result = sample_test_case.test_methods
+
+    assert_equal expected, result
+  end
+
+  def test_refute
+    @assertion_count = 2
+
+    @tc.assert_equal false, @tc.refute(false), "returns false on success"
+  end
+
+  def test_refute_empty
+    @assertion_count = 2
+
+    @tc.refute_empty [1]
+  end
+
+  def test_refute_empty_triggered
+    @assertion_count = 2
+
+    util_assert_triggered "Expected [] to not be empty." do
+      @tc.refute_empty []
+    end
+  end
+
+  def test_refute_equal
+    @tc.refute_equal "blah", "yay"
+  end
+
+  def test_refute_equal_triggered
+    util_assert_triggered 'Expected "blah" to not be equal to "blah".' do
+      @tc.refute_equal "blah", "blah"
+    end
+  end
+
+  def test_refute_in_delta
+    @tc.refute_in_delta 0.0, 1.0 / 1000, 0.000001
+  end
+
+  def test_refute_in_delta_triggered
+    util_assert_triggered 'Expected 0.0 - 0.001 (0.001) to not be < 0.1.' do
+      @tc.refute_in_delta 0.0, 1.0 / 1000, 0.1
+    end
+  end
+
+  def test_refute_in_epsilon
+    @tc.refute_in_epsilon 10000, 9990
+  end
+
+  def test_refute_in_epsilon_triggered
+    util_assert_triggered 'Expected 10000 - 9991 (9) to not be < 10.0.' do
+      @tc.refute_in_epsilon 10000, 9991
+      fail
+    end
+  end
+
+  def test_refute_includes
+    @assertion_count = 2
+
+    @tc.refute_includes [true], false
+  end
+
+  def test_refute_includes_triggered
+    @assertion_count = 4
+
+    e = @tc.assert_raises Mini::Assertion do
+      @tc.refute_includes [true], true
+    end
+
+    expected = "Expected [true] to not include true."
+    assert_equal expected, e.message
+  end
+
+  def test_refute_instance_of
+    @tc.refute_instance_of Array, "blah"
+  end
+
+  def test_refute_instance_of_triggered
+    util_assert_triggered 'Expected "blah" to not be an instance of String.' do
+      @tc.refute_instance_of String, "blah"
+    end
+  end
+
+  def test_refute_kind_of
+    @tc.refute_kind_of Array, "blah"
+  end
+
+  def test_refute_kind_of_triggered
+    util_assert_triggered 'Expected "blah" to not be a kind of String.' do
+      @tc.refute_kind_of String, "blah"
+    end
+  end
+
+  def test_refute_match
+    @tc.refute_match "blah blah blah", /\d+/
+  end
+
+  def test_refute_match_triggered
+    util_assert_triggered 'Expected /\w+/ to not match "blah blah blah".' do
+      @tc.refute_match "blah blah blah", /\w+/
+    end
+  end
+
+  def test_refute_nil
+    @tc.refute_nil 42
+  end
+
+  def test_refute_nil_triggered
+    util_assert_triggered 'Expected nil to not be nil.' do
+      @tc.refute_nil nil
+    end
+  end
+
+  def test_refute_operator
+    @tc.refute_operator 2, :<, 1
+  end
+
+  def test_refute_operator_triggered
+    util_assert_triggered "Expected 2 to not be > 1." do
+      @tc.refute_operator 2, :>, 1
+    end
+  end
+
+  def test_refute_respond_to
+    @tc.refute_respond_to "blah", :rawr!
+  end
+
+  def test_refute_respond_to_triggered
+    util_assert_triggered 'Expected "blah" to not respond to empty?.' do
+      @tc.refute_respond_to "blah", :empty?
+    end
+  end
+
+  def test_refute_same
+    @tc.refute_same 1, 2
+  end
+
+  # TODO: "with id <id>" crap from assertions.rb
+  def test_refute_same_triggered
+    util_assert_triggered 'Expected 1 to not be the same as 1.' do
+      @tc.refute_same 1, 1
+    end
+  end
+
+  def test_skip
+    @assertion_count = 0
+
+    util_assert_triggered "haha!", Mini::Skip do
+      @tc.skip "haha!"
+    end
+  end
+
+  def util_assert_triggered expected, klass = Mini::Assertion
+    e = assert_raises(klass) do
+      yield
+    end
+
+    msg = e.message.sub(/(---Backtrace---).*/m, '\1')
+    msg.gsub!(/\(0x[0-9a-f]+\)/, '(0xXXX)')
+
+    assert_equal expected, msg
+  end
+
+  if ENV['DEPRECATED'] then
+    require 'test/unit/assertions'
+    def test_assert_nothing_raised
+      @tc.assert_nothing_raised do
+        # do nothing
+      end
+    end
+
+    def test_assert_nothing_raised_triggered
+      expected = 'Exception raised:
+Class: <RuntimeError>
+Message: <"oops!">
+---Backtrace---'
+
+      util_assert_triggered expected do
+        @tc.assert_nothing_raised do
+          raise "oops!"
+        end
+      end
+    end
+  end
+end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]