test-unit 3.2.5 → 3.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. checksums.yaml +5 -5
  2. data/BSDL +24 -0
  3. data/COPYING +41 -44
  4. data/README.md +8 -11
  5. data/Rakefile +0 -23
  6. data/doc/text/getting-started.md +1 -1
  7. data/doc/text/news.md +366 -0
  8. data/lib/test/unit/assertion-failed-error.rb +35 -0
  9. data/lib/test/unit/assertions.rb +312 -112
  10. data/lib/test/unit/attribute.rb +7 -2
  11. data/lib/test/unit/autorunner.rb +79 -31
  12. data/lib/test/unit/code-snippet-fetcher.rb +7 -7
  13. data/lib/test/unit/collector/descendant.rb +1 -0
  14. data/lib/test/unit/collector/dir.rb +4 -2
  15. data/lib/test/unit/collector/load.rb +10 -13
  16. data/lib/test/unit/collector/objectspace.rb +1 -0
  17. data/lib/test/unit/collector.rb +31 -0
  18. data/lib/test/unit/color-scheme.rb +20 -2
  19. data/lib/test/unit/data-sets.rb +116 -0
  20. data/lib/test/unit/data.rb +121 -12
  21. data/lib/test/unit/diff.rb +2 -3
  22. data/lib/test/unit/fixture.rb +6 -0
  23. data/lib/test/unit/notification.rb +9 -7
  24. data/lib/test/unit/omission.rb +34 -31
  25. data/lib/test/unit/pending.rb +12 -11
  26. data/lib/test/unit/priority.rb +7 -3
  27. data/lib/test/unit/runner/console.rb +8 -0
  28. data/lib/test/unit/test-suite-creator.rb +22 -8
  29. data/lib/test/unit/testcase.rb +216 -146
  30. data/lib/test/unit/testsuite.rb +1 -1
  31. data/lib/test/unit/ui/console/testrunner.rb +92 -32
  32. data/lib/test/unit/util/memory-usage.rb +47 -0
  33. data/lib/test/unit/util/observable.rb +2 -2
  34. data/lib/test/unit/util/output.rb +5 -4
  35. data/lib/test/unit/util/procwrapper.rb +4 -4
  36. data/lib/test/unit/version.rb +1 -1
  37. data/lib/test/unit/warning.rb +3 -0
  38. data/lib/test/unit.rb +177 -161
  39. data/lib/test-unit.rb +2 -17
  40. metadata +13 -88
  41. data/GPL +0 -339
  42. data/LGPL +0 -502
  43. data/test/collector/test-descendant.rb +0 -182
  44. data/test/collector/test-load.rb +0 -442
  45. data/test/collector/test_dir.rb +0 -407
  46. data/test/collector/test_objectspace.rb +0 -102
  47. data/test/fixtures/header-label.csv +0 -3
  48. data/test/fixtures/header-label.tsv +0 -3
  49. data/test/fixtures/header.csv +0 -3
  50. data/test/fixtures/header.tsv +0 -3
  51. data/test/fixtures/no-header.csv +0 -2
  52. data/test/fixtures/no-header.tsv +0 -2
  53. data/test/fixtures/plus.csv +0 -3
  54. data/test/run-test.rb +0 -22
  55. data/test/test-assertions.rb +0 -2180
  56. data/test/test-attribute-matcher.rb +0 -38
  57. data/test/test-attribute.rb +0 -123
  58. data/test/test-code-snippet.rb +0 -37
  59. data/test/test-color-scheme.rb +0 -82
  60. data/test/test-color.rb +0 -47
  61. data/test/test-data.rb +0 -303
  62. data/test/test-diff.rb +0 -518
  63. data/test/test-emacs-runner.rb +0 -60
  64. data/test/test-error.rb +0 -26
  65. data/test/test-failure.rb +0 -33
  66. data/test/test-fault-location-detector.rb +0 -163
  67. data/test/test-fixture.rb +0 -713
  68. data/test/test-notification.rb +0 -33
  69. data/test/test-omission.rb +0 -81
  70. data/test/test-pending.rb +0 -70
  71. data/test/test-priority.rb +0 -173
  72. data/test/test-test-case.rb +0 -1278
  73. data/test/test-test-result.rb +0 -113
  74. data/test/test-test-suite-creator.rb +0 -97
  75. data/test/test-test-suite.rb +0 -151
  76. data/test/testunit-test-util.rb +0 -31
  77. data/test/ui/test_testrunmediator.rb +0 -20
  78. data/test/util/test-method-owner-finder.rb +0 -38
  79. data/test/util/test-output.rb +0 -11
  80. data/test/util/test_backtracefilter.rb +0 -52
  81. data/test/util/test_observable.rb +0 -102
  82. data/test/util/test_procwrapper.rb +0 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 367cf38cdec937cd00374b17aeddd2cd85271223
