minitest-gcstats 1.2.2 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c97aa9887d8aea4ca6e6af76ef21f1829f9e9a2d
4
- data.tar.gz: 6c7e8098c9a9670a374669c83c2a1a703543509a
2
+ SHA256:
3
+ metadata.gz: 18da434e843b23c6fc0fa45a865681afeafad449b7cc53d80bdfcfbef4545900
4
+ data.tar.gz: 4cc273bbd7bbbfd43038fd046d24bb3e6f2f8192cc5bb0bdac015eb608c7bc73
5
5
  SHA512:
6
- metadata.gz: f69172660ddb1cab79778c54a32fb95312621e294ffa19917a12c6e0a7d4f240f1a948e1d112ae59a02e2b16ce7031369539d2670aca04454fd1189b938da815
7
- data.tar.gz: 287e6928b8a3c2b788176ec83a45419e4f5bcc72732aaf5c031a3d5937e60d3609a47f9c58d6ac24b85f73971236ddd527c8d82ecd59fe38477bb590b1c0da73
6
+ metadata.gz: 961cd9d0d7e9f4b3edd4c00c81db1b78e164de572e214c8a179a324ecea451debd912efc2890fbb2176938e2135296e1aac2ad9055b62b02ab2626c969bfbc9b
7
+ data.tar.gz: 27bc5c7c452a1fe2e95216224fc672552f8ca4e5d0d800ae0e44d5773648ce1c58a9dd53bcf9f6962a524f2f675f4c7dd76a67462fd418dfc9a11434b3860dd4
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,15 @@
1
+ === 1.3.0 / 2021-10-27
2
+
3
+ This is release 1024!?!
4
+
5
+ * 1 minor enhancement:
6
+
7
+ * Switched to prepending GCStats in and overriding run to record. Helps w/ 3.0.
8
+
9
+ * 1 bug fix:
10
+
11
+ * MOSTLY Fixed testing for ruby 3.0, which allocates inline cache in GC
12
+
1
13
  === 1.2.2 / 2016-06-13
2
14
 
3
15
  * 1 bug fix:
@@ -1,7 +1,7 @@
1
1
  require "minitest"
2
2
 
3
3
  module Minitest::GCStats
4
- VERSION = "1.2.2"
4
+ VERSION = "1.3.0"
5
5
 
6
6
  attr_accessor :gc_stats
7
7
 
@@ -24,6 +24,12 @@ module Minitest::GCStats
24
24
  end
25
25
  end
26
26
 
27
+ def run
28
+ r = super
29
+ r.gc_stats = self.gc_stats
30
+ r
31
+ end
32
+
27
33
  def before_setup
28
34
  super
29
35
  self.gc_stats = -Minitest::GCStats.current
@@ -35,6 +41,12 @@ module Minitest::GCStats
35
41
  end
36
42
  end
37
43
 
44
+ class Minitest::Result
45
+ attr_accessor :gc_stats
46
+ end
47
+
48
+ Minitest::Test.prepend Minitest::GCStats
49
+
38
50
  module Minitest::Assertions
39
51
  ##
40
52
  # Assert that the number of object allocations during block
@@ -13,7 +13,6 @@ module Minitest
13
13
  if @gcstats then
14
14
  require "minitest/gcstats"
15
15
  self.reporter << Minitest::GCStatsReporter.new(@gcstats)
16
- Minitest::Test.send :include, Minitest::GCStats
17
16
  end
18
17
  end
19
18
  end
@@ -7,355 +7,33 @@ module TestMinitest; end
7
7
  class TestMinitest::TestGcstats < Minitest::Test
8
8
  self.prove_it = false
9
9
 
