minitest 5.21.1 → 5.22.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: 93aa935fa793db73b5d06918b074bf4a096277ce370b28de02e8985e9ff9d59c
4
- data.tar.gz: 02a61902e998e427f82ed68817d8cc37d844de4ad810e306eb4d2e9f7f5157d9
3
+ metadata.gz: 24c5445e518a9b867eabce480e1d5c176c93fc6806eaed987200961e56443ec0
4
+ data.tar.gz: 2b1c37793c825e1b437d30a899411a2d71e924ab250c23d348f71ca1dbd68df2
5
5
  SHA512:
6
- metadata.gz: 763100b3c3e55372e57bf04cb19f5cd20423df8fed5245436b5bffaac07c2265d98bddb052d924c3257c5d9c1cc9faf2c1cadbf48ffcdf47320c27a3a2e96e2d
7
- data.tar.gz: 34a53cef30066575612a61bc0d9d991c5a02598b817bc15a61762687258767fa30dcbb9263c0bb850860fc74fc267702382196d936c943f861d3dea91f10160e
6
+ metadata.gz: bc52b553200c232e0493953439fd935ee6cac3e46c45e121c81c2bc0046a5afd44caf8df980273fd46bf9ac81d38f1349f3a76a9ce9f59afff0e0e2316ea1a45
7
+ data.tar.gz: f98fcfb53d73e1d134d16b376aba3d78ef90d27024c18c48a5e0b153cc55225afc38c2c166e92d9282ffab713654843f82c9fa8a20332a16cc7308c9e1e4a140
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,34 @@
1
+ === 5.22.2 / 2024-02-07
2
+
3
+ * 1 bug fix:
4
+
5
+ * Third time's a charm? Remember: 'ensure' is almost always the
6
+ wrong way to go (for results... it's great for cleaning up).
7
+
8
+ === 5.22.1 / 2024-02-06
9
+
10
+ * 1 bug fix:
11
+
12
+ * Don't exit non-zero if no tests ran and no filter (aka, the test file is empty).
13
+ (I'm starting to think the exit 1 thing for @tenderlove was a mistake...)
14
+
15
+ === 5.22.0 / 2024-02-05
16
+
17
+ * 1 minor enhancement:
18
+
19
+ * Added "did you mean" output if your --name filter matches nothing. (tenderlove)
20
+
21
+ * 2 bug fixes:
22
+
23
+ * Big cleanup of test filtering. Much prettier / more functional.
24
+ * Fix situation where Assertion#location can't find the location. (pftg)
25
+
26
+ === 5.21.2 / 2024-01-17
27
+
28
+ * 1 bug fix:
29
+
30
+ * Fixed bug in Minitest::Compress#compress formatting w/ nested patterns. Now recurses properly.
31
+
1
32
  === 5.21.1 / 2024-01-11
2
33
 
3
34
  * 1 bug fix:
@@ -64,18 +64,31 @@ module Minitest
64
64
 
65
65
  ary = min.flat_map { |(n, lines)|
66
66
  if n > 1 then
67
+ [[n, compress(lines)]] # [o1 [2 s1] [2 s2]]
68
+ else
69
+ lines
70
+ end
71
+ }
72
+ end
73
+
74
+ format = ->(lines) {
75
+ lines.flat_map { |line|
76
+ case line
77
+ when Array then
78
+ n, lines = line
79
+ lines = format[lines]
67
80
  [
68
81
  " +->> #{n} cycles of #{lines.size} lines:",
69
82
  *lines.map { |s| " | #{s}" },
70
83
  " +-<<",
71
84
  ]
72
85
  else
73
- lines
86
+ line
74
87
  end
75
88
  }
76
- end
89
+ }
77
90
 
78
- ary
91
+ format[ary]
79
92
  end
80
93
  end
81
94
  end
data/lib/minitest.rb CHANGED
@@ -9,7 +9,7 @@ require_relative "minitest/compress"
9
9
  # :include: README.rdoc
10
10
 
11
11
  module Minitest
12
- VERSION = "5.21.1" # :nodoc:
12
+ VERSION = "5.22.2" # :nodoc:
13
13
 
14
14
  @@installed_at_exit ||= false
15
15
  @@after_run = []
@@ -134,7 +134,7 @@ module Minitest
134
134
  # Minitest.run(args)
135
135
  # Minitest.__run(reporter, options)
136
136
  # Runnable.runnables.each
137
- # runnable.run(reporter, options)
137
+ # runnable_klass.run(reporter, options)
138
138
  # self.runnable_methods.each
139
139
  # self.run_one_method(self, runnable_method, reporter)
140
140
  # Minitest.run_one_method(klass, runnable_method)
@@ -164,11 +164,32 @@ module Minitest
164
164
  warn "Interrupted. Exiting..."
165
165
  end
166
166
  self.parallel_executor.shutdown
167
+
168
+ # might have been removed/replaced during init_plugins:
169
+ summary = reporter.reporters.grep(SummaryReporter).first
170
+ return empty_run! options if summary && summary.count == 0
171
+
167
172
  reporter.report
168
173
 
169
174
  reporter.passed?
170
175
  end
171
176
 
177
+ def self.empty_run! options # :nodoc:
178
+ filter = options[:filter]
179
+ return true unless filter # no filter, but nothing ran == success
180
+
181
+ warn "Nothing ran for filter: %s" % [filter]
182
+
183
+ require "did_you_mean" # soft dependency, punt if it doesn't load
184
+
185
+ ms = Runnable.runnables.flat_map(&:runnable_methods)
186
+ cs = DidYouMean::SpellChecker.new(dictionary: ms).correct filter
187
+
188
+ warn DidYouMean::Formatter.message_for cs unless cs.empty?
189
+ rescue LoadError
190
+ # do nothing
191
+ end
192
+
172
193
  ##
173
194
  # Internal run method. Responsible for telling all Runnable
174
195
  # sub-classes to run.
@@ -338,25 +359,15 @@ module Minitest
338
359
  # reporter to record.
339
360
 
340
361
  def self.run reporter, options = {}
341
- filtered_methods = if options[:filter]
342
- filter = options[:filter]
343
- filter = Regexp.new $1 if filter.is_a?(String) && filter =~ %r%/(.*)/%
344
-
345
- self.runnable_methods.find_all { |m|
346
- filter === m || filter === "#{self}##{m}"
347
- }
348
- else
349
- self.runnable_methods
350
- end
362
+ pos = options[:filter]
363
+ neg = options[:exclude]
351
364
 
352
- if options[:exclude]
353
- exclude = options[:exclude]
354
- exclude = Regexp.new $1 if exclude =~ %r%/(.*)/%
365
+ pos = Regexp.new $1 if pos.is_a?(String) && pos =~ %r%/(.*)/%
366
+ neg = Regexp.new $1 if neg.is_a?(String) && neg =~ %r%/(.*)/%
355
367
 
356
- filtered_methods.delete_if { |m|
357
- exclude === m || exclude === "#{self}##{m}"
358
- }
359
- end
368
+ filtered_methods = self.runnable_methods
369
+ .select { |m| !pos || pos === m || pos === "#{self}##{m}" }
370
+ .reject { |m| neg && (neg === m || neg === "#{self}##{m}") }
360
371
 
361
372
  return if filtered_methods.empty?
362
373
 
@@ -961,8 +972,9 @@ module Minitest
961
972
  def location
962
973
  bt = Minitest.filter_backtrace self.backtrace
963
974
  idx = bt.rindex { |s| s.match? RE } || -1 # fall back to first item
975
+ loc = bt[idx+1] || bt.last || "unknown:-1"
964
976
 
965
- bt[idx+1].sub(/:in .*$/, "")
977
+ loc.sub(/:in .*$/, "")
966
978
  end
967
979
 
968
980
  def result_code # :nodoc:
@@ -1359,8 +1359,6 @@ class TestUnexpectedError < Minitest::Test
1359
1359
  end
1360
1360
 
1361
1361
  def test_absurd_patterns
1362
- skip "NOOOO!!! but I don't care enough right now."
1363
-
1364
1362
  assert_compress <<~EXP, %w[ a b c b c a b c b c a b c ]
1365
1363
  +->> 2 cycles of 5 lines:
1366
1364
  | a
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.21.1
4
+ version: 5.22.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -29,7 +29,7 @@ cert_chain:
29
29
  S7043fq9EbQdBr2AXdj92+CDwuTfHI6/Hj5FVBDULufrJaan4xUgL70Hvc6pTTeW
30
30
  deKfBjgVAq7EYHu1AczzlUly
31
31
  -----END CERTIFICATE-----
32
- date: 2024-01-12 00:00:00.000000000 Z
32
+ date: 2024-02-07 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: rdoc
@@ -57,14 +57,14 @@ dependencies:
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '4.1'
60
+ version: '4.2'
61
61
  type: :development
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '4.1'
67
+ version: '4.2'
68
68
  description: |-
69
69
  minitest provides a complete suite of testing facilities supporting
70
70
  TDD, BDD, mocking, and benchmarking.
metadata.gz.sig CHANGED
Binary file