test-unit 3.3.5 → 3.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/text/news.md +20 -0
- data/lib/test/unit.rb +42 -37
- data/lib/test/unit/autorunner.rb +55 -23
- data/lib/test/unit/version.rb +1 -1
- metadata +37 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7aaedb309f50feea0367554eeef8b79f0daf6edb5c75c4b66df9e990c35d371
|
4
|
+
data.tar.gz: 17bd1f32e290087d6b57cf5337dbd8cc8259896671ef1cc6c23b15579e52698b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d86d52e5ed5bc4930f6b26f76d0294cb2e50261f16495649e75eb79ab2631cd23c2bfd6602ede230384f3971e9f780f87a8324ca15a0b3a09866a1c449641e55
|
7
|
+
data.tar.gz: 26975998cc3e8c4c6e5d372b3d3e51316e2709508fdb5ebd87083dcf658941f4b038bcc4f6e1f714ba891a14c1ccbca5ec5e197065a45163dcfd5861cd5b6c15
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 3.3.6 - 2020-06-10 {#version-3-3-6}
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* `name`, `--ignore-name`:
|
8
|
+
|
9
|
+
* Added support for regular expression options.
|
10
|
+
|
11
|
+
* Added support for matching with class name in exact match mode.
|
12
|
+
[Reported by Jun Aruga]
|
13
|
+
|
14
|
+
* Updated ruby-talk mailing list information
|
15
|
+
[GitHub#168][Patch by Chris Kampmeier]
|
16
|
+
|
17
|
+
### Thanks
|
18
|
+
|
19
|
+
* Chris Kampmeier
|
20
|
+
|
21
|
+
* Jun Aruga
|
22
|
+
|
3
23
|
## 3.3.5 - 2020-01-10 {#version-3-3-5}
|
4
24
|
|
5
25
|
### Improvements
|
data/lib/test/unit.rb
CHANGED
@@ -4,9 +4,9 @@ require 'test/unit/autorunner'
|
|
4
4
|
module Test # :nodoc:
|
5
5
|
#
|
6
6
|
# # Test::Unit - Ruby Unit Testing Framework
|
7
|
-
#
|
7
|
+
#
|
8
8
|
# ## Introduction
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# Unit testing is making waves all over the place, largely due to the
|
11
11
|
# fact that it is a core practice of XP. While XP is great, unit testing
|
12
12
|
# has been around for a long time and has always been a good idea. One
|
@@ -18,19 +18,19 @@ module Test # :nodoc:
|
|
18
18
|
# as possible, you slowly build up a wall of things that cannot break
|
19
19
|
# without you immediately knowing about it. This is when unit testing
|
20
20
|
# hits its peak usefulness.
|
21
|
-
#
|
21
|
+
#
|
22
22
|
# Enter Test::Unit, a framework for unit testing in Ruby, helping you to
|
23
23
|
# design, debug and evaluate your code by making it easy to write and
|
24
24
|
# have tests for it.
|
25
|
-
#
|
26
|
-
#
|
25
|
+
#
|
26
|
+
#
|
27
27
|
# ## Notes
|
28
|
-
#
|
28
|
+
#
|
29
29
|
# Test::Unit has grown out of and superceded Lapidary.
|
30
|
-
#
|
31
|
-
#
|
30
|
+
#
|
31
|
+
#
|
32
32
|
# ## Feedback
|
33
|
-
#
|
33
|
+
#
|
34
34
|
# I like (and do my best to practice) XP, so I value early releases,
|
35
35
|
# user feedback, and clean, simple, expressive code. There is always
|
36
36
|
# room for improvement in everything I do, and Test::Unit is no
|
@@ -41,73 +41,78 @@ module Test # :nodoc:
|
|
41
41
|
# hear about any successes you have with Test::Unit, and any
|
42
42
|
# documentation you might add will be greatly appreciated. My contact
|
43
43
|
# info is below.
|
44
|
-
#
|
45
|
-
#
|
44
|
+
#
|
45
|
+
#
|
46
46
|
# ## Contact Information
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
47
|
+
#
|
48
|
+
# * [GitHub issues on
|
49
|
+
# test-unit/test-unit](https://github.com/test-unit/test-unit/issues):
|
50
|
+
# If you have any issues, please report them to here.
|
51
|
+
#
|
52
|
+
# * [GitHub pull requests on
|
53
|
+
# test-unit/test-unit](https://github.com/test-unit/test-unit/pulls):
|
54
|
+
# If you have any patches, please report them to here.
|
55
|
+
#
|
56
|
+
# * [ruby-talk mailing
|
57
|
+
# list](https://www.ruby-lang.org/en/community/mailing-lists/):
|
58
|
+
# If you have any questions, you can ask them here.
|
59
|
+
#
|
60
|
+
#
|
56
61
|
# ## Credits
|
57
|
-
#
|
62
|
+
#
|
58
63
|
# I'd like to thank...
|
59
|
-
#
|
64
|
+
#
|
60
65
|
# Matz, for a great language!
|
61
|
-
#
|
66
|
+
#
|
62
67
|
# Masaki Suketa, for his work on RubyUnit, which filled a vital need in
|
63
68
|
# the Ruby world for a very long time. I'm also grateful for his help in
|
64
69
|
# polishing Test::Unit and getting the RubyUnit compatibility layer
|
65
70
|
# right. His graciousness in allowing Test::Unit to supercede RubyUnit
|
66
71
|
# continues to be a challenge to me to be more willing to defer my own
|
67
72
|
# rights.
|
68
|
-
#
|
73
|
+
#
|
69
74
|
# Ken McKinlay, for his interest and work on unit testing, and for his
|
70
75
|
# willingness to dialog about it. He was also a great help in pointing
|
71
76
|
# out some of the holes in the RubyUnit compatibility layer.
|
72
|
-
#
|
77
|
+
#
|
73
78
|
# Dave Thomas, for the original idea that led to the extremely simple
|
74
79
|
# "require 'test/unit'", plus his code to improve it even more by
|
75
80
|
# allowing the selection of tests from the command-line. Also, without
|
76
81
|
# RDoc, the documentation for Test::Unit would stink a lot more than it
|
77
82
|
# does now.
|
78
|
-
#
|
83
|
+
#
|
79
84
|
# Everyone who's helped out with bug reports, feature ideas,
|
80
85
|
# encouragement to continue, etc. It's a real privilege to be a part of
|
81
86
|
# the Ruby community.
|
82
|
-
#
|
87
|
+
#
|
83
88
|
# The guys at RoleModel Software, for putting up with me repeating, "But
|
84
89
|
# this would be so much easier in Ruby!" whenever we're coding in Java.
|
85
|
-
#
|
90
|
+
#
|
86
91
|
# My Creator, for giving me life, and giving it more abundantly.
|
87
|
-
#
|
88
|
-
#
|
92
|
+
#
|
93
|
+
#
|
89
94
|
# ## License
|
90
|
-
#
|
95
|
+
#
|
91
96
|
# Test::Unit is copyright (c) 2000-2003 Nathaniel Talbott. It is free
|
92
97
|
# software, and is distributed under the Ruby license. See the COPYING
|
93
98
|
# file.
|
94
|
-
#
|
99
|
+
#
|
95
100
|
# Exception: lib/test/unit/diff.rb is copyright (c)
|
96
101
|
# 2008-2010 Kouhei Sutou and 2001-2008 Python Software
|
97
102
|
# Foundation. It is free software, and is distributed
|
98
103
|
# under the Ruby license and/or the PSF license. See the
|
99
104
|
# COPYING file and PSFL file.
|
100
|
-
#
|
105
|
+
#
|
101
106
|
# ## Warranty
|
102
|
-
#
|
107
|
+
#
|
103
108
|
# This software is provided "as is" and without any express or
|
104
109
|
# implied warranties, including, without limitation, the implied
|
105
110
|
# warranties of merchantibility and fitness for a particular
|
106
111
|
# purpose.
|
107
|
-
#
|
108
|
-
#
|
112
|
+
#
|
113
|
+
#
|
109
114
|
# ## Author
|
110
|
-
#
|
115
|
+
#
|
111
116
|
# Nathaniel Talbott.
|
112
117
|
# Copyright (c) 2000-2003, Nathaniel Talbott
|
113
118
|
#
|
data/lib/test/unit/autorunner.rb
CHANGED
@@ -246,54 +246,61 @@ module Test
|
|
246
246
|
|
247
247
|
o.on("-n", "--name=NAME", String,
|
248
248
|
"Runs tests matching NAME.",
|
249
|
-
"Use '/PATTERN/' for NAME to use regular expression."
|
250
|
-
|
249
|
+
"Use '/PATTERN/' for NAME to use regular expression.",
|
250
|
+
"Regular expression accepts options.",
|
251
|
+
"Example: '/taRget/i' matches 'target' and 'TARGET'") do |name|
|
252
|
+
name = prepare_name(name)
|
251
253
|
@filters << lambda do |test|
|
252
|
-
|
253
|
-
return true if name === test.local_name
|
254
|
-
false
|
254
|
+
match_test_name(test, name)
|
255
255
|
end
|
256
256
|
end
|
257
257
|
|
258
258
|
o.on("--ignore-name=NAME", String,
|
259
259
|
"Ignores tests matching NAME.",
|
260
|
-
"Use '/PATTERN/' for NAME to use regular expression."
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
@filters << proc {|t| n != t.method_name}
|
260
|
+
"Use '/PATTERN/' for NAME to use regular expression.",
|
261
|
+
"Regular expression accepts options.",
|
262
|
+
"Example: '/taRget/i' matches 'target' and 'TARGET'") do |name|
|
263
|
+
name = prepare_name(name)
|
264
|
+
@filters << lambda do |test|
|
265
|
+
not match_test_name(test, name)
|
267
266
|
end
|
268
267
|
end
|
269
268
|
|
270
269
|
o.on("-t", "--testcase=TESTCASE", String,
|
271
270
|
"Runs tests in TestCases matching TESTCASE.",
|
272
|
-
"Use '/PATTERN/' for TESTCASE to use regular expression."
|
273
|
-
|
271
|
+
"Use '/PATTERN/' for TESTCASE to use regular expression.",
|
272
|
+
"Regular expression accepts options.",
|
273
|
+
"Example: '/taRget/i' matches 'target' and 'TARGET'") do |name|
|
274
|
+
name = prepare_name(name)
|
274
275
|
@filters << lambda do |test|
|
275
|
-
match_test_case_name(test,
|
276
|
+
match_test_case_name(test, name)
|
276
277
|
end
|
277
278
|
end
|
278
279
|
|
279
280
|
o.on("--ignore-testcase=TESTCASE", String,
|
280
281
|
"Ignores tests in TestCases matching TESTCASE.",
|
281
|
-
"Use '/PATTERN/' for TESTCASE to use regular expression."
|
282
|
-
|
282
|
+
"Use '/PATTERN/' for TESTCASE to use regular expression.",
|
283
|
+
"Regular expression accepts options.",
|
284
|
+
"Example: '/taRget/i' matches 'target' and 'TARGET'") do |name|
|
285
|
+
name = prepare_name(name)
|
283
286
|
@filters << lambda do |test|
|
284
|
-
not match_test_case_name(test,
|
287
|
+
not match_test_case_name(test, name)
|
285
288
|
end
|
286
289
|
end
|
287
290
|
|
288
291
|
o.on("--location=LOCATION", String,
|
289
292
|
"Runs tests that defined in LOCATION.",
|
290
|
-
"LOCATION is one of PATH:LINE, PATH or LINE") do |location|
|
291
|
-
|
293
|
+
"LOCATION is one of PATH:LINE, PATH or LINE.") do |location|
|
294
|
+
case location
|
295
|
+
when /\A(\d+)\z/
|
292
296
|
path = nil
|
293
|
-
line =
|
297
|
+
line = $1.to_i
|
298
|
+
when /:(\d+)\z/
|
299
|
+
path = $PREMATCH
|
300
|
+
line = $1.to_i
|
294
301
|
else
|
295
|
-
path
|
296
|
-
line =
|
302
|
+
path = location
|
303
|
+
line = nil
|
297
304
|
end
|
298
305
|
add_location_filter(path, line)
|
299
306
|
end
|
@@ -496,6 +503,31 @@ module Test
|
|
496
503
|
end
|
497
504
|
end
|
498
505
|
|
506
|
+
def prepare_name(name)
|
507
|
+
case name
|
508
|
+
when /\A\/(.*)\/([imx]*)\z/
|
509
|
+
pattern = $1
|
510
|
+
options_raw = $2
|
511
|
+
options = 0
|
512
|
+
options |= Regexp::IGNORECASE if options_raw.include?("i")
|
513
|
+
options |= Regexp::MULTILINE if options_raw.include?("m")
|
514
|
+
options |= Regexp::EXTENDED if options_raw.include?("x")
|
515
|
+
Regexp.new(pattern, options)
|
516
|
+
else
|
517
|
+
name
|
518
|
+
end
|
519
|
+
end
|
520
|
+
|
521
|
+
def match_test_name(test, pattern)
|
522
|
+
return true if pattern === test.method_name
|
523
|
+
return true if pattern === test.local_name
|
524
|
+
if pattern.is_a?(String)
|
525
|
+
return true if pattern === "#{test.class}##{test.method_name}"
|
526
|
+
return true if pattern === "#{test.class}##{test.local_name}"
|
527
|
+
end
|
528
|
+
false
|
529
|
+
end
|
530
|
+
|
499
531
|
def match_test_case_name(test, pattern)
|
500
532
|
test.class.ancestors.each do |test_class|
|
501
533
|
break if test_class == TestCase
|
data/lib/test/unit/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-unit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-06-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: power_assert
|
@@ -231,49 +231,48 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
231
231
|
- !ruby/object:Gem::Version
|
232
232
|
version: '0'
|
233
233
|
requirements: []
|
234
|
-
|
235
|
-
rubygems_version: 2.7.6.2
|
234
|
+
rubygems_version: 3.2.0.pre1
|
236
235
|
signing_key:
|
237
236
|
specification_version: 4
|
238
237
|
summary: An xUnit family unit testing framework for Ruby.
|
239
238
|
test_files:
|
240
|
-
- test/
|
241
|
-
- test/
|
242
|
-
- test/
|
243
|
-
- test/
|
244
|
-
- test/
|
245
|
-
- test/test-diff.rb
|
246
|
-
- test/test-assertions.rb
|
247
|
-
- test/testunit-test-util.rb
|
248
|
-
- test/run-test.rb
|
249
|
-
- test/test-emacs-runner.rb
|
250
|
-
- test/test-color.rb
|
251
|
-
- test/test-pending.rb
|
252
|
-
- test/test-omission.rb
|
253
|
-
- test/test-color-scheme.rb
|
254
|
-
- test/test-test-result.rb
|
255
|
-
- test/test-test-suite.rb
|
256
|
-
- test/test-code-snippet.rb
|
257
|
-
- test/test-test-case.rb
|
258
|
-
- test/test-failure.rb
|
259
|
-
- test/fixtures/no-header.csv
|
239
|
+
- test/collector/test-descendant.rb
|
240
|
+
- test/collector/test-load.rb
|
241
|
+
- test/collector/test_dir.rb
|
242
|
+
- test/collector/test_objectspace.rb
|
243
|
+
- test/fixtures/header-label.csv
|
260
244
|
- test/fixtures/header-label.tsv
|
261
|
-
- test/fixtures/no-header.tsv
|
262
245
|
- test/fixtures/header.csv
|
263
|
-
- test/fixtures/header-label.csv
|
264
|
-
- test/fixtures/plus.csv
|
265
246
|
- test/fixtures/header.tsv
|
266
|
-
- test/
|
247
|
+
- test/fixtures/no-header.csv
|
248
|
+
- test/fixtures/no-header.tsv
|
249
|
+
- test/fixtures/plus.csv
|
250
|
+
- test/run-test.rb
|
251
|
+
- test/test-assertions.rb
|
252
|
+
- test/test-attribute-matcher.rb
|
253
|
+
- test/test-attribute.rb
|
254
|
+
- test/test-code-snippet.rb
|
255
|
+
- test/test-color-scheme.rb
|
256
|
+
- test/test-color.rb
|
257
|
+
- test/test-data.rb
|
258
|
+
- test/test-diff.rb
|
259
|
+
- test/test-emacs-runner.rb
|
260
|
+
- test/test-error.rb
|
261
|
+
- test/test-failure.rb
|
262
|
+
- test/test-fault-location-detector.rb
|
267
263
|
- test/test-fixture.rb
|
264
|
+
- test/test-notification.rb
|
265
|
+
- test/test-omission.rb
|
266
|
+
- test/test-pending.rb
|
268
267
|
- test/test-priority.rb
|
268
|
+
- test/test-test-case.rb
|
269
|
+
- test/test-test-result.rb
|
269
270
|
- test/test-test-suite-creator.rb
|
270
|
-
- test/test-
|
271
|
-
- test/test-
|
272
|
-
- test/
|
273
|
-
- test/test-
|
274
|
-
- test/
|
275
|
-
- test/
|
276
|
-
- test/
|
277
|
-
- test/
|
278
|
-
- test/test-error.rb
|
279
|
-
- test/test-data.rb
|
271
|
+
- test/test-test-suite.rb
|
272
|
+
- test/testunit-test-util.rb
|
273
|
+
- test/ui/test_testrunmediator.rb
|
274
|
+
- test/util/test-method-owner-finder.rb
|
275
|
+
- test/util/test-output.rb
|
276
|
+
- test/util/test_backtracefilter.rb
|
277
|
+
- test/util/test_observable.rb
|
278
|
+
- test/util/test_procwrapper.rb
|