4
- data.tar.gz: 66d1270f41f63a6d324c419cb91cb8e4a4e66fed
2
+ SHA256:
3
+ metadata.gz: c560e1a37cdbf43985f90a72db8f9e58032f6c78a4cab6a0eed1043dcb432b82
4
+ data.tar.gz: e8c8c21c52598a8e1db27fea5532893f8ec6c6464f60fb426fbfefd16638326d
5
5
  SHA512:
6
- metadata.gz: 546256249a6ac765e2789a60feec91fd97ec4e66cbcf951897085bf378b435f81a548be56381c22ecdddda0e491b63adcacda90b74d916865f82cb4848e60098
7
- data.tar.gz: 4e17e054bd8cdf04b401d7aee9205403be33c7a9a9e0fd7244d468897db61f5aecf9b25f4bdd3a03a75409faa8e56c6eece579b5eebab7accc1a1e48cff9f51b
6
+ metadata.gz: 526a4fe5b67806bcb084f147876c4b8202f4065d948b306ad90d0cff5358166bdea6d71aa83fb772ee8a9c02040c7a9b50fe280cde50b6289eacecc11b88e328
7
+ data.tar.gz: 20f8d27643640248a29f583c63a00de7937ca6788d5cf6e358c6587387cc3c5fb9d376be519218a3ec0532455524566460871f34783f1a9ec2cc7da0020b8d81
data/BSDL ADDED
@@ -0,0 +1,24 @@
1
+ Copyright (C) 2003-2007 Nathaniel Talbott. All rights reserved.
2
+ Copyright (C) 2008 Ryan Davis. All rights reserved.
3
+ Copyright (C) 2008-2020 Sutou Kouhei. All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions
7
+ are met:
8
+ 1. Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+ 2. Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24
+ SUCH DAMAGE.
data/COPYING CHANGED
@@ -2,66 +2,63 @@ test-unit is copyrighted free software by Kouhei Sutou
2
2
  <kou@cozmixng.org>, Ryan Davis <ryand-ruby@zenspider.com>
3
3
  and Nathaniel Talbott <nathaniel@talbott.ws>.
4
4
 
5
- You can redistribute it and/or modify it under either the terms of the GPL
6
- version 2 (see the file GPL), or the conditions below:
5
+ You can redistribute it and/or modify it under either the terms of the
6
+ 2-clause BSDL (see the file BSDL), or the conditions below:
7
7
 
8
- 1. You may make and give away verbatim copies of the source form of the
9
- software without restriction, provided that you duplicate all of the
10
- original copyright notices and associated disclaimers.
8
+ 1. You may make and give away verbatim copies of the source form of the
9
+ software without restriction, provided that you duplicate all of the
10
+ original copyright notices and associated disclaimers.
11
11
 
12
- 2. You may modify your copy of the software in any way, provided that
13
- you do at least ONE of the following:
12
+ 2. You may modify your copy of the software in any way, provided that
13
+ you do at least ONE of the following:
14
14
 
15
- a) place your modifications in the Public Domain or otherwise
16
- make them Freely Available, such as by posting said
17
- modifications to Usenet or an equivalent medium, or by allowing
18
- the author to include your modifications in the software.
15
+ a. place your modifications in the Public Domain or otherwise
16
+ make them Freely Available, such as by posting said
17
+ modifications to Usenet or an equivalent medium, or by allowing
18
+ the author to include your modifications in the software.
19
19
 
20
- b) use the modified software only within your corporation or
21
- organization.
20
+ b. use the modified software only within your corporation or
21
+ organization.
22
22
 
23
- c) give non-standard binaries non-standard names, with
24
- instructions on where to get the original software distribution.
23
+ c. give non-standard binaries non-standard names, with
24
+ instructions on where to get the original software distribution.
25
25
 
