test-unit 3.4.6 → 3.5.0

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: 0f8ed035b9be7e1b2a3c92d767c8007d46e867131d7385e54b2096170d658226
4
- data.tar.gz: 426871e1614d48c08de963123fb36654da1abf611d1b3ca005a952fc4c4dd66b
3
+ metadata.gz: 5d7f5b0dc45031fefcdfb3041dfdc747c92eeaecd992cca117e151e4cac580d2
4
+ data.tar.gz: b3473fdb9cea9212e89b5c35cfe6ecee43f2c4efd1c69b5ed7bc9c1d97278b23
5
5
  SHA512:
6
- metadata.gz: 1ee530d7c01b91eee8ca71c62f6086ea3875c4fcf057ef5cd514896d633d4331f24ca5964a338622f7a80c747358cb85d4ae3996d30687b4f5f37d657d93f658
7
- data.tar.gz: f0707e81dd0fa2f368759d0a61f1fae9dd764aeeb12e7e8c2cfd5b5f5fc0de76b13821154353fa1045b441a2a58f1d689a9530032c130ede1d3058d29f6d760b
6
+ metadata.gz: 6ff80ac0c8e57c424769c1bc393bee079525b6e589e9b81e9aca09915336d63d285e0a26278b6f904c68d87f59c0e6f23231226132440a45dc4b4d05e341401a
7
+ data.tar.gz: d801dfe17d358768d30711e53c8d27530f9aa46623d44829d839e8c3129351bd3d6ac5fd594fb9a726d21f7657773fd6dcd94c77cf964392a23fda1056245dc3
data/doc/text/news.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # News
2
2
 
3
+ ## 3.5.0 - 2021-10-18 {#version-3-5-0}
4
+
5
+ ### Fixes
6
+
7
+ * Fixed a bug that `keep: true` is ignored when the last `data`
8
+ doesn't have `keep: true`.
9
+
10
+ ## 3.4.9 - 2021-10-18 {#version-3-4-9}
11
+
12
+ ### Improvements
13
+
14
+ * Added support for labeling each variable values by using `Hash`.
15
+
16
+ ## 3.4.8 - 2021-10-11 {#version-3-4-8}
17
+
18
+ ### Improvements
19
+
20
+ * Added support for omitting Ractor tests on Ruby 2.7 or earlier
21
+ automatically.
22
+
23
+ ## 3.4.7 - 2021-09-14 {#version-3-4-7}
24
+
25
+ ### Fixes
26
+
27
+ * Suppressed a warning on Ruby 2.
28
+ [GitHub#205][Patch by Kenichi Kamiya]
29
+
30
+ ### Thanks
31
+
32
+ * Kenichi Kamiya
33
+
3
34
  ## 3.4.6 - 2021-09-11 {#version-3-4-6}
4
35
 
5
36
  ### Improvements
@@ -9,8 +9,8 @@ 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
12
13
  class << self
13
- @debug_on_failure = false
14
14
  def debug_on_failure=(boolean)
15
15
  @debug_on_failure = boolean
16
16
  end
@@ -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)
@@ -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
@@ -851,6 +851,9 @@ module Test
851
851
  notify("<#{signature}> was redefined",
852
852
  :backtrace => redefined_info[:backtrace])
853
853
  end
854
+ if self[:ractor] and not defined?(::Ractor)
855
+ omit("<#{signature}> requires Ractor")
856
+ end
854
857
  if @internal_data.have_test_data?
855
858
  test_method = method(@method_name)
856
859
  arity = test_method.arity
@@ -1,5 +1,5 @@
1
1
  module Test
2
2
  module Unit
3
- VERSION = "3.4.6"
3
+ VERSION = "3.5.0"
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.6
4
+ version: 3.5.0
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-09-11 00:00:00.000000000 Z
12
+ date: 2021-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: power_assert