10
- def test_empty
11
- # 0 objects
12
- end
13
-
14
- def test_full
15
- Object.new # 1 object
16
- end
17
-
18
- def test_assert
19
- assert :woot
20
- end
21
-
22
- def test_assert_bad
23
- assert nil
24
- rescue Minitest::Assertion
25
- # do nothing
26
- end
27
-
28
- def test_assert_empty
29
- assert_empty []
30
- end
31
-
32
- def test_assert_empty_bad
33
- assert_empty [42]
34
- rescue Minitest::Assertion
35
- # do nothing
36
- end
37
-
38
- def test_assert_equal
39
- assert_equal :a, :a
40
- end
41
-
42
- def test_assert_equal_bad
43
- assert_equal :a, :b
44
- rescue Minitest::Assertion
45
- # do nothing
46
- end
47
-
48
- def test_assert_in_delta
49
- assert_in_delta 1.0, 1.0001
50
- end
51
-
52
- def test_assert_in_delta_bad
53
- assert_in_delta 1.0, 1.1
54
- rescue Minitest::Assertion
55
- # do nothing
56
- end
57
-
58
- def test_assert_in_epsilon
59
- assert_in_epsilon 1.0, 1.001
60
- end
61
-
62
- def test_assert_in_epsilon_bad
63
- assert_in_epsilon 1.0, 1.1
64
- rescue Minitest::Assertion
65
- # do nothing
66
- end
67
-
68
- def test_assert_includes
69
- assert_includes [:a, :woot, :c], :woot
70
- end
71
-
72
- def test_assert_includes_bad
73
- assert_includes [:a, :woot, :c], :b
74
- rescue Minitest::Assertion
75
- # do nothing
76
- end
77
-
78
- def test_assert_instance_of
79
- assert_instance_of Symbol, :woot
80
- end
81
-
82
- def test_assert_instance_of_bad
83
- assert_instance_of Array, :woot
84
- rescue Minitest::Assertion
85
- # do nothing
86
- end
87
-
88
- def test_assert_kind_of
89
- assert_kind_of Symbol, :woot
90
- end
91
-
92
- def test_assert_kind_of_bad
93
- assert_kind_of Array, :woot
94
- rescue Minitest::Assertion
95
- # do nothing
96
- end
97
-
98
- def test_assert_match
99
- assert_match(/woot/, "woot")
100
- end
101
-
102
- def test_assert_match_bad
103
- assert_match(/woot/, "blah")
104
- rescue Minitest::Assertion
105
- # do nothing
106
- end
107
-
108
- def test_assert_nil
109
- assert_nil nil
10
+ def util_n_times_full n
11
+ n.times { test_full }
110
12
  end
111
13
 
112
- def test_assert_nil_bad
113
- assert_nil true
114
- rescue Minitest::Assertion
115
- # do nothing
14
+ def util_array
15
+ [test_full]
116
16
  end
117
17
 
118
- def test_assert_operator
119
- assert_operator [:a], :include?, :a
120
- end
121
-
122
- def test_assert_operator_bad
123
- assert_operator [:b], :include?, :a
124
- rescue Minitest::Assertion
125
- # do nothing
126
- end
18
+ def setup
19
+ util_n_times_full 1 # warm
127
20
 
128
- def test_assert_output
129
- assert_output "woot\n" do
130
- puts "woot"
21
+ assert_allocations :<, 99 do
22
+ # warm it up
131
23
  end
132
24
  end
133
25
 