26
- d) make other distribution arrangements with the author.
26
+ d. make other distribution arrangements with the author.
27
27
 
28
- 3. You may distribute the software in object code or binary form,
29
- provided that you do at least ONE of the following:
28
+ 3. You may distribute the software in object code or binary form,
29
+ provided that you do at least ONE of the following:
30
30
 
31
- a) distribute the binaries and library files of the software,
32
- together with instructions (in the manual page or equivalent)
33
- on where to get the original distribution.
31
+ a. distribute the binaries and library files of the software,
32
+ together with instructions (in the manual page or equivalent)
33
+ on where to get the original distribution.
34
34
 
35
- b) accompany the distribution with the machine-readable source of
36
- the software.
35
+ b. accompany the distribution with the machine-readable source of
36
+ the software.
37
37
 
38
- c) give non-standard binaries non-standard names, with
39
- instructions on where to get the original software distribution.
38
+ c. give non-standard binaries non-standard names, with
39
+ instructions on where to get the original software distribution.
40
40
 
41
- d) make other distribution arrangements with the author.
41
+ d. make other distribution arrangements with the author.
42
42
 
43
- 4. You may modify and include the part of the software into any other
44
- software (possibly commercial). But some files in the distribution
45
- are not written by the author, so that they are not under these terms.
43
+ 4. You may modify and include the part of the software into any other
44
+ software (possibly commercial). But some files in the distribution
45
+ are not written by the author, so that they are not under these terms.
46
46
 
47
- For the list of those files and their copying conditions, see the
48
- file LEGAL.
47
+ For the list of those files and their copying conditions, see the
48
+ file LEGAL.
49
49
 
50
- 5. The scripts and library files supplied as input to or produced as
51
- output from the software do not automatically fall under the
52
- copyright of the software, but belong to whomever generated them,
53
- and may be sold commercially, and may be aggregated with this
54
- software.
50
+ 5. The scripts and library files supplied as input to or produced as
51
+ output from the software do not automatically fall under the
52
+ copyright of the software, but belong to whomever generated them,
53
+ and may be sold commercially, and may be aggregated with this
54
+ software.
55
55
 
56
- 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
57
- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
58
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
59
- PURPOSE.
56
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
57
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
58
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
59
+ PURPOSE.
60
60
 
61
61
  Exceptions
62
62
  ----------
63
63
 
64
- * lib/test/unit/diff.rb: This license, PSF license and/or LGPLv2.1
65
- or later
66
-
67
- * lib/test-unit.rb: This license and/or LGPLv2.1 or later
64
+ * lib/test/unit/diff.rb: This license and PSF license
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # test-unit
2
2
 
