test-unit 3.4.8 → 3.5.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f71beead19a58b6dd15eadbce6ba5f773a25dc5e8a69cdfc5e0b227fe60bfef
4
- data.tar.gz: c845b3d680a4f8d4d835bbfa3c3d86fdc5b1aa2faa21b9f6ebcb5635628a7e47
3
+ metadata.gz: f68e06076f196af5137a8514872309304b5eac72a72035649deb58babc029ed0
4
+ data.tar.gz: 595d74f6c5ebbce27e817860993e490d71f8539dd1a2debe6d5ae1bc58e88df7
5
5
  SHA512:
6
- metadata.gz: 52534de6505e9b791d185d52ac4f8cfba7799c3f937f1fabe9a2419cb43cfae0fef1224727e25f8cb1a69fcef220c49a5a42b57c2b580dee7438d0c8ec64e390
7
- data.tar.gz: 233aca4112351087c13b900cf64261d5d730fa16fe2b7ab9c14a8be81a43e1032849e3fcc90f1589528738879ccb9fa5d117b5328345967e0b17693d55105afc
6
+ metadata.gz: c0b9c2dfc8d9c21dc7ff5866cc40f574dba66ca4fa11879cb6550579baca19435853191f1190e953323c3dd91f7fcd0e9769c2721082558393daf3b56b5a936e
7
+ data.tar.gz: bb2a03ac492469966e7202cf36c1e1b93bf5b89a09b2206a983dc55d1f1fa632b153f60a88ccc20ad7046be81138b2a798cbc72d13fa0b2e98024c07bb7ed13d
data/doc/text/news.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # News
2
2
 
3
+ ## 3.5.2 - 2021-12-10 {#version-3-5-2}
4
+
5
+ ### Improvements
6
+
7
+ * Required `fileutils` lazy.
8
+ [GitHub#206][Patch by David Rodríguez]
9
+
10
+ ### Thanks
11
+
12
+ * David Rodríguez
13
+
14
+ ## 3.5.1 - 2021-11-08 {#version-3-5-1}
15
+
16
+ ### Fixes
17
+
18
+ * Fixed a bug that `keep: true` is ignored when data set is
19
+ generated by block. [Reported by Kenta Murata]
20
+
21
+ ### Thanks
22
+
23
+ * Kenta Murata
24
+
25
+ ## 3.5.0 - 2021-10-18 {#version-3-5-0}
26
+
27
+ ### Fixes
28
+
29
+ * Fixed a bug that `keep: true` is ignored when the last `data`
30
+ doesn't have `keep: true`.
31
+
32
+ ## 3.4.9 - 2021-10-18 {#version-3-4-9}
33
+
34
+ ### Improvements
35
+
36
+ * Added support for labeling each variable values by using `Hash`.
37
+
3
38
  ## 3.4.8 - 2021-10-11 {#version-3-4-8}
4
39
 
5
40
  ### Improvements
@@ -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
- all_data_sets = Enumerator.new do |yielder|
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]
@@ -88,9 +93,9 @@ module Test
88
93
  label = String.new
89
94
  label << "group: #{group.inspect}" unless group.nil?
90
95
  data = {}
91
- cell.each do |variable, pattern|
96
+ cell.each do |variable, pattern, pattern_label|
92
97
  label << ", " unless label.empty?
93
- label << "#{variable}: #{pattern.inspect}"
98
+ label << "#{variable}: #{pattern_label}"
94
99
  data[variable] = pattern
95
100
  end
96
101
  yield(label, data)
@@ -105,8 +110,14 @@ module Test
105
110
  variable
106
111
  end
107
112
  all_patterns = sorted_variables.collect do |(variable, patterns), _|
108
- patterns.collect do |pattern|
109
- [variable, pattern]
113
+ if patterns.is_a?(Hash)
114
+ patterns.collect do |pattern_label, pattern|
115
+ [variable, pattern, pattern_label]
116
+ end
117
+ else
118
+ patterns.collect do |pattern|
119
+ [variable, pattern, pattern.inspect]
120
+ end
110
121
  end
111
122
  end
112
123
  all_patterns[0].product(*all_patterns[1..-1], &block)
@@ -136,7 +136,7 @@ module Test
136
136
  when 1
137
137
  if block_given?
138
138
  data_set = block
139
- options = arguments[1]
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
@@ -1,5 +1,3 @@
1
- require "fileutils"
2
-
3
1
  module Test
4
2
  module Unit
5
3
  module Priority
@@ -1,5 +1,5 @@
1
1
  module Test
2
2
  module Unit
3
- VERSION = "3.4.8"
3
+ VERSION = "3.5.2"
4
4
  end
5
5
  end
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.8
4
+ version: 3.5.2
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-10-11 00:00:00.000000000 Z
12
+ date: 2021-12-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: power_assert