134
- def test_assert_output_bad
135
- assert_output "woot" do
136
- # do nothing
137
- end
138
- rescue Minitest::Assertion
139
- # do nothing
140
- end
141
-
142
- def test_assert_predicate
143
- assert_predicate "", :empty?
144
- end
145
-
146
- def test_assert_predicate_bad
147
- assert_predicate "woot", :empty?
148
- rescue Minitest::Assertion
149
- # do nothing
150
- end
151
-
152
- def test_assert_raises
153
- assert_raises RuntimeError do
154
- raise "woot"
155
- end
156
- end
157
-
158
- def test_assert_raises_bad
159
- assert_raises RuntimeError do
160
- # do nothing
161
- end
162
- rescue Minitest::Assertion
163
- # do nothing
164
- end
165
-
166
- def test_assert_respond_to
167
- assert_respond_to :a, :empty?
168
- end
169
-
170
- def test_assert_respond_to_bad
171
- assert_respond_to :a, :full?
172
- rescue Minitest::Assertion
173
- # do nothing
174
- end
175
-
176
- def test_assert_same
177
- assert_same :a, :a
178
- end
179
-
180
- def test_assert_same_bad
181
- assert_same :a, :b
182
- rescue Minitest::Assertion
183
- # do nothing
184
- end
185
-
186
- def test_assert_silent
187
- assert_silent do
188
- # do nothing
189
- end
190
- end
191
-
192
- def test_assert_silent_bad
193
- assert_silent do
194
- puts "woot"
195
- end
196
- rescue Minitest::Assertion
197
- # do nothing
198
- end
199
-
200
- def test_assert_throws
201
- assert_throws :woot do
202
- throw :woot
203
- end
204
- end
205
-
206
- def test_assert_throws_bad
207
- assert_throws :woot do
208
- # do nothing
209
- end
210
- rescue Minitest::Assertion
211
- # do nothing
212
- end
213
-
214
- def test_refute
215
- refute false
216
- end
217
-
218
- def test_refute_bad
219
- refute true
220
- rescue Minitest::Assertion
221
- # do nothing
222
- end
223
-
224
- def test_refute_empty
225
- refute_empty [:a]
226
- end
227
-
228
- def test_refute_empty_bad
229
- refute_empty []
230
- rescue Minitest::Assertion
231
- # do nothing
232
- end
233
-
234
- def test_refute_equal
235
- refute_equal :a, :b
236
- end
237
-
238
- def test_refute_equal_bad
239
- refute_equal :a, :a
240
- rescue Minitest::Assertion
241
- # do nothing
242
- end
243
-
244
- def test_refute_in_delta
245
- refute_in_delta 1.0, 1.1
246
- end
247
-
248
- def test_refute_in_delta_bad
249
- refute_in_delta 1.0, 1.0001
250
- rescue Minitest::Assertion
251
- # do nothing
252
- end
253
-
254
- def test_refute_in_epsilon
255
- refute_in_epsilon 1.0, 1.1
256
- end
257
-
258
- def test_refute_in_epsilon_bad
259
- refute_in_epsilon 1.0, 1.001
260
- rescue Minitest::Assertion
261
- # do nothing
262
- end
263
-
264
- def test_refute_includes
265
- refute_includes [:a, :woot, :c], :b
266
- end
267
-
268
- def test_refute_includes_bad
269
- refute_includes [:a, :woot, :c], :woot
270
- rescue Minitest::Assertion
271
- # do nothing
272
- end
273
-
274
- def test_refute_instance_of
275
- refute_instance_of Array, :a
276
- end
277
-
278
- def test_refute_instance_of_bad
279
- refute_instance_of Symbol, :a
280
- rescue Minitest::Assertion
281
- # do nothing
282
- end
283
-
284
- def test_refute_kind_of
285
- refute_kind_of Array, :woot
286
- end
287
-
288
- def test_refute_kind_of_bad
289
- refute_kind_of Symbol, :woot
290
- rescue Minitest::Assertion
291
- # do nothing
292
- end
293
-
294
- def test_refute_match
295
- refute_match(/woot/, "blah")
296
- end
297
-
298
- def test_refute_match_bad
299
- refute_match(/woot/, "woot")
300
- rescue Minitest::Assertion
301
- # do nothing
302
- end
303
-
304
- def test_refute_nil
305
- refute_nil true
306
- end
307
-
308
- def test_refute_nil_bad
309
- refute_nil nil
310
- rescue Minitest::Assertion
311
- # do nothing
312
- end
313
-
314
- def test_refute_operator
315
- refute_operator [:b], :include?, :a
316
- end
317
-
318
- def test_refute_operator_bad
319
- assert_operator [:a], :include?, :a
320
- rescue Minitest::Assertion
321
- # do nothing
322
- end
323
-
324
- def test_refute_predicate
325
- refute_predicate "woot", :empty?
326
- end
327
-
328
- def test_refute_predicate_bad
329
- refute_predicate "", :empty?
330
- rescue Minitest::Assertion
331
- # do nothing
332
- end
333
-
334
- def test_refute_respond_to
335
- refute_respond_to :a, :full?
336
- end
337
-
338
- def test_refute_respond_to_bad
339
- refute_respond_to :a, :empty?
340
- rescue Minitest::Assertion
341
- # do nothing
342
- end
343
-
344
- def test_refute_same
345
- refute_same :a, :b
26
+ def test_empty
27
+ # 0 objects
346
28
  end
347
29
 
348
- def test_refute_same_bad
349
- refute_same :a, :a
350
- rescue Minitest::Assertion
351
- # do nothing
30
+ def test_full
31
+ Object.new # 1 object
352
32
  end