3
- [![](https://badge.fury.io/rb/test-unit.png)](http://badge.fury.io/rb/test-unit)
4
- [![](https://travis-ci.org/test-unit/test-unit.png?branch=master)](https://travis-ci.org/test-unit/test-unit)
3
+ [![Gem Version](https://badge.fury.io/rb/test-unit.png)](http://badge.fury.io/rb/test-unit)
4
+ [![Build Status for Ruby 2.1+](https://github.com/test-unit/test-unit/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/test-unit/test-unit/actions/workflows/test.yml?query=branch%3Amaster+)
5
+ [![Build Status for Ruby 1.9 and 2.0](https://travis-ci.com/test-unit/test-unit.svg?branch=master)](https://travis-ci.com/test-unit/test-unit)
5
6
 
6
7
  * http://test-unit.github.io/
7
8
  * https://github.com/test-unit/test-unit
@@ -24,7 +25,7 @@ writing tests, checking results and automated testing in Ruby.
24
25
  to radically change very soon).
25
26
 
26
27
  * test-unit will be improved actively and may break
27
- compatiblity with test-unit 1.2.3. (We will not hope it
28
+ compatibility with test-unit 1.2.3. (We will not hope it
28
29
  if it isn't needed.)
29
30
 
30
31
  * Some features exist as separated gems like GUI test
@@ -51,17 +52,13 @@ If you want to use full test-unit features:
51
52
 
52
53
  ## License
53
54
 
54
- (The Ruby License)
55
-
56
- This software is distributed under the same terms as ruby.
55
+ This software is distributed under either the terms of new Ruby
56
+ License or BSDL. See the file [COPYING](COPYING).
57
57
 
58
58
  Exception:
59
59
 
60
- * lib/test/unit/diff.rb is a triple license of the Ruby license,
61
- PSF license and LGPLv2.1 or later.
62
-
63
- * lib/test-unit.rb is a dual license of the Ruby license and LGPLv2.1
64
- or later.
60
+ * lib/test/unit/diff.rb is a triple license of (the new Ruby license
61
+ or BSDL) and PSF license.
65
62
 
66
63
  ## Authors
67
64
 
data/Rakefile CHANGED
@@ -1,20 +1,6 @@
1
1
  # -*- ruby -*-
2
2
  #
3
3
  # Copyright (C) 2008-2017 Kouhei Sutou <kou@clear-code.com>
4
- #
5
- # This library is free software; you can redistribute it and/or
6
- # modify it under the terms of the GNU Lesser General Public
7
- # License as published by the Free Software Foundation; either
8
- # version 2.1 of the License, or (at your option) any later version.
9
- #
10
- # This library is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
- # Lesser General Public License for more details.
14
- #
15
- # You should have received a copy of the GNU Lesser General Public
16
- # License along with this library; if not, write to the Free Software
17
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
4
 
19
5
  Encoding.default_internal = "UTF-8" if defined?(Encoding.default_internal)
20
6
 
@@ -38,7 +24,6 @@ require "packnga"
38
24
  task :default => :test
39
25
 
40
26
  base_dir = File.dirname(__FILE__)
41
- html_base_dir = File.join(base_dir, "doc", "html")
42
27
 
43
28
  helper = Bundler::GemHelper.new(base_dir)
44
29
  def helper.version_tag
@@ -67,14 +52,6 @@ def rake(*arguments)
67
52
  ruby($0, *arguments)
68
53
  end
69
54
 
70
- namespace :html do
71
- desc "Publish HTML to Web site."
72
- task :publish do
73
- # FIXME Do nothing for now
74
- #rsync_to_rubyforge(spec, "#{html_base_dir}/", "")
75
- end
76
- end
77
-
78
55
  task :test do
79
56
  ruby("test/run-test.rb")
80
57
  end
@@ -239,7 +239,7 @@ module Sub
239
239
  end
240
240
  ~~~
241
241
 
242
- ## 7. For more inforomation
242
+ ## 7. For more information
243
243
 
244
244
  Let's read the official document.
245
245
 
data/doc/text/news.md CHANGED
@@ -1,5 +1,371 @@
1
1
  # News
2
2
 
3
+ ## 3.4.7 - 2021-09-14 {#version-3-4-7}
4
+
5
+ ### Fixes
6
+
7
+ * Suppressed a warning on Ruby 2.
8
+ [GitHub#205][Patch by Kenichi Kamiya]
9
+
10
+ ### Thanks
11
+
12
+ * Kenichi Kamiya
13
+
14
+ ## 3.4.6 - 2021-09-11 {#version-3-4-6}
15
+
16
+ ### Improvements
17
+
18
+ * Added support for tests that use Ractor. Use
19
+ `Test::Unit::TestCase.ractor` to declare that these tests use
20
+ Ractor.
21
+
22
+ * Added `--debug-on-failure` option.
23
+
24
+ ## 3.4.5 - 2021-09-04 {#version-3-4-5}
25
+
26
+ ### Improvements
27
+
28
+ * Added more metadata to gemspec.
29
+ [GitHub#183][Patch by Kenichi Kamiya]
30
+
31
+ * Removed needless files from gem.
32
+ [GitHub#184][Patch by Kenichi Kamiya]
33
+
34
+ * Updated documents.
35
+ [GitHub#191][GitHub#192][GitHub#193][GitHub#199][GitHub#200]
36
+ [GitHub#201][Patch by Kenichi Kamiya]
37
+
38
+ * Added `assert_nothing_leaked_memory`.
39
+
40
+ ### Fixes
41
+
42
+ * Fixed typos in documents.
43
+ [GitHub#189][GitHub#190][GitHub#195][GitHub#197][Patch by Kenichi Kamiya]
44
+
45
+ ### Thanks
46
+
47
+ * Kenichi Kamiya
48
+
49
+ ## 3.4.4 - 2021-06-04 {#version-3-4-4}
50
+
51
+ ### Improvements
52
+
53
+ * Renamed `assert_all?` to `assert_all`. `assert_all?` is deprecated
54
+ but is available.
55
+
56
+ ## 3.4.3 - 2021-06-04 {#version-3-4-3}
57
+
58
+ ### Improvements
59
+
60
+ * Stopped to change result value of `Test::Unit::TestCase#include`.
61
+
62
+ * Added `assert_all?`.
63
+
64
+ * Added support for `assert_raise_with_message`.
65
+
66
+ ## 3.4.2 - 2021-05-30 {#version-3-4-2}
67
+
68
+ ### Improvements
69
+
70
+ * [UI][console]: Improved diff readability for no color
71
+ case. Character based diff marks are always showed.
72
+
73
+ ## 3.4.1 - 2021-04-19 {#version-3-4-1}
74
+
75
+ ### Fixes
76
+
77
+ * Fixed a bug that `setup`/`cleanup`/`teardown` with block may be
78
+ overwritten by another `setup`/`cleanup`/`teardown` with
79
+ block. It's caused only with Ruby 2.6 or earlier.
80
+ [GitHub#179][Reported by akira yamada]
81
+
82
+ ### Thanks
83
+
84
+ * akira yamada
85
+
86
+ ## 3.4.0 - 2021-01-30 {#version-3-4-0}
87
+
88
+ ### Improvements
89
+
90
+ * Enable deprecated warnings by default.
91
+
92
+ ## 3.3.9 - 2020-12-29 {#version-3-3-9}
93
+
94
+ ### Improvements
95
+
96
+ * `assert_not_match`: Add support for `String` as pattern.
97
+ [GitHub#178][Patch by David Rodríguez]
98
+
99
+ ### Thanks
100
+
101
+ * David Rodríguez
102
+
103
+ ## 3.3.8 - 2020-12-25 {#version-3-3-8}
104
+
105
+ ### Improvements
106
+
107
+ * [UI][console]: Removed reverse mode because Ruby 3.0 reverts
108
+ reverse backtrace.
109
+
110
+ ## 3.3.7 - 2020-11-18 {#version-3-3-7}
111
+
112
+ ### Improvements
113
+
114
+ * Improved TruffleRuby support.
115
+ [GitHub#171][Reported by Benoit Daloze]
116
+
117
+ * Removed needless `to_sym`.
118
+ [GitHub#177][Patch by icm7216]
119
+
120
+ * `assert_raise`: Added backtrace for actual error.
121
+
122
+ * Improved terminal color availability detection.
123
+ [GitHub#175][Patch by nicholas a. evans]
124
+
125
+ * Changed license to the new Ruby's.
126
+ [GitHub#174]
127
+
128
+ ### Fixes
129
+
130
+ * Fixed a typo in `--help` output:
131
+ [GitHub#176][Patch by icm7216]
132
+
133
+ ### Thanks
134
+
135
+ * Benoit Daloze
136
+
137
+ * icm7216
138
+
139
+ * nicholas a. evans
140
+
141
+ ## 3.3.6 - 2020-06-10 {#version-3-3-6}
142
+
143
+ ### Improvements
144
+
145
+ * `name`, `--ignore-name`:
146
+
147
+ * Added support for regular expression options.
148
+
149
+ * Added support for matching with class name in exact match mode.
150
+ [Reported by Jun Aruga]
151
+
152
+ * Updated ruby-talk mailing list information
153
+ [GitHub#168][Patch by Chris Kampmeier]
154
+
155
+ ### Thanks
156
+
157
+ * Chris Kampmeier
158
+
159
+ * Jun Aruga
160
+
161
+ ## 3.3.5 - 2020-01-10 {#version-3-3-5}
162
+
163
+ ### Improvements
164
+
165
+ * Improved code snippet showing with different default external encoding.
166
+ [GitHub#166][Patch by Yuta Iwama]
167
+
168
+ ### Thanks
169
+
170
+ * Yuta Iwama
171
+
172
+ ## 3.3.4 - 2019-09-30 {#version-3-3-4}
173
+
174
+ ### Improvements
175
+
176
+ * Converted markup format to Markdown from RDoc.
177
+ [GitHub#164][Patch by OGAWA KenIchi]
178
+
179
+ * test: Stopped to depend on `Time#inspect` format.
180
+ [GitHub#165][Reported by Benoit Daloze]
181
+
182
+ ### Thanks
183
+
184
+ * OGAWA KenIchi
185
+
186
+ * Benoit Daloze
187
+
188
+ ## 3.3.3 - 2019-05-10 {#version-3-3-3}
189
+
190
+ ### Fixed
191
+
192
+ * Fixed a bug that priority mode with test case name that uses
193
+ special characters such as `?` can't be used on Windows.
194
+
195
+ ## 3.3.2 - 2019-04-11 {#version-3-3-2}
196
+
197
+ ### Fixes
198
+
199
+ * Fixed a bug that `Test::Unit::Collector::Load` doesn't load test
200
+ files under sub directories when these files have the same base
201
+ name as test files in upper directories.
202
+ [Reported by Kenta Murata]
203
+
204
+ ### Thanks
205
+
206
+ * Kenta Murata
207
+
208
+ ## 3.3.1 - 2019-03-27 {#version-3-3-1}
209
+
210
+ ### Improvements
211
+
212
+ * Added support for `Test::Unit::AssertionFailedError#user_message`
213
+ for not only `assert_equal` and `assert_raise` but also all
214
+ assertions.
215
+ [GitHub#162][Reported by xgraffm]
216
+
217
+ ### Thanks
218
+
219
+ * xgraffm
220
+
221
+ ## 3.3.0 - 2019-01-23 {#version-3-3-0}
222
+
223
+ ### Improvements
224
+
225
+ * Added support for auto test run when all tests are defined in
226
+ modules.
227
+
228
+ * Added support for defining methods to test case class in multiple
229
+ threads.
230
+ [GitHub#159][Reported by Charles Oliver Nutter]
231
+
232
+ * Suppressed warnings on Ruby 2.5.
233
+ [GitHub#160][Reported by Daniel Berger]
234
+
235
+ * Suppressed warnings on Ruby 2.7.
236
+
237
+ ### Fixes
238
+
239
+ * Fixed a code snippet fetch failure when source code isn't UTF-8
240
+ and the default external encoding is set to not UTF-8.
241
+ [GitHub#161][Reported by masa kunikata]
242
+
243
+ ### Thanks
244
+
245
+ * Charles Oliver Nutter
246
+
247
+ * Daniel Berger
248
+
249
+ * masa kunikata
250
+
251
+ ## 3.2.9 - 2018-12-01 {#version-3-2-9}
252
+
253
+ ### Improvements
254
+
255
+ * Added support for data generation by method. `data_#{test_name}`
256
+ is called to generate data for `test_name` test.
257
+
258
+ * Added support for data matrix generation.
259
+
260
+ Example:
261
+
262
+ ```ruby
263
+ data(:a, [0, 1, 2])
264
+ data(:b, [:x, :y])
265
+ def test_data(data)
266
+ end
267
+ ```
268
+
269
+ This example generates the following data matrix:
270
+
271
+ * label: `"a: 0, b: :x"`, data: `{a: 0, b: :x}`
272
+ * label: `"a: 0, b: :y"`, data: `{a: 0, b: :y}`
273
+ * label: `"a: 1, b: :x"`, data: `{a: 1, b: :x}`
274
+ * label: `"a: 1, b: :y"`, data: `{a: 1, b: :y}`
275
+ * label: `"a: 2, b: :x"`, data: `{a: 2, b: :x}`
276
+ * label: `"a: 2, b: :y"`, data: `{a: 2, b: :y}`
277
+
278
+ * Added `Test::Unit::TestCase#data` that returns the current data.
279
+
280
+ * Added support for using test method that doesn't have no
281
+ parameters as data driven test.
282
+
283
+ Example:
284
+
285
+ ```ruby
286
+ data("label", :value)
287
+ def test_data # Available since this release
288
+ p data # :value
289
+ end
290
+ ```
291
+
292
+ * Added support for `:keep` option to `Test::Unit::TestCase.data`.
293
+
294
+ * Added support for `:group` option to
295
+ `Test::Unit::TestCase.data`. It's useful to generate multiple data
296
+ matrix groups.
297
+
298
+ ```ruby
299
+ # Group1
300
+ data(:a, [0, 1, 2], group: :g1)
301
+ data(:b, [:x, :y], group: :g1)
302
+ # Group2
303
+ data(:a, [:x, :y], group: :g2)
304
+ data(:c, [-1, -2], group: :g2)
305
+ def test_data(data)
306
+ end
307
+ ```
308
+
309
+ This example generates the following data matrix:
310
+
311
+ * label: `"group: :g1, a: 0, b: :x"`, data: `{a: 0, b: :x}`
312
+ * label: `"group: :g1, a: 0, b: :y"`, data: `{a: 0, b: :y}`
313
+ * label: `"group: :g1, a: 1, b: :x"`, data: `{a: 1, b: :x}`
314
+ * label: `"group: :g1, a: 1, b: :y"`, data: `{a: 1, b: :y}`
315
+ * label: `"group: :g1, a: 2, b: :x"`, data: `{a: 2, b: :x}`
316
+ * label: `"group: :g1, a: 2, b: :y"`, data: `{a: 2, b: :y}`
317
+ * label: `"group: :g2, a: :x, b: -1"`, data: `{a: :x, b: -1}`
318
+ * label: `"group: :g2, a: :x, b: -2"`, data: `{a: :x, b: -2}`
319
+ * label: `"group: :g2, a: :y, b: -1"`, data: `{a: :y, b: -1}`
320
+ * label: `"group: :g2, a: :y, b: -2"`, data: `{a: :y, b: -2}`
321
+
322
+ ## 3.2.8 - 2018-05-13 {#version-3-2-8}
323
+
324
+ ### Improvements
325
+
326
+ * [UI][console]: Changed to put code snippet before backtrace on
327
+ reverse mode.
328
+
329
+ ## 3.2.7 - 2017-12-12 {#version-3-2-7}
330
+
331
+ ### Improvements
332
+
333
+ * Added source code link to gemspec.
334
+ [GitHub#157][Patch by Grey Baker]
335
+
336
+ * Changed to use SVG image for badges in README.
337
+ [GitHub#158][Patch by Olle Jonsson]
338
+
339
+ * [UI][console]: Added `--reverse-output` option to output fault
340
+ details in reverse like Ruby 2.5. It's enabled by default only for
341
+ tty output.
342
+
343
+ ### Fixes
344
+
345
+ * Fixed a typo.
346
+ [GitHub#156][Patch by masa kunikata]
347
+
348
+ * [UI][console]: Fixed a bug that broken align in verbose mode.
349
+
350
+ ### Thanks
351
+
352
+ * masa kunikata
353
+
354
+ * Grey Baker
355
+
356
+ * Olle Jonsson
357
+
358
+ ## 3.2.6 - 2017-09-21 {#version-3-2-6}
359
+
360
+ ### Improvements
361
+
362
+ * Changed test file require failure to error from omission.
363
+ [GitHub#154][Patch by naofumi-fujii]
364
+
365
+ ### Thanks
366
+
367
+ * naofumi-fujii
368
+
3
369
  ## 3.2.5 - 2017-06-24 {#version-3-2-5}
4
370
 
5
371
  ### Improvements
@@ -9,6 +9,17 @@ module Test
9
9
 
10
10
  # Thrown by Test::Unit::Assertions when an assertion fails.
11
11
  class AssertionFailedError < StandardError
12
+ @debug_on_failure = false
13
+ class << self
14
+ def debug_on_failure=(boolean)
15
+ @debug_on_failure = boolean
16
+ end
17
+
18
+ def debug_on_failure?
19
+ @debug_on_failure
20
+ end
21
+ end
22
+
12
23
  attr_accessor :expected, :actual, :user_message
13
24
  attr_accessor :inspected_expected, :inspected_actual
14
25
  def initialize(message=nil, options=nil)
@@ -19,6 +30,30 @@ module Test
19
30
  @inspected_actual = options[:inspected_actual]
20
31
  @user_message = options[:user_message]
21
32
  super(message)
33
+ debug_on_failure
34
+ end
35
+
36
+ private
37
+ def debug_on_failure
38
+ return unless self.class.debug_on_failure?
39
+
40
+ begin
41
+ require "debug"
42
+ rescue LoadError
43
+ return
44
+ end
45
+
46
+ return unless binding.respond_to?(:break)
47
+
48
+ frames = caller(0)
49
+ pre = nil
50
+ Util::BacktraceFilter.filter_backtrace(frames).each do |location|
51
+ frame_index = frames.index(location)
52
+ next if frame_index.nil?
53
+ pre = "frame #{frame_index}"
54
+ break
55
+ end
56
+ binding.break(pre: pre)
22
57
  end
23
58
  end
24
59
  end