Hello community, here is the log from the commit of package rubygem-test-unit for openSUSE:Factory checked in at 2017-06-08 15:00:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-test-unit (Old) and /work/SRC/openSUSE:Factory/.rubygem-test-unit.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-test-unit" Thu Jun 8 15:00:16 2017 rev:28 rq:497677 version:3.2.4 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-test-unit/rubygem-test-unit.changes 2016-12-11 13:28:44.343664153 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-test-unit.new/rubygem-test-unit.changes 2017-06-08 15:00:17.889928447 +0200 @@ -1,0 +2,70 @@ +Tue May 23 10:24:20 UTC 2017 - co...@suse.com + +- updated to version 3.2.4 + see installed news.md + + ## 3.2.4 - 2017-05-23 {#version-3-2-4} + + ### Improvements + + * Updated tests for Ruby 2.4. [GitHUb#136][Patch by Kazuki Tsujimoto] + + * Supported power\_assert 1.0.0. [GitHub#137][Patch by Kazuki Tsujimoto] + + * Added the getting started document. + [GitHub#139][GitHub#141][Patch by Hiroyuki Sato] + + * Added the document for `attribute`. + [GitHub#143][Patch by Fumiaki MATSUSHIMA] + + * Improved a link for GitHub. [GitHub#144][Patch by rochefort] + + * Updated `.travis.yml`. [GitHub#145][Patch by Jun Aruga] + + ### Fixes + + * Fixed a contributor name. [GitHub#131][Patch by Akira Matsuda] + + * Fixed typos in document. [GitHub#132][Patch by Akira Matsuda] + + * Fixed typos in document. [GitHub#134][Patch by Yuji Yaginuma] + + * Fixed a bug that data label with "(" isn't supported. + [GitHub#135][Reported by Kazuki Tsujimoto] + + * Fixed assertion message in English. + [GitHub#133][Reported by Khalil Fazal] + + * Fixed a typo in typo fix. [GitHub#138][Patch by kami] + + * Fixed a bug that target location finder may return wrong + location. [GitHub#146][Patch by Yuki Ito] + + * Fixed a bug that `--no-show-detail-immediately` raises an error. + [GitHub#147][Reported by MSP-Greg] + + ### Thanks + + * Akira Matsuda + + * Yuji Yaginuma + + * Kazuki Tsujimoto + + * Khalil Fazal + + * kami + + * Hiroyuki Sato + + * Fumiaki MATSUSHIMA + + * rochefort + + * Jun Aruga + + * Yuki Ito + + * MSP-Greg + +------------------------------------------------------------------- Old: ---- test-unit-3.2.3.gem New: ---- test-unit-3.2.4.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-test-unit.spec ++++++ --- /var/tmp/diff_new_pack.XrjXZ5/_old 2017-06-08 15:00:19.361720730 +0200 +++ /var/tmp/diff_new_pack.XrjXZ5/_new 2017-06-08 15:00:19.365720166 +0200 @@ -1,7 +1,7 @@ # # spec file for package rubygem-test-unit # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ # Name: rubygem-test-unit -Version: 3.2.3 +Version: 3.2.4 Release: 0 %define mod_name test-unit %define mod_full_name %{mod_name}-%{version} ++++++ test-unit-3.2.3.gem -> test-unit-3.2.4.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2016-11-25 13:44:09.000000000 +0100 +++ new/README.md 2017-05-23 04:40:04.000000000 +0200 @@ -34,7 +34,7 @@ ## How To -* [How To](doc/text/how-to.md) (link for GitHub) +* [How To](https://github.com/test-unit/test-unit/blob/master/doc/text/how-to.md) (link for GitHub) * {file:doc/text/how-to.md How To} (link for YARD) ## Install @@ -77,7 +77,7 @@ ### Images -* Mayu & Co.: kinotan icons: http://cocooooooon.com/kinotan/ +* Mayu & Co.: kinotan icons ## Thanks Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doc/text/getting-started.md new/doc/text/getting-started.md --- old/doc/text/getting-started.md 1970-01-01 01:00:00.000000000 +0100 +++ new/doc/text/getting-started.md 2017-05-23 04:40:04.000000000 +0200 @@ -0,0 +1,246 @@ +## 1. First step of the `test-unit` + +Let's getting start `test-unit`. + +This document creates an example gem package called `sample` with the `test-unit` testing framework. + +## 2. Install bundler and test-unit. + +* First, install the `bundler` gem for generating gem template. +* Second, install the `test-unit` itself. + +~~~ +!!!plain +gem install bundler +gem install test-unit +~~~ + +The `gem list` command output installed packages. +You will find the following lines. + +~~~ +!!!plain +gem list +... +bundler (1.14.6) +... +test-unit (3.2.3) +~~~ + +## 3. Create gem template. + +Next, create a gem template using `bundler` command. +This command generates package skeleton with a testing framework. +However, this command can't generate test templates for `test-unit`. + +So, First create gem template with the `minitest` testing framework. +(It's similar to `unit-test`). +After that, replace some files for `test-unit`. + +The `bundle gem -t minitest sample` command will generate the following files. + +~~~ +!!!plain +. +|-- Gemfile +|-- README.md +|-- Rakefile +|-- bin +| |-- console +| `-- setup +|-- lib +| |-- sample +| | `-- version.rb +| `-- sample.rb +|-- sample.gemspec # <- Modify +`-- test + |-- sample_test.rb # <- Modify + `-- test_helper.rb # <- Modify +~~~ + +## 4. Edit files for `test-unit` + +### 4.1. Edit gemspec + +Edit `sample.gemspec` like the below. +Replace `minitest` line to `test-unit`. + +Before + +~~~ +!!!ruby + spec.add_development_dependency "minitest", "~> 5.0" +~~~ + +After + +~~~ +!!!ruby + spec.add_development_dependency "test-unit", "~> 3.2.3" +~~~ + +### 4.2. Edit `test/test_helper.rb` + +Next, edit the `test/test_helper.rb` file. + +Before + +~~~ +!!!ruby +$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) +require 'sample' + +require 'minitest/autorun' # <-- Modify this line. +~~~ + +After + +~~~ +!!!ruby +$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) +require 'sample' + +require 'test/unit' # <-- After modification. +~~~ + +### 4.3 Rakefile (No edit) + +This file doesn't need to modify. +The output is the below. + +~~~ +!!!ruby +require "bundler/gem_tasks" +require "rake/testtask" + +Rake::TestTask.new(:test) do |t| + t.libs << "test" + t.libs << "lib" + t.test_files = FileList['test/**/*_test.rb'] +end + +task :default => :test +~~~ + +### 4.4 Edit `test/sample_test.rb` + +The bundler generate the file `test/sample_test.rb`. +This file originally templates for `minitest`. + +Let's modify this file for `test-unit` + +before + +~~~ +!!!ruby +require 'test_helper' + +class SampleTest < Minitest::Test # <- Modify here + def test_that_it_has_a_version_number + refute_nil ::Sample::VERSION + end + + def test_it_does_something_useful + assert false + end +end +~~~ + +After + +~~~ +!!!ruby +require 'test_helper' + +class SampleTest < Test::Unit::TestCase # <- After modification + def test_that_it_has_a_version_number + refute_nil ::Sample::VERSION + end + + def test_it_does_something_useful + assert false + end +end +~~~ + +## 5. Execute test. + +The `rake test` command execute test scenarios in the `test` directory. +Now it tries to two tests. One will success the other one fails. + +~~~ +!!!plain +rake test +Loaded suite +/path/to/ruby/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/rake_test_loader +Started +F +================================================================================ +Failure: <false> is not true. +test_it_does_something_useful(SampleTest) +/path/to/sample/test/sample_test.rb:9:in `test_it_does_something_useful' + 6: end + 7: + 8: def test_it_does_something_useful + => 9: assert false + 10: end + 11: end +================================================================================ +. + +Finished in 0.011521 seconds. +-------------------------------------------------------------------------------- +2 tests, 2 assertions, 1 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications +50% passed +-------------------------------------------------------------------------------- +173.60 tests/s, 173.60 assertions/s +rake aborted! +Command failed with status (1) + +Tasks: TOP => test +(See full trace by running task with --trace) +~~~ + +## 6. Create original tests. + +Let's create your original tests with the following rules. + +* Create a test file in the `test` directory. +* The file needs suffix `xxx_test.rb`. +* You can put test file into the subdirectory like `test/sub`. + +Example directory layout. + +~~~ +!!!plain +test +|-- sample_test.rb +|-- sub +| `-- sample2_test.rb +`-- test_helper.rb +~~~ + +Example test file in the sub directory. + +~~~ +!!!ruby +require 'test_helper' + +module Sub + class Sample2Test < Test::Unit::TestCase + def test_that_it_has_a_version_number + refute_nil ::Sample::VERSION + end + + def test_it_does_something_useful + assert false + end + end +end +~~~ + +## 7. For more inforomation + +Let's read the official document. + +* [test-unit](http://test-unit.github.io/index.html) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/doc/text/news.md new/doc/text/news.md --- old/doc/text/news.md 2016-11-25 13:44:09.000000000 +0100 +++ new/doc/text/news.md 2017-05-23 04:40:04.000000000 +0200 @@ -1,5 +1,69 @@ # News +## 3.2.4 - 2017-05-23 {#version-3-2-4} + +### Improvements + + * Updated tests for Ruby 2.4. [GitHUb#136][Patch by Kazuki Tsujimoto] + + * Supported power\_assert 1.0.0. [GitHub#137][Patch by Kazuki Tsujimoto] + + * Added the getting started document. + [GitHub#139][GitHub#141][Patch by Hiroyuki Sato] + + * Added the document for `attribute`. + [GitHub#143][Patch by Fumiaki MATSUSHIMA] + + * Improved a link for GitHub. [GitHub#144][Patch by rochefort] + + * Updated `.travis.yml`. [GitHub#145][Patch by Jun Aruga] + +### Fixes + + * Fixed a contributor name. [GitHub#131][Patch by Akira Matsuda] + + * Fixed typos in document. [GitHub#132][Patch by Akira Matsuda] + + * Fixed typos in document. [GitHub#134][Patch by Yuji Yaginuma] + + * Fixed a bug that data label with "(" isn't supported. + [GitHub#135][Reported by Kazuki Tsujimoto] + + * Fixed assertion message in English. + [GitHub#133][Reported by Khalil Fazal] + + * Fixed a typo in typo fix. [GitHub#138][Patch by kami] + + * Fixed a bug that target location finder may return wrong + location. [GitHub#146][Patch by Yuki Ito] + + * Fixed a bug that `--no-show-detail-immediately` raises an error. + [GitHub#147][Reported by MSP-Greg] + +### Thanks + + * Akira Matsuda + + * Yuji Yaginuma + + * Kazuki Tsujimoto + + * Khalil Fazal + + * kami + + * Hiroyuki Sato + + * Fumiaki MATSUSHIMA + + * rochefort + + * Jun Aruga + + * Yuki Ito + + * MSP-Greg + ## 3.2.3 - 2016-11-25 {#version-3-2-3} ### Fixes @@ -16,7 +80,7 @@ ### Improvements * Improved Travis CI configuration. - [GitHub#123][Patch by Ryunosuke SEATO] + [GitHub#123][Patch by Ryunosuke Sato] * Supported Java native exception. [GitHub#126][Reported by Bob Saveland] @@ -573,7 +637,7 @@ * Allowed use of test for inheritance in ActionController::TestCase. [GitHub#42] [Patch by David Rasch] - * Ensured evaluating at_exist block in top level. + * Ensured evaluating at_exit block in top level. In IRB context, exit() specifies irb_exit(). [test-unit-users-en:00089] [Reported by Daniel Berger] * Fixed a bug that decoration style description is ignored. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/test/unit/assertions.rb new/lib/test/unit/assertions.rb --- old/lib/test/unit/assertions.rb 2016-11-25 13:44:09.000000000 +0100 +++ new/lib/test/unit/assertions.rb 2017-05-23 04:40:04.000000000 +0200 @@ -334,7 +334,7 @@ "<#{value}>" end full_message = build_message(message, <<EOT, object, klass_message, object.class) -<?> expected to be instance_of\\? +<?> was expected to be instance_of\\? ? but was <?>. EOT @@ -370,7 +370,7 @@ "<#{value}>" end full_message = build_message(message, - "<?> expected to not be instance_of\\?\n" + + "<?> was expected to not be instance_of\\?\n" + "? but was.", object, klass_message) @@ -392,7 +392,7 @@ # assert_nil [1, 2].uniq! def assert_nil(object, message="") full_message = build_message(message, <<EOT, object) -<?> expected to be nil. +<?> was expected to be nil. EOT assert_block(full_message) { object.nil? } end @@ -421,7 +421,7 @@ "<#{value}>" end full_message = build_message(message, - "<?> expected to be kind_of\\?\n" + + "<?> was expected to be kind_of\\?\n" + "? but was\n" + "<?>.", object, @@ -459,7 +459,7 @@ "<#{value}>" end full_message = build_message(message, - "<?> expected to not be kind_of\\?\n" + + "<?> was expected to not be kind_of\\?\n" + "? but was.", object, klass_message) @@ -537,7 +537,8 @@ else pattern end - full_message = build_message(message, "<?> expected to be =~\n<?>.", + full_message = build_message(message, + "<?> was expected to be =~\n<?>.", pattern, string) assert_block(full_message) { pattern =~ string } end @@ -553,7 +554,7 @@ 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 <?> was expected to be equal\\? to <?> with id <?>. EOT @@ -572,7 +573,7 @@ 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 +<?> was expected to be ? <?>. EOT @@ -595,7 +596,7 @@ full_message = build_message(nil, "<?>\ngiven as the operator for #assert_not_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 not be +<?> was expected to not be ? <?>. EOT @@ -655,7 +656,7 @@ 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 <?> was expected to not be equal\\? to <?> with id <?>. EOT @@ -673,7 +674,9 @@ # @example # assert_not_equal 'some string', 5 def assert_not_equal(expected, actual, message="") - full_message = build_message(message, "<?> expected to be != to\n<?>.", expected, actual) + full_message = build_message(message, + "<?> was expected to be != to\n<?>.", + expected, actual) assert_block(full_message) { expected != actual } end @@ -688,7 +691,9 @@ # @example # assert_not_nil '1 two 3'.sub!(/two/, '2') def assert_not_nil(object, message="") - full_message = build_message(message, "<?> expected to not be nil.", object) + full_message = build_message(message, + "<?> was expected to not be nil.", + object) assert_block(full_message){!object.nil?} end @@ -709,7 +714,7 @@ "<REGEXP> in assert_not_match(<REGEXP>, ...) " + "should be a Regexp.") full_message = build_message(message, - "<?> expected to not match\n<?>.", + "<?> was expected to not match\n<?>.", regexp, string) assert_block(full_message) { regexp !~ string } end @@ -813,7 +818,7 @@ tag = extractor.extract_tag raise if tag.nil? full_message = build_message(message, - "<?> expected to be thrown but\n" + + "<?> was expected to be thrown but\n" + "<?> was thrown.", expected_object, tag) flunk(full_message) @@ -921,12 +926,12 @@ message, options={}) if options[:negative_assertion] format = <<-EOT -<?> -/+ <?> expected to not include +<?> -/+ <?> was expected to not include <?>. EOT else format = <<-EOT -<?> -/+ <?> expected to include +<?> -/+ <?> was expected to include <?>. EOT end @@ -1060,12 +1065,12 @@ if options[:negative_assertion] format = <<-EOT -<?> -/+ (<?> * <?>)[?] expected to not include +<?> -/+ (<?> * <?>)[?] was expected to not include <?>. EOT else format = <<-EOT -<?> -/+ (<?> * <?>)[?] expected to include +<?> -/+ (<?> * <?>)[?] was expected to include <?>. EOT end @@ -1130,7 +1135,7 @@ "assert_send requires at least a receiver " + "and a message name") format = <<EOT -<?> expected to respond to +<?> was expected to respond to <?(*?)> with a true value but was <?>. EOT @@ -1170,7 +1175,7 @@ "assert_not_send requires at least a receiver " + "and a message name") format = <<EOT -<?> expected to respond to +<?> was expected to respond to <?(*?)> with not a true value but was <?>. EOT @@ -1260,7 +1265,7 @@ end template = <<-EOT <?> #{operator} <?> should be true -<?> expected #{operator_description} +<?> was expected to be #{operator_description} <?>. EOT full_message = build_message(message, template, @@ -1305,7 +1310,7 @@ def assert_raise_message(expected, message=nil) _wrap_assertion do full_message = build_message(message, - "<?> exception message expected " + + "<?> exception message was expected " + "but none was thrown.", expected) exception = nil @@ -1475,7 +1480,7 @@ def assert_path_exist(path, message=nil) _wrap_assertion do failure_message = build_message(message, - "<?> expected to exist", + "<?> was expected to exist", path) assert_block(failure_message) do File.exist?(path) @@ -1493,7 +1498,7 @@ def assert_path_not_exist(path, message=nil) _wrap_assertion do failure_message = build_message(message, - "<?> expected to not exist", + "<?> was expected to not exist", path) assert_block(failure_message) do not File.exist?(path) @@ -1514,7 +1519,7 @@ assert_respond_to(collection, :include?, "The collection must respond to :include?.") full_message = build_message(message, - "<?> expected to include\n<?>.", + "<?> was expected to include\n<?>.", collection, object) assert_block(full_message) do @@ -1541,7 +1546,7 @@ assert_respond_to(collection, :include?, "The collection must respond to :include?.") full_message = build_message(message, - "<?> expected to not include\n<?>.", + "<?> was expected to not include\n<?>.", collection, object) assert_block(full_message) do @@ -1575,7 +1580,7 @@ assert_respond_to(object, :empty?, "The object must respond to :empty?.") full_message = build_message(message, - "<?> expected to be empty.", + "<?> was expected to be empty.", object) assert_block(full_message) do object.empty? @@ -1598,7 +1603,7 @@ assert_respond_to(object, :empty?, "The object must respond to :empty?.") full_message = build_message(message, - "<?> expected to not be empty.", + "<?> was expected to not be empty.", object) assert_block(full_message) do not object.empty? @@ -1666,7 +1671,7 @@ expected = assert_exception_helper.expected_exceptions actual_exception = nil full_message = build_message(message, - "<?> exception expected " + + "<?> exception was expected " + "but none was thrown.", expected) assert_block(full_message) do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/test/unit/attribute.rb new/lib/test/unit/attribute.rb --- old/lib/test/unit/attribute.rb 2016-11-25 13:44:09.000000000 +0100 +++ new/lib/test/unit/attribute.rb 2017-05-23 04:40:04.000000000 +0200 @@ -49,6 +49,70 @@ @current_attributes = kept_attributes end + # Set an attribute to test methods. + # + # @overload attribute(name, value) + # @example + # attribute :speed, :slow + # def test_my_slow_method + # self[:speed] # => :slow + # end + # + # @param [Object] name the attribute name + # @param [Object] value the attribute value + # @return [void] + # + # @overload attribute(name, value, *method_names) + # @example + # def test_my_slow_method1 + # self[:speed] # => :slow + # end + # + # attribute :speed, :slow, :test_my_slow_method1, :test_my_slow_method2 + # + # def test_my_slow_method2 + # self[:speed] # => :slow + # end + # + # @param [Object] name the attribute name + # @param [Object] value the attribute value + # @param [Array<Symbol, String>] method_names the test method names set the attribute + # @return [void] + # + # @overload attribute(name, value, options) + # @example + # attribute :speed, :slow, keep: true + # def test_my_slow_method1 + # self[:speed] # => :slow + # end + # + # def test_my_slow_method2 + # self[:speed] # => :slow + # end + # + # @param [Object] name the attribute name + # @param [Object] value the attribute value + # @option options [Boolean] :keep whether or not to set attribute to following test methods + # @return [void] + # + # @overload attribute(name, value, options, *method_names) + # @example + # def test_my_slow_method1 + # self[:speed] # => :slow + # end + # + # # There are no valid options for now. + # attribute :speed, :slow, {}, :test_my_slow_method1 + # + # def test_my_slow_method2 + # self[:speed] # => nil + # end + # + # @param [Object] name the attribute name + # @param [Object] value the attribute value + # @param [Hash] options ignored + # @param [Array<Symbol, String>] method_names the test method names set the attribute + # @return [void] def attribute(name, value, options={}, *method_names) unless options.is_a?(Hash) method_names << options diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/test/unit/autorunner.rb new/lib/test/unit/autorunner.rb --- old/lib/test/unit/autorunner.rb 2016-11-25 13:44:09.000000000 +0100 +++ new/lib/test/unit/autorunner.rb 2017-05-23 04:40:04.000000000 +0200 @@ -246,10 +246,7 @@ name = (%r{\A/(.*)/\Z} =~ name ? Regexp.new($1) : name) @filters << lambda do |test| return true if name === test.method_name - test_name_without_class_name = test.name.gsub(/\(.+?\)\z/, "") - if test_name_without_class_name != test.method_name - return true if name === test_name_without_class_name - end + return true if name === test.local_name false end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/test/unit/testcase.rb new/lib/test/unit/testcase.rb --- old/lib/test/unit/testcase.rb 2016-11-25 13:44:09.000000000 +0100 +++ new/lib/test/unit/testcase.rb 2017-05-23 04:40:04.000000000 +0200 @@ -82,6 +82,25 @@ # 1. cleanup # 1. teardown # 1. shutdown + # + # You can set an attribute to each test. + # + # Example: + # + # class TestMyClass < Test::Unit::TestCase + # attribute :speed, :fast + # def test_my_fast_method + # # You can get the attribute via `self[]` + # self[:speed] # => :fast + # ... + # end + # + # attribute :speed, :slow + # def test_my_slow_method + # self[:speed] # => :slow + # ... + # end + # end class TestCase include Attribute include Fixture @@ -320,7 +339,7 @@ # the same in meaning: # # Standard: - # class TestParent < Test::UnitTestCase + # class TestParent < Test::Unit::TestCase # class TestChild < self # def test_in_child # end @@ -328,7 +347,7 @@ # end # # Syntax sugar: - # class TestParent < Test::UnitTestCase + # class TestParent < Test::Unit::TestCase # sub_test_case("TestChild") do # def test_in_child # end @@ -394,7 +413,8 @@ end if query_method_name available_location = available_locations.find do |location| - query_method_name == location[:method_name] + location[:test_case] == self and + query_method_name == location[:method_name] end return [] if available_location.nil? available_locations = [available_location] @@ -661,10 +681,19 @@ # Returns a human-readable name for the specific test that # this instance of TestCase represents. def name + "#{local_name}(#{self.class.name})" + end + + # Returns a human-readable name for the specific test that this + # instance of TestCase represents. + # + # `#local_name` doesn't include class name. `#name` includes + # class name. + def local_name if @internal_data.have_test_data? - "#{@method_name}[#{data_label}](#{self.class.name})" + "#{@method_name}[#{data_label}]" else - "#{@method_name}(#{self.class.name})" + @method_name.to_s end end @@ -745,7 +774,7 @@ signature = "#{self.class}\##{@method_name}" redefined_info = self[:redefined] if redefined_info - notify("#{signature} was redefined", + notify("<#{signature}> was redefined", :backtrace => redefined_info[:backtrace]) end if @internal_data.have_test_data? @@ -757,7 +786,7 @@ backtrace = locations.collect do |location| "#{location[:path]}:#{location[:line]}" end - notify("#{signature} misses a parameter to take test data", + notify("<#{signature}> misses a parameter to take test data", :backtrace => backtrace) end else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/test/unit/ui/console/testrunner.rb new/lib/test/unit/ui/console/testrunner.rb --- old/lib/test/unit/ui/console/testrunner.rb 2016-11-25 13:44:09.000000000 +0100 +++ new/lib/test/unit/ui/console/testrunner.rb 2017-05-23 04:40:04.000000000 +0200 @@ -342,7 +342,7 @@ def test_started(test) return unless output?(VERBOSE) - name = test.name.sub(/\(.+?\)\z/, '') + name = test.local_name right_space = 8 * 2 left_space = @progress_row_max - right_space left_space = left_space - indent.size - name.size @@ -473,8 +473,12 @@ fault_class.name.split(/::/).last.downcase end + def fault_class_color(fault_class) + color(fault_class_color_name(fault_class)) + end + def fault_color(fault) - color(fault_class_color_name(fault.class)) + fault_class_color(fault.class) end def fault_marker_color(fault) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/test/unit/version.rb new/lib/test/unit/version.rb --- old/lib/test/unit/version.rb 2016-11-25 13:44:09.000000000 +0100 +++ new/lib/test/unit/version.rb 2017-05-23 04:40:04.000000000 +0200 @@ -1,5 +1,5 @@ module Test module Unit - VERSION = "3.2.3" + VERSION = "3.2.4" end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2016-11-25 13:44:09.000000000 +0100 +++ new/metadata 2017-05-23 04:40:04.000000000 +0200 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: test-unit version: !ruby/object:Gem::Version - version: 3.2.3 + version: 3.2.4 platform: ruby authors: - Kouhei Sutou @@ -9,7 +9,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2016-11-25 00:00:00.000000000 Z +date: 2017-05-23 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: power_assert @@ -113,6 +113,7 @@ - PSFL - README.md - Rakefile +- doc/text/getting-started.md - doc/text/how-to.md - doc/text/news.md - lib/test-unit.rb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/test-assertions.rb new/test/test-assertions.rb --- old/test/test-assertions.rb 2016-11-25 13:44:09.000000000 +0100 +++ new/test/test-assertions.rb 2017-05-23 04:40:04.000000000 +0200 @@ -301,8 +301,8 @@ def test_multi_lines_result message = <<-EOM.chomp -<#{"a\nb".inspect}> expected but was -<#{"x".inspect}>. +<#{AssertionMessage.convert("a\nb")}> expected but was +<#{AssertionMessage.convert("x")}>. diff: + x @@ -316,8 +316,8 @@ def test_large_string message = <<-EOM.chomp -<#{("a\n" + "x" * 997).inspect}> expected but was -<#{"x".inspect}>. +<#{AssertionMessage.convert("a\n" + "x" * 997)}> expected but was +<#{AssertionMessage.convert("x")}>. diff: + x @@ -335,8 +335,8 @@ end message = <<-EOM.chomp -<#{("a\n" + "x" * 998).inspect}> expected but was -<#{"x".inspect}>. +<#{AssertionMessage.convert("a\n" + "x" * 998)}> expected but was +<#{AssertionMessage.convert("x")}>. EOM check_fail(message) do assert_equal("a\n" + "x" * 998, "x") @@ -349,8 +349,8 @@ ENV[key] = "100" begin message = <<-EOM.chomp -<#{("a\n" + "x" * 97).inspect}> expected but was -<#{"x".inspect}>. +<#{AssertionMessage.convert("a\n" + "x" * 97)}> expected but was +<#{AssertionMessage.convert("x")}>. diff: + x @@ -368,8 +368,8 @@ end message = <<-EOM.chomp -<#{("a\n" + "x" * 98).inspect}> expected but was -<#{"x".inspect}>. +<#{AssertionMessage.convert("a\n" + "x" * 98)}> expected but was +<#{AssertionMessage.convert("x")}>. EOM check_fail(message) do assert_equal("a\n" + "x" * 98, "x") @@ -495,7 +495,7 @@ end def test_assert_raise_fail - check_fail("<RuntimeError> exception expected but none was thrown.") do + check_fail("<RuntimeError> exception was expected but none was thrown.") do assert_raise(RuntimeError) do 1 + 1 end @@ -556,7 +556,7 @@ end check_fail("<[ArgumentError, TypeError, Math, Comparable]> exception " + - "expected but none was thrown.") do + "was expected but none was thrown.") do assert_raise(*rescues) do 1 + 1 end @@ -663,21 +663,21 @@ check_nothing_fails { assert_instance_of(String, "string", "successful assert_instance_of") } - check_fail(%Q{<"string"> expected to be instance_of?\n<Hash> but was\n<String>.}) { + check_fail(%Q{<"string"> was expected to be instance_of?\n<Hash> but was\n<String>.}) { assert_instance_of(Hash, "string") } - check_fail(%Q{failed assert_instance_of.\n<"string"> expected to be instance_of?\n<Hash> but was\n<String>.}) { + check_fail(%Q{failed assert_instance_of.\n<"string"> was expected to be instance_of?\n<Hash> but was\n<String>.}) { assert_instance_of(Hash, "string", "failed assert_instance_of") } check_nothing_fails do - assert_instance_of([Fixnum, NilClass], 100) + assert_instance_of([Class, NilClass], Array) end - check_fail(%Q{<"string"> expected to be instance_of?\n[<Fixnum>, <NilClass>] but was\n<String>.}) do - assert_instance_of([Fixnum, NilClass], "string") + check_fail(%Q{<"string"> was expected to be instance_of?\n[<Class>, <NilClass>] but was\n<String>.}) do + assert_instance_of([Class, NilClass], "string") end - check_fail(%Q{<100> expected to be instance_of?\n[<Numeric>, <NilClass>] but was\n<Fixnum>.}) do - assert_instance_of([Numeric, NilClass], 100) + check_fail(%Q{<Array> was expected to be instance_of?\n[<Module>, <NilClass>] but was\n<Class>.}) do + assert_instance_of([Module, NilClass], Array) end end @@ -688,20 +688,20 @@ check_nothing_fails { assert_not_instance_of(NilClass, "string", "successful assert_instance_of") } - check_fail(%Q{<"string"> expected to not be instance_of?\n<String> but was.}) { + check_fail(%Q{<"string"> was expected to not be instance_of?\n<String> but was.}) { assert_not_instance_of(String, "string") } - check_fail(%Q{failed assert.\n<"string"> expected to not be instance_of?\n<String> but was.}) { + check_fail(%Q{failed assert.\n<"string"> was expected to not be instance_of?\n<String> but was.}) { assert_not_instance_of(String, "string", "failed assert") } check_nothing_fails do - assert_not_instance_of([Numeric, NilClass], 100) + assert_not_instance_of([Module, NilClass], Array) end - check_fail(%Q{<100> expected to not be instance_of?\n[<Fixnum>, <NilClass>] but was.}) do - assert_not_instance_of([Fixnum, NilClass], 100) + check_fail(%Q{<Array> was expected to not be instance_of?\n[<Class>, <NilClass>] but was.}) do + assert_not_instance_of([Class, NilClass], Array) end - check_fail(%Q{<"str"> expected to not be instance_of?\n[<Numeric>, <String>] but was.}) do + check_fail(%Q{<"str"> was expected to not be instance_of?\n[<Numeric>, <String>] but was.}) do assert_not_instance_of([Numeric, String], 'str') end end @@ -716,10 +716,10 @@ check_nothing_fails { assert_nil(nil, "successful assert_nil") } - check_fail(%Q{<"string"> expected to be nil.}) { + check_fail(%Q{<"string"> was expected to be nil.}) { assert_nil("string") } - check_fail(%Q{failed assert_nil.\n<"string"> expected to be nil.}) { + check_fail(%Q{failed assert_nil.\n<"string"> was expected to be nil.}) { assert_nil("string", "failed assert_nil") } end @@ -727,8 +727,8 @@ def test_assert_not_nil check_nothing_fails{assert_not_nil(false)} check_nothing_fails{assert_not_nil(false, "message")} - check_fail("<nil> expected to not be nil."){assert_not_nil(nil)} - check_fail("message.\n<nil> expected to not be nil.") {assert_not_nil(nil, "message")} + check_fail("<nil> was expected to not be nil."){assert_not_nil(nil)} + check_fail("message.\n<nil> was expected to not be nil.") {assert_not_nil(nil, "message")} end def test_assert_kind_of @@ -744,18 +744,18 @@ check_nothing_fails { assert_kind_of(Comparable, 1) } - check_fail(%Q{<"string"> expected to be kind_of?\n<Class> but was\n<String>.}) { + check_fail(%Q{<"string"> was expected to be kind_of?\n<Class> but was\n<String>.}) { assert_kind_of(Class, "string") } - check_fail(%Q{failed assert_kind_of.\n<"string"> expected to be kind_of?\n<Class> but was\n<String>.}) { + check_fail(%Q{failed assert_kind_of.\n<"string"> was expected to be kind_of?\n<Class> but was\n<String>.}) { assert_kind_of(Class, "string", "failed assert_kind_of") } check_nothing_fails do - assert_kind_of([Fixnum, NilClass], 100) + assert_kind_of([Class, NilClass], Array) end - check_fail(%Q{<"string"> expected to be kind_of?\n[<Fixnum>, <NilClass>] but was\n<String>.}) do - assert_kind_of([Fixnum, NilClass], "string") + check_fail(%Q{<"string"> was expected to be kind_of?\n[<Class>, <NilClass>] but was\n<String>.}) do + assert_kind_of([Class, NilClass], "string") end end @@ -769,18 +769,18 @@ check_nothing_fails { assert_not_kind_of(Integer, 1.1) } - check_fail(%Q{<1> expected to not be kind_of?\n<Integer> but was.}) { + check_fail(%Q{<1> was expected to not be kind_of?\n<Integer> but was.}) { assert_not_kind_of(Integer, 1) } - check_fail(%Q{failed assert_not_kind_of.\n<"string"> expected to not be kind_of?\n<String> but was.}) { + check_fail(%Q{failed assert_not_kind_of.\n<"string"> was expected to not be kind_of?\n<String> but was.}) { assert_not_kind_of(String, "string", "failed assert_not_kind_of") } check_nothing_fails do assert_not_kind_of([String, NilClass], 100) end - check_fail(%Q{<100> expected to not be kind_of?\n[<Fixnum>, <NilClass>] but was.}) do - assert_not_kind_of([Fixnum, NilClass], 100) + check_fail(%Q{<Array> was expected to not be kind_of?\n[<Class>, <NilClass>] but was.}) do + assert_not_kind_of([Class, NilClass], Array) end end @@ -797,13 +797,13 @@ check_nothing_fails { assert_match(/strin./, "string", "successful assert_match") } - check_fail(%Q{</slin./> expected to be =~\n<"string">.}) { + check_fail(%Q{</slin./> was expected to be =~\n<"string">.}) { assert_match(/slin./, "string") } - check_fail(%Q{</strin\\./> expected to be =~\n<"string">.}) { + check_fail(%Q{</strin\\./> was expected to be =~\n<"string">.}) { assert_match("strin.", "string") } - check_fail(%Q{failed assert_match.\n</slin./> expected to be =~\n<"string">.}) { + check_fail(%Q{failed assert_match.\n</slin./> was expected to be =~\n<"string">.}) { assert_match(/slin./, "string", "failed assert_match") } end @@ -820,10 +820,10 @@ assert_same(thing, thing, "successful assert_same") } thing2 = "thing" - check_fail(%Q{<"thing">\nwith id <#{thing.__id__}> expected to be equal? to\n<"thing">\nwith id <#{thing2.__id__}>.}) { + check_fail(%Q{<"thing">\nwith id <#{thing.__id__}> was expected to be equal? to\n<"thing">\nwith id <#{thing2.__id__}>.}) { assert_same(thing, thing2) } - check_fail(%Q{failed assert_same.\n<"thing">\nwith id <#{thing.__id__}> expected to be equal? to\n<"thing">\nwith id <#{thing2.__id__}>.}) { + check_fail(%Q{failed assert_same.\n<"thing">\nwith id <#{thing.__id__}> was expected to be equal? to\n<"thing">\nwith id <#{thing2.__id__}>.}) { assert_same(thing, thing2, "failed assert_same") } end @@ -913,10 +913,10 @@ check_nothing_fails { assert_not_same(thing, thing2, "message") } - check_fail(%Q{<"thing">\nwith id <#{thing.__id__}> expected to not be equal? to\n<"thing">\nwith id <#{thing.__id__}>.}) { + check_fail(%Q{<"thing">\nwith id <#{thing.__id__}> was expected to not be equal? to\n<"thing">\nwith id <#{thing.__id__}>.}) { assert_not_same(thing, thing) } - check_fail(%Q{message.\n<"thing">\nwith id <#{thing.__id__}> expected to not be equal? to\n<"thing">\nwith id <#{thing.__id__}>.}) { + check_fail(%Q{message.\n<"thing">\nwith id <#{thing.__id__}> was expected to not be equal? to\n<"thing">\nwith id <#{thing.__id__}>.}) { assert_not_same(thing, thing, "message") } end @@ -928,10 +928,10 @@ check_nothing_fails { assert_not_equal("string1", "string2", "message") } - check_fail(%Q{<"string"> expected to be != to\n<"string">.}) { + check_fail(%Q{<"string"> was expected to be != to\n<"string">.}) { assert_not_equal("string", "string") } - check_fail(%Q{message.\n<"string"> expected to be != to\n<"string">.}) { + check_fail(%Q{message.\n<"string"> was expected to be != to\n<"string">.}) { assert_not_equal("string", "string", "message") } end @@ -951,7 +951,7 @@ def test_assert_not_match_fail_not_regexp check_fail("<REGEXP> in assert_not_match(<REGEXP>, ...) " + "should be a Regexp.\n" + - "<\"asdf\"> expected to be instance_of?\n" + + "<\"asdf\"> was expected to be instance_of?\n" + "<Regexp> but was\n" + "<String>.") do assert_not_match("asdf", "asdf") @@ -959,7 +959,7 @@ end def test_assert_not_match_fail_match - check_fail("</string/> expected to not match\n" + + check_fail("</string/> was expected to not match\n" + "<\"string\">.") do assert_not_match(/string/, "string") end @@ -967,7 +967,7 @@ def test_assert_not_match_fail_match_with_message check_fail("message.\n" + - "</string/> expected to not match\n" + + "</string/> was expected to not match\n" + "<\"string\">.") do assert_not_match(/string/, "string", "message") end @@ -976,13 +976,13 @@ def test_assert_no_match check_nothing_fails{assert_no_match(/sling/, "string")} check_nothing_fails{assert_no_match(/sling/, "string", "message")} - check_fail(%Q{The first argument to assert_no_match should be a Regexp.\n<"asdf"> expected to be instance_of?\n<Regexp> but was\n<String>.}) do + check_fail(%Q{The first argument to assert_no_match should be a Regexp.\n<"asdf"> was expected to be instance_of?\n<Regexp> but was\n<String>.}) do assert_no_match("asdf", "asdf") end - check_fail(%Q{</string/> expected to not match\n<"string">.}) do + check_fail(%Q{</string/> was expected to not match\n<"string">.}) do assert_no_match(/string/, "string") end - check_fail(%Q{message.\n</string/> expected to not match\n<"string">.}) do + check_fail(%Q{message.\n</string/> was expected to not match\n<"string">.}) do assert_no_match(/string/, "string", "message") end end @@ -996,7 +996,7 @@ tag = :thing2 check_fail("message.\n" + - "<:thing> expected to be thrown but\n" + + "<:thing> was expected to be thrown but\n" + "<#{inspect_tag(tag)}> was thrown.") do assert_throw(:thing, "message") do throw :thing2 @@ -1034,7 +1034,7 @@ check_fail(%Q{<0.15>\ngiven as the operator for #assert_operator must be a Symbol or #respond_to?(:to_str).}) do assert_operator("thing", 0.15, "thing") end - check_fail(%Q{message.\n<"thing1"> expected to be\n==\n<"thing2">.}) { + check_fail(%Q{message.\n<"thing1"> was expected to be\n==\n<"thing2">.}) { assert_operator("thing1", :==, "thing2", "message") } end @@ -1046,7 +1046,7 @@ check_fail(%Q{<42>\ngiven as the operator for #assert_not_operator must be a Symbol or #respond_to?(:to_str).}) do assert_not_operator("thing", 42, "message") end - check_fail(%Q{message.\n<0> expected to not be\n==\n<0.0>.}) { + check_fail(%Q{message.\n<0> was expected to not be\n==\n<0.0>.}) { assert_not_operator(0, :==, 0.0, "message") } end @@ -1111,7 +1111,7 @@ inspected_object = AssertionMessage.convert(object) expected_message = <<-EOM message. -<#{inspected_object}> expected to respond to +<#{inspected_object}> was expected to respond to <return_argument(*[false, "bogus"])> with a true value but was <false>. EOM @@ -1210,7 +1210,7 @@ expected_message = <<-EOM <15> < <10> should be true -<15> expected less than +<15> was expected to be less than <10>. EOM check_fail(expected_message.chomp) do @@ -1219,7 +1219,7 @@ expected_message = <<-EOM <15> <= <10> should be true -<15> expected less than or equal to +<15> was expected to be less than or equal to <10>. EOM check_fail(expected_message.chomp) do @@ -1228,7 +1228,7 @@ expected_message = <<-EOM <10> > <15> should be true -<10> expected greater than +<10> was expected to be greater than <15>. EOM check_fail(expected_message.chomp) do @@ -1237,7 +1237,7 @@ expected_message = <<-EOM <10> >= <15> should be true -<10> expected greater than or equal to +<10> was expected to be greater than or equal to <15>. EOM check_fail(expected_message.chomp) do @@ -1288,7 +1288,7 @@ end expected_message = <<-EOM -<"Expected message"> exception message expected but none was thrown. +<"Expected message"> exception message was expected but none was thrown. EOM check_fail(expected_message.chomp) do assert_raise_message("Expected message") do @@ -1414,7 +1414,7 @@ end nonexistent_file = __FILE__ + ".nonexistent" - check_fail("<#{nonexistent_file.inspect}> expected to exist") do + check_fail("<#{nonexistent_file.inspect}> was expected to exist") do assert_path_exist(nonexistent_file) end end @@ -1425,7 +1425,7 @@ assert_path_not_exist(nonexistent_file) end - check_fail("<#{__FILE__.inspect}> expected to not exist") do + check_fail("<#{__FILE__.inspect}> was expected to not exist") do assert_path_not_exist(__FILE__) end end @@ -1521,15 +1521,18 @@ class TestBlock < self def test_with_message if defined?(PowerAssert) - system_message = <<-MESSAGE - 1 == 2 + system_message = <<-MESSAGE.chomp + 1.to_s == "2" + | | + | false + "1" MESSAGE else system_message = "<false> is not true." end check_fail("user message.\n#{system_message}") do assert("user message") do - 1 == 2 + 1.to_s == "2" end end end @@ -1635,7 +1638,7 @@ def test_fail_with_message check_fail("message.\n" + - "<0.5> -/+ <0.05> expected to include\n" + + "<0.5> -/+ <0.05> was expected to include\n" + "<0.4>.\n" + "\n" + "Relation:\n" + @@ -1657,13 +1660,13 @@ def test_fail_because_negaitve_delta check_fail("The delta should not be negative.\n" + - "<-0.1> expected to be\n>=\n<0.0>.") do + "<-0.1> was expected to be\n>=\n<0.0>.") do assert_in_delta(0.5, 0.4, -0.1, "message") end end def test_fail_without_delta - check_fail("<1.402> -/+ <0.001> expected to include\n" + + check_fail("<1.402> -/+ <0.001> was expected to include\n" + "<1.404>.\n" + "\n" + "Relation:\n" + @@ -1715,7 +1718,7 @@ end def test_fail - check_fail("<1.4> -/+ <0.11> expected to not include\n" + + check_fail("<1.4> -/+ <0.11> was expected to not include\n" + "<1.5>.\n" + "\n" + "Relation:\n" + @@ -1729,7 +1732,7 @@ end def test_fail_without_delta - check_fail("<1.402> -/+ <0.001> expected to not include\n" + + check_fail("<1.402> -/+ <0.001> was expected to not include\n" + "<1.4021>.\n" + "\n" + "Relation:\n" + @@ -1744,7 +1747,7 @@ def test_fail_with_message check_fail("message.\n" + - "<0.5> -/+ <0.11> expected to not include\n" + + "<0.5> -/+ <0.11> was expected to not include\n" + "<0.4>.\n" + "\n" + "Relation:\n" + @@ -1770,7 +1773,7 @@ def test_fail_because_negaitve_delta check_fail("The delta should not be negative.\n" + - "<-0.11> expected to be\n>=\n<0.0>.") do + "<-0.11> was expected to be\n>=\n<0.0>.") do assert_not_in_delta(0.5, 0.4, -0.11, "message") end end @@ -1828,7 +1831,7 @@ def test_fail_with_message check_fail("message.\n" + "<10000> -/+ (<10000> * <0.1>)[1000.0] " + - "expected to include\n" + + "was expected to include\n" + "<8999>.\n" + "\n" + "Relation:\n" + @@ -1854,14 +1857,14 @@ def test_fail_because_negaitve_epsilon check_fail("The epsilon should not be negative.\n" + - "<-0.1> expected to be\n>=\n<0.0>.") do + "<-0.1> was expected to be\n>=\n<0.0>.") do assert_in_epsilon(10000, 9000, -0.1, "message") end end def test_fail_without_epsilon check_fail("<10000> -/+ (<10000> * <0.001>)[10.0] " + - "expected to include\n" + + "was expected to include\n" + "<10011>.\n" + "\n" + "Relation:\n" + @@ -1914,7 +1917,7 @@ def test_fail check_fail("<10000> -/+ (<10000> * <0.1>)[1000.0] " + - "expected to not include\n" + + "was expected to not include\n" + "<9000>.\n" + "\n" + "Relation:\n" + @@ -1929,7 +1932,7 @@ def test_fail_without_epsilon check_fail("<10000> -/+ (<10000> * <0.001>)[10.0] " + - "expected to not include\n" + + "was expected to not include\n" + "<9990>.\n" + "\n" + "Relation:\n" + @@ -1945,7 +1948,7 @@ def test_fail_with_message check_fail("message.\n" + "<10000> -/+ (<10000> * <0.1>)[1000.0] " + - "expected to not include\n" + + "was expected to not include\n" + "<9000>.\n" + "\n" + "Relation:\n" + @@ -1971,7 +1974,7 @@ def test_fail_because_negaitve_epsilon check_fail("The epsilon should not be negative.\n" + - "<-0.1> expected to be\n>=\n<0.0>.") do + "<-0.1> was expected to be\n>=\n<0.0>.") do assert_not_in_epsilon(10000, 9000, -0.1, "message") end end @@ -1993,7 +1996,7 @@ end def test_fail - check_fail("<[1, 2, 3]> expected to include\n" + + check_fail("<[1, 2, 3]> was expected to include\n" + "<4>.") do assert_include([1, 2, 3], 4) end @@ -2001,7 +2004,7 @@ def test_fail_with_message check_fail("message.\n" + - "<[1, 2, 3]> expected to include\n" + + "<[1, 2, 3]> was expected to include\n" + "<4>.") do assert_include([1, 2, 3], 4, "message") end @@ -2034,7 +2037,7 @@ end def test_fail - check_fail("<[1, 2, 3]> expected to not include\n" + + check_fail("<[1, 2, 3]> was expected to not include\n" + "<2>.") do assert_not_include([1, 2, 3], 2) end @@ -2042,7 +2045,7 @@ def test_fail_with_message check_fail("message.\n" + - "<[1, 2, 3]> expected to not include\n" + + "<[1, 2, 3]> was expected to not include\n" + "<2>.") do assert_not_include([1, 2, 3], 2, "message") end @@ -2075,14 +2078,14 @@ end def test_fail - check_fail("<[1]> expected to be empty.") do + check_fail("<[1]> was expected to be empty.") do assert_empty([1]) end end def test_fail_with_message check_fail("message.\n" + - "<[1]> expected to be empty.") do + "<[1]> was expected to be empty.") do assert_empty([1], "message") end end @@ -2114,14 +2117,14 @@ end def test_fail - check_fail("<[]> expected to not be empty.") do + check_fail("<[]> was expected to not be empty.") do assert_not_empty([]) end end def test_fail_with_message check_fail("message.\n" + - "<[]> expected to not be empty.") do + "<[]> was expected to not be empty.") do assert_not_empty([], "message") end end @@ -2149,7 +2152,7 @@ def test_fail expected_message = <<-EOM message. -<[1, 2]> expected to respond to +<[1, 2]> was expected to respond to <member?(*[2])> with not a true value but was <true>. EOM diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/test-test-case.rb new/test/test-test-case.rb --- old/test/test-test-case.rb 2016-11-25 13:44:09.000000000 +0100 +++ new/test/test-test-case.rb 2017-05-23 04:40:04.000000000 +0200 @@ -1197,6 +1197,80 @@ assert_equal([:startup, :shutdown], test_case.called) end + + class TestName < self + def test_no_data + test_case = Class.new(TestCase) do + class << self + def name + "TestCase" + end + end + + def test_nothing + end + end + + test = test_case.new("test_nothing") + assert_equal("test_nothing(TestCase)", + test.name) + end + + def test_data + test_case = Class.new(TestCase) do + class << self + def name + "TestCase" + end + end + + def test_nothing + end + end + + test = test_case.new("test_nothing") + test.assign_test_data("(nil)", nil) + assert_equal("test_nothing[(nil)](TestCase)", + test.name) + end + end + + class TestLocalName < self + def test_no_data + test_case = Class.new(TestCase) do + class << self + def name + "TestCase" + end + end + + def test_nothing + end + end + + test = test_case.new("test_nothing") + assert_equal("test_nothing", + test.local_name) + end + + def test_data + test_case = Class.new(TestCase) do + class << self + def name + "TestCase" + end + end + + def test_nothing + end + end + + test = test_case.new("test_nothing") + test.assign_test_data("(nil)", nil) + assert_equal("test_nothing[(nil)]", + test.local_name) + end + end end end end