353
- end
354
33
 
355
- class TestAssertObject < Minitest::Test
356
34
  def test_assert_allocations
357
35
  assert_allocations 1 do
358
- []
36
+ test_full
359
37
  end
360
38
  end
361
39
 
@@ -367,25 +45,25 @@ class TestAssertObject < Minitest::Test
367
45
 
368
46
  def test_assert_allocations_multi
369
47
  assert_allocations 3 do
370
- 3.times { Object.new }
48
+ util_n_times_full 3
371
49
  end
372
50
  end
373
51
 
374
52
  def test_assert_allocations_multi_eq
375
53
  assert_allocations :==, 3 do
376
- 3.times { Object.new }
54
+ util_n_times_full 3
377
55
  end
378
56
  end
379
57
 
380
58
  def test_assert_allocations_neg_lt
381
59
  assert_allocations :<=, 3 do
382
- 2.times { Object.new }
60
+ util_n_times_full 2
383
61
  end
384
62
  end
385
63
 
386
64
  def test_assert_allocations_neg_eq
387
65
  assert_allocations :<=, 3 do
388
- 3.times { Object.new }
66
+ util_n_times_full 3
389
67
  end
390
68
  end
391
69
 
@@ -404,19 +82,23 @@ class TestAssertObject < Minitest::Test
404
82
  def test_assert_allocations_bad
405
83
  exp = "Object allocations.\nExpected 2 to be == 1."
406
84
 
85
+ util_array # warm
86
+
407
87
  assert_triggered exp do
408
88
  assert_allocations 1 do
409
- [Object.new]
89
+ util_array
410
90
  end
411
91
  end
412
92
  end
413
93
 
414
94
  def test_assert_allocations_neg_bad
415
- exp = "Object allocations.\nExpected 5 to be <= 3."
95
+ util_n_times_full 5
96
+
97
+ exp = "Object allocations.\nExpected #{5} to be <= 3."
416
98
 
417
99
  assert_triggered exp do
418
100
  assert_allocations :<=, 3 do
419
- 5.times { Object.new }
101
+ util_n_times_full 5
420
102
  end
421
103
  end
422
104
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-gcstats
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDPjCCAiagAwIBAgIBAzANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDPjCCAiagAwIBAgIBBTANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
14
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTE1MDkxOTIwNTEyMloXDTE2MDkxODIwNTEyMlowRTETMBEGA1UE
15
+ GRYDY29tMB4XDTIwMTIyMjIwMzgzMFoXDTIxMTIyMjIwMzgzMFowRTETMBEGA1UE
16
16
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
17
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
18
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -21,86 +21,92 @@ cert_chain:
21
21
  GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
22
22
  qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
23
23
  gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
24
- HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
25
- AQB+Hx8xUgrpZa4P8H8gR8zme5kISwQrG80MbpqJV6/G3/ZicRFhN5sjwu0uHGue
26
- bd9Cymf6oIRwHVarJux2M32T6bL07Hmi07w2QaPc3MnMKB/D46SRZ2JSSGPFRBTc
27
- SilobMRoGs/7B15uGFUEnNrCB/ltMqhwwSx1r++UQPfeySHEV9uqu03E5Vb7J37O
28
- 2Er6PLXHRiYsIycD1LkMi6YnixdITRHmrqJYE2rsjaIfpIehiusVAPHkNf7qbpHq
29
- qx3h45R1CAsObX0SQDIT+rRbQrtKz1GHIZTOFYvEJjUY1XmRTZupD3CJ8Q7sDqSy
30
- NLq5jm1fq6Y9Uolu3RJbmycf
24
+ HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
25
+ AQAE3XRm1YZcCVjAJy5yMZvTOFrS7B2SYErc+0QwmKYbHztTTDY2m5Bii+jhpuxh
26
+ H+ETcU1z8TUKLpsBUP4kUpIRowkVN1p/jKapV8T3Rbwq+VuYFe+GMKsf8wGZSecG
27
+ oMQ8DzzauZfbvhe2kDg7G9BBPU0wLQlY25rDcCy9bLnD7R0UK3ONqpwvsI5I7x5X
28
+ ZIMXR0a9/DG+55mawwdGzCQobDKiSNLK89KK7OcNTALKU0DfgdTkktdgKchzKHqZ
29
+ d/AHw/kcnU6iuMUoJEcGiJd4gVCTn1l3cDcIvxakGslCA88Jubw0Sqatan0TnC9g
30
+ KToW560QIey7SPfHWduzFJnV
31
31
  -----END CERTIFICATE-----
