test-unit 3.4.9 → 3.5.3
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 +40 -0
- data/lib/test/unit/data-sets.rb +14 -9
- data/lib/test/unit/data.rb +3 -3
- data/lib/test/unit/priority.rb +0 -2
- data/lib/test/unit/testcase.rb +12 -7
- data/lib/test/unit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a763b935a0a7386519019ce4dc198a3ba9f0dd00f9f44a10cb887d48f2b9d2e
|
4
|
+
data.tar.gz: a7b94931289833bc8406c5b07421425110a37ff9a099c43257a83e9b3759a7f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4cda5342ca0dee7d082e7a61c41a16e532a270848c5944cad33b04fac1cc4b4eaafc3952fba1e8035f2a2f23dd0ef71adf01262210c8f4df860ef155e92cefd
|
7
|
+
data.tar.gz: a28acd0a86eaab701fc1bcc4682e17d1ddd2298fa34e2e292fffe488995f257b728fb0aaedb9d9e0511316dd411b9d44a09d59084c91997e190fef55a2b3ce14
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,45 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 3.5.3 - 2021-12-20 {#version-3-5-3}
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* Made how to sub test case generation customizable.
|
8
|
+
[GitHub#207][Patch by Akira Matsuda]
|
9
|
+
|
10
|
+
### Thanks
|
11
|
+
|
12
|
+
* Akira Matsuda
|
13
|
+
|
14
|
+
## 3.5.2 - 2021-12-10 {#version-3-5-2}
|
15
|
+
|
16
|
+
### Improvements
|
17
|
+
|
18
|
+
* Required `fileutils` lazy.
|
19
|
+
[GitHub#206][Patch by David Rodríguez]
|
20
|
+
|
21
|
+
### Thanks
|
22
|
+
|
23
|
+
* David Rodríguez
|
24
|
+
|
25
|
+
## 3.5.1 - 2021-11-08 {#version-3-5-1}
|
26
|
+
|
27
|
+
### Fixes
|
28
|
+
|
29
|
+
* Fixed a bug that `keep: true` is ignored when data set is
|
30
|
+
generated by block. [Reported by Kenta Murata]
|
31
|
+
|
32
|
+
### Thanks
|
33
|
+
|
34
|
+
* Kenta Murata
|
35
|
+
|
36
|
+
## 3.5.0 - 2021-10-18 {#version-3-5-0}
|
37
|
+
|
38
|
+
### Fixes
|
39
|
+
|
40
|
+
* Fixed a bug that `keep: true` is ignored when the last `data`
|
41
|
+
doesn't have `keep: true`.
|
42
|
+
|
3
43
|
## 3.4.9 - 2021-10-18 {#version-3-4-9}
|
4
44
|
|
5
45
|
### Improvements
|
data/lib/test/unit/data-sets.rb
CHANGED
@@ -22,17 +22,16 @@ module Test
|
|
22
22
|
add(data_set)
|
23
23
|
end
|
24
24
|
|
25
|
+
def have_keep?
|
26
|
+
each_data_set do |_, options|
|
27
|
+
return true if options[:keep]
|
28
|
+
end
|
29
|
+
false
|
30
|
+
end
|
31
|
+
|
25
32
|
def keep
|
26
33
|
new_data_sets = self.class.new
|
27
|
-
|
28
|
-
block = lambda do |(data_set, options)|
|
29
|
-
yielder << [data_set, options]
|
30
|
-
end
|
31
|
-
@procs.each(&block)
|
32
|
-
@variables.each(&block)
|
33
|
-
@value_sets.each(&block)
|
34
|
-
end
|
35
|
-
all_data_sets.each do |data_set, options|
|
34
|
+
each_data_set do |data_set, options|
|
36
35
|
next if options.nil?
|
37
36
|
next unless options[:keep]
|
38
37
|
new_data_sets.add(data_set, options)
|
@@ -79,6 +78,12 @@ module Test
|
|
79
78
|
end
|
80
79
|
|
81
80
|
private
|
81
|
+
def each_data_set(&block)
|
82
|
+
@procs.each(&block)
|
83
|
+
@variables.each(&block)
|
84
|
+
@value_sets.each(&block)
|
85
|
+
end
|
86
|
+
|
82
87
|
def each_pattern(variables)
|
83
88
|
grouped_variables = variables.group_by do |_, options|
|
84
89
|
options[:group]
|
data/lib/test/unit/data.rb
CHANGED
@@ -136,7 +136,7 @@ module Test
|
|
136
136
|
when 1
|
137
137
|
if block_given?
|
138
138
|
data_set = block
|
139
|
-
options = arguments[
|
139
|
+
options = arguments[0]
|
140
140
|
else
|
141
141
|
data_set = arguments[0]
|
142
142
|
end
|
@@ -170,11 +170,11 @@ module Test
|
|
170
170
|
options ||= {}
|
171
171
|
data_sets = current_attribute(:data)[:value] || DataSets.new
|
172
172
|
data_sets.add(data_set, options)
|
173
|
-
if options[:keep]
|
173
|
+
if options[:keep] or data_sets.have_keep?
|
174
174
|
keep_hook = lambda do |attr|
|
175
175
|
attr.merge(value: attr[:value].keep)
|
176
176
|
end
|
177
|
-
options = options.merge(keep_hook: keep_hook)
|
177
|
+
options = options.merge(keep: true, keep_hook: keep_hook)
|
178
178
|
end
|
179
179
|
attribute(:data, data_sets, options)
|
180
180
|
end
|
data/lib/test/unit/priority.rb
CHANGED
data/lib/test/unit/testcase.rb
CHANGED
@@ -419,13 +419,7 @@ module Test
|
|
419
419
|
# case class context.
|
420
420
|
# @return [Test::Unit::TestCase] Created sub test case class.
|
421
421
|
def sub_test_case(name, &block)
|
422
|
-
|
423
|
-
sub_test_case = Class.new(self) do
|
424
|
-
singleton_class = class << self; self; end
|
425
|
-
singleton_class.__send__(:define_method, :name) do
|
426
|
-
[parent_test_case.name, name].compact.join("::")
|
427
|
-
end
|
428
|
-
end
|
422
|
+
sub_test_case = sub_test_case_class(name)
|
429
423
|
sub_test_case.class_eval(&block)
|
430
424
|
sub_test_case
|
431
425
|
end
|
@@ -514,6 +508,17 @@ module Test
|
|
514
508
|
target_locations
|
515
509
|
end
|
516
510
|
end
|
511
|
+
|
512
|
+
# @private
|
513
|
+
def sub_test_case_class(name)
|
514
|
+
parent_test_case = self
|
515
|
+
Class.new(self) do
|
516
|
+
singleton_class = class << self; self; end
|
517
|
+
singleton_class.__send__(:define_method, :name) do
|
518
|
+
[parent_test_case.name, name].compact.join("::")
|
519
|
+
end
|
520
|
+
end
|
521
|
+
end
|
517
522
|
end
|
518
523
|
|
519
524
|
attr_reader :method_name
|
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.
|
4
|
+
version: 3.5.3
|
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: 2021-
|
12
|
+
date: 2021-12-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: power_assert
|