ruby-changes:52509
From: hsbt <ko1@a...>
Date: Thu, 13 Sep 2018 16:13:31 +0900 (JST)
Subject: [ruby-changes:52509] hsbt:r64726: Move testunit branch to tags.
hsbt 2018-09-13 16:04:15 +0900 (Thu, 13 Sep 2018) New Revision: 64726 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64726 Log: Move testunit branch to tags. Added directories: tags/testunit/ Removed directories: branches/testunit/ Index: testunit/lib/runit/cui/testrunner.rb =================================================================== --- testunit/lib/runit/cui/testrunner.rb (revision 64725) +++ testunit/lib/runit/cui/testrunner.rb (nonexistent) @@ -1,51 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/testunit/lib/runit/cui/testrunner.rb#L0 -# Author:: Nathaniel Talbott. -# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. -# License:: Ruby license. - -require 'test/unit/ui/console/testrunner' -require 'runit/testresult' - -module RUNIT - module CUI - class TestRunner < Test::Unit::UI::Console::TestRunner - @@quiet_mode = false - - def self.run(suite) - self.new().run(suite) - end - - def initialize - super nil - end - - def run(suite, quiet_mode=@@quiet_mode) - @suite = suite - def @suite.suite - self - end - @output_level = (quiet_mode ? PROGRESS_ONLY : NORMAL) - start - end - - def create_mediator(suite) - mediator = Test::Unit::UI::TestRunnerMediator.new(suite) - class << mediator - attr_writer :result_delegate - def create_result - return @result_delegate.create_result - end - end - mediator.result_delegate = self - return mediator - end - - def create_result - return RUNIT::TestResult.new - end - - def self.quiet_mode=(boolean) - @@quiet_mode = boolean - end - end - end -end Property changes on: testunit/lib/runit/cui/testrunner.rb ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Author Date Id Revision \ No newline at end of property Index: testunit/lib/runit/testresult.rb =================================================================== --- testunit/lib/runit/testresult.rb (revision 64725) +++ testunit/lib/runit/testresult.rb (nonexistent) @@ -1,44 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/testunit/lib/runit/testresult.rb#L0 -# Author:: Nathaniel Talbott. -# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. -# License:: Ruby license. - -require 'test/unit/testresult' - -module RUNIT - class TestResult < Test::Unit::TestResult - attr_reader(:errors, :failures) - def succeed? - return passed? - end - def failure_size - return failure_count - end - def run_asserts - return assertion_count - end - def error_size - return error_count - end - def run_tests - return run_count - end - def add_failure(failure) - def failure.at - return location - end - def failure.err - return message - end - super(failure) - end - def add_error(error) - def error.at - return location - end - def error.err - return exception - end - super(error) - end - end -end Property changes on: testunit/lib/runit/testresult.rb ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Author Date Id Revision \ No newline at end of property Index: testunit/lib/runit/assert.rb =================================================================== --- testunit/lib/runit/assert.rb (revision 64725) +++ testunit/lib/runit/assert.rb (nonexistent) @@ -1,71 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/testunit/lib/runit/assert.rb#L0 -# Author:: Nathaniel Talbott. -# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. -# License:: Ruby license. - -require 'test/unit/assertions' -require 'runit/error' - -module RUNIT - module Assert - include Test::Unit::Assertions - - def setup_assert - end - - def assert_no_exception(*args, &block) - assert_nothing_raised(*args, &block) - end - - # To deal with the fact that RubyUnit does not check that the regular expression - # is, indeed, a regular expression, if it is not, we do our own assertion using - # the same semantics as RubyUnit - def assert_match(actual_string, expected_re, message="") - _wrap_assertion { - full_message = build_message(message, actual_string, expected_re) { - | arg1, arg2 | - "Expected <#{arg1}> to match <#{arg2}>" - } - assert_block(full_message) { - expected_re =~ actual_string - } - Regexp.last_match - } - end - - def assert_not_match(actual_string, expected_re, message="") - assert_no_match(expected_re, actual_string, message) - end - - def assert_matches(*args) - assert_match(*args) - end - - def assert_fail(message="") - flunk(message) - end - - def assert_equal_float(expected, actual, delta, message="") - assert_in_delta(expected, actual, delta, message) - end - - def assert_send(object, method, *args) - super([object, method, *args]) - end - - def assert_exception(exception, message="", &block) - assert_raises(exception, message, &block) - end - - def assert_respond_to(method, object, message="") - if (called_internally?) - super - else - super(object, method, message) - end - end - - def called_internally? - /assertions\.rb/.match(caller[1]) - end - end -end Property changes on: testunit/lib/runit/assert.rb ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Author Date Id Revision \ No newline at end of property Index: testunit/lib/runit/topublic.rb =================================================================== --- testunit/lib/runit/topublic.rb (revision 64725) +++ testunit/lib/runit/topublic.rb (nonexistent) @@ -1,8 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/testunit/lib/runit/topublic.rb#L0 -# Author:: Nathaniel Talbott. -# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. -# License:: Ruby license. - -module RUNIT - module ToPublic - end -end Property changes on: testunit/lib/runit/topublic.rb ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Author Date Id Revision \ No newline at end of property Index: testunit/lib/runit/error.rb =================================================================== --- testunit/lib/runit/error.rb (revision 64725) +++ testunit/lib/runit/error.rb (nonexistent) @@ -1,9 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/testunit/lib/runit/error.rb#L0 -# Author:: Nathaniel Talbott. -# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. -# License:: Ruby license. - -require 'test/unit/assertionfailederror.rb' - -module RUNIT - AssertionFailedError = Test::Unit::AssertionFailedError -end Property changes on: testunit/lib/runit/error.rb ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Author Date Id Revision \ No newline at end of property Index: testunit/lib/runit/testsuite.rb =================================================================== --- testunit/lib/runit/testsuite.rb (revision 64725) +++ testunit/lib/runit/testsuite.rb (nonexistent) @@ -1,26 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/testunit/lib/runit/testsuite.rb#L0 -# Author:: Nathaniel Talbott. -# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. -# License:: Ruby license. - -require 'test/unit/testsuite' - -module RUNIT - class TestSuite < Test::Unit::TestSuite - def add_test(*args) - add(*args) - end - - def add(*args) - self.<<(*args) - end - - def count_test_cases - return size - end - - def run(result, &progress_block) - progress_block = proc {} unless (block_given?) - super(result, &progress_block) - end - end -end Property changes on: testunit/lib/runit/testsuite.rb ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Author Date Id Revision \ No newline at end of property Index: testunit/lib/runit/testcase.rb =================================================================== --- testunit/lib/runit/testcase.rb (revision 64725) +++ testunit/lib/runit/testcase.rb (nonexistent) @@ -1,45 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/testunit/lib/runit/testcase.rb#L0 -# Author:: Nathaniel Talbott. -# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. -# License:: Ruby license. - -require 'runit/testresult' -require 'runit/testsuite' -require 'runit/assert' -require 'runit/error' -require 'test/unit/testcase' - -module RUNIT - class TestCase < Test::Unit::TestCase - include RUNIT::Assert - - def self.suite - method_names = instance_methods(true) - tests = method_names.delete_if { |method_name| method_name !~ /^test/ } - suite = TestSuite.new(name) - tests.each { - |test| - catch(:invalid_test) { - suite << new(test, name) - } - } - return suite - end - - def initialize(test_name, suite_name=self.class.name) - super(test_name) - end - - def assert_equals(*args) - assert_equal(*args) - end - - def name - super.sub(/^(.*?)\((.*)\)$/, '\2#\1') - end - - def run(result, &progress_block) - progress_block = proc {} unless (block_given?) - super(result, &progress_block) - end - end -end Property changes on: testunit/lib/runit/testcase.rb ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Author Date Id Revision \ No newline at end of property Index: testunit/lib/rubyunit.rb =================================================================== --- testunit/lib/rubyunit.rb (revision 64725) +++ testunit/lib/rubyunit.rb (nonexistent) @@ -1,8 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/testunit/lib/rubyunit.rb#L0 -# Author:: Nathaniel Talbott. -# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. -# License:: Ruby license. - -require 'runit/testcase' -require 'test/unit' - -TestCase = RUNIT::TestCase Property changes on: testunit/lib/rubyunit.rb ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Author Date Id Revision \ No newline at end of property Index: testunit/lib/test/unit/error.rb =================================================================== --- testunit/lib/test/unit/error.rb (revision 64725) +++ testunit/lib/test/unit/error.rb (nonexistent) @@ -1,68 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/testunit/lib/test/unit/error.rb#L0 -# :nodoc: -# -# Author:: Nathaniel Talbott. -# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. -# License:: Ruby license. - -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 - attr_reader(:location, :exception) - - SINGLE_CHARACTER = 'E' - - # Creates a new Error with the given location and - # exception. - def initialize(location, exception) - @location = location - @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 - "#{@location}:\n#{message}" - end - - # Returns a verbose version of the error description. - def long_display - backtrace = self.class.filter(@exception.backtrace).join("\n ") - "Error!!!\n#{short_display}\n #{backtrace}" - end - - # Overridden to return long_display. - def to_s - long_display - end - - SEPARATOR_PATTERN = '[\\\/:]' - def self.filter(backtrace) # :nodoc: - @test_unit_patterns ||= $:.collect { - | path | - /^#{Regexp.escape(path)}#{SEPARATOR_PATTERN}test#{SEPARATOR_PATTERN}unit#{SEPARATOR_PATTERN}/ - }.push(/#{SEPARATOR_PATTERN}test#{SEPARATOR_PATTERN}unit\.rb/) - - return backtrace.delete_if { - | line | - @test_unit_patterns.detect { - | pattern | - line =~ pattern - } - } - end - end - end -end Property changes on: testunit/lib/test/unit/error.rb ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Author Date Id Revision \ No newline at end of property Index: testunit/lib/test/unit/testsuite.rb =================================================================== --- testunit/lib/test/unit/testsuite.rb (revision 64725) +++ testunit/lib/test/unit/testsuite.rb (nonexistent) @@ -1,64 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/testunit/lib/test/unit/testsuite.rb#L0 -# :nodoc: -# -# Author:: Nathaniel Talbott. -# Copyright:: Copyright (c) 2000-2002 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.sort { |test1, test2| test1.name <=> test2.name }.each do |test| - test.run(result, &progress_block) - end - yield(FINISHED, name) - end - - # Adds the test to the suite. - def <<(test) - @tests << 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 - - # Overriden to return the name given the suite at - # creation. - def to_s - @name - end - end - end -end Property changes on: testunit/lib/test/unit/testsuite.rb ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Author Date Id Revision \ No newline at end of property Index: testunit/lib/test/unit/assertions.rb =================================================================== --- testunit/lib/test/unit/assertions.rb (revision 64725) +++ testunit/lib/test/unit/assertions.rb (nonexistent) @@ -1,394 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/testunit/lib/test/unit/assertions.rb#L0 -# :nodoc: -# -# Author:: Nathaniel Talbott. -# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved. -# License:: Ruby license. - -require 'test/unit/assertionfailederror' - -module Test # :nodoc: - module Unit # :nodoc: - - # Contains all of the standard Test::Unit assertions. Mixed in - # to Test::Unit::TestCase. To mix it in and use its - # functionality, you simply need to rescue - # Test::Unit::AssertionFailedError, and you can additionally - # override add_assertion to be notified whenever an assertion - # is made. - # - # Notes: - # * The message to each assertion, if given, will be - # propagated with the failure. - # * It's easy to add your own assertions based on assert_block(). - module Assertions - - # The assertion upon which all other assertions are - # based. Passes if the block yields true. - public - def assert_block(message="") # :yields: - _wrap_assertion do - if (! yield) - raise AssertionFailedError.new(message.to_s) - end - end - end - - # Passes if boolean is true. - public - def assert(boolean, message="") - _wrap_assertion do - assert_block("assert should not be called with a block.") { !block_given? } - assert_block(message) { boolean } - end - 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. - public - def assert_equal(expected, actual, message=nil) - full_message = build_message(message, expected, actual) do |arg1, arg2| - "<#{arg1}> expected but was\n" + - "<#{arg2}>" - end - assert_block(full_message) { expected == actual } - end - - # Passes if block raises exception. - public - def assert_raises(expected_exception_klass, message="") - _wrap_assertion do - assert_instance_of(Class, expected_exception_klass, "Should expect a class of exception") - actual_exception = nil - full_message = build_message(message, expected_exception_klass) do |arg| - "<#{arg}> exception expected but none was thrown" - end - assert_block(full_message) do - thrown = false - begin - yield - rescue Exception => thrown_exception - actual_exception = thrown_exception - thrown = true - end - thrown - end - full_message = build_message(message, expected_exception_klass, actual_exception) do |arg1, arg2| - "<#{arg1}> exception expected but was\n" + - arg2 - end - assert_block(full_message) { expected_exception_klass == actual_exception.class } - actual_exception - end - end - - # Passes if object.class == klass. - 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, object, klass, object.class) do |arg1, arg2, arg3| - "<#{arg1}> expected to be an instance of\n" + - "<#{arg2}> but was\n" + - "<#{arg3}>" - end - assert_block(full_message) { klass == object.class } - end - end - - # Passes if object.nil?. - public - def assert_nil(object, message="") - assert_equal(nil, object, message) - end - - # Passes if object.kind_of?(klass). - public - def assert_kind_of(klass, (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/