32
- date: 2016-06-13 00:00:00.000000000 Z
32
+ date: 2021-10-28 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: minitest
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '5.0'
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '5.0'
48
48
  - !ruby/object:Gem::Dependency
49
- name: rdoc
49
+ name: rake
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "<"
53
53
  - !ruby/object:Gem::Version
54
- version: '4.0'
54
+ version: '11'
55
55
  type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "<"
60
60
  - !ruby/object:Gem::Version
61
- version: '4.0'
61
+ version: '11'
62
62
  - !ruby/object:Gem::Dependency
63
- name: rake
63
+ name: minitest-proveit
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - <
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '11'
68
+ version: '1.0'
69
69
  type: :development
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - <
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '11'
75
+ version: '1.0'
76
76
  - !ruby/object:Gem::Dependency
77
- name: minitest-proveit
77
+ name: rdoc
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '1.0'
82
+ version: '4.0'
83
+ - - "<"
84
+ - !ruby/object:Gem::Version
85
+ version: '7'
83
86
  type: :development
84
87
  prerelease: false
85
88
  version_requirements: !ruby/object:Gem::Requirement
86
89
  requirements:
87
- - - ~>
90
+ - - ">="
88
91
  - !ruby/object:Gem::Version
89
- version: '1.0'
92
+ version: '4.0'
93
+ - - "<"
94
+ - !ruby/object:Gem::Version
95
+ version: '7'
90
96
  - !ruby/object:Gem::Dependency
91
97
  name: hoe
92
98
  requirement: !ruby/object:Gem::Requirement
93
99
  requirements:
94
- - - ~>
100
+ - - "~>"
95
101
  - !ruby/object:Gem::Version
96
- version: '3.15'
102
+ version: '3.22'
97
103
  type: :development
98
104
  prerelease: false
99
105
  version_requirements: !ruby/object:Gem::Requirement
100
106
  requirements:
101
- - - ~>
107
+ - - "~>"
102
108
  - !ruby/object:Gem::Version
103
- version: '3.15'
109
+ version: '3.22'
104
110
  description: |-
105
111
  A minitest plugin that adds a report of the top tests by number of
106
112
  objects allocated.
@@ -113,7 +119,7 @@ extra_rdoc_files:
113
119
  - Manifest.txt
114
120
  - README.rdoc
115
121
  files:
116
- - .autotest
122
+ - ".autotest"
117
123
  - History.rdoc
118
124
  - Manifest.txt
119
125
  - README.rdoc
@@ -124,27 +130,27 @@ files:
124
130
  homepage: https://github.com/seattlerb/minitest-gcstats
125
131
  licenses:
126
132
  - MIT
127
- metadata: {}
128
- post_install_message:
133
+ metadata:
134
+ homepage_uri: https://github.com/seattlerb/minitest-gcstats
135
+ post_install_message:
129
136
  rdoc_options:
130
- - --main
137
+ - "--main"
131
138
  - README.rdoc
132
139
  require_paths:
133
140
  - lib
134
141
  required_ruby_version: !ruby/object:Gem::Requirement
135
142
  requirements:
136
- - - '>='
143
+ - - ">="
137
144
  - !ruby/object:Gem::Version
138
145
  version: '0'
139
146
  required_rubygems_version: !ruby/object:Gem::Requirement
140
147
  requirements:
141
- - - '>='
148
+ - - ">="
142
149
  - !ruby/object:Gem::Version
143
150
  version: '0'
144
151
  requirements: []
145
- rubyforge_project:
146
- rubygems_version: 2.4.5
147
- signing_key:
152
+ rubygems_version: 3.2.16
153
+ signing_key:
148
154
  specification_version: 4
149
155
  summary: A minitest plugin that adds a report of the top tests by number of objects
150
156
  allocated.
metadata.gz.sig CHANGED
Binary file