minitest-gcstats 1.0.0 → 1.1.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
2
  SHA1:
3
- metadata.gz: 723826426c412687776e3e6a424e7024f251bd2c
4
- data.tar.gz: 088d9f5626befbd15366a576bdd8cdc49c7dcae7
3
+ metadata.gz: e934b4bc7ea0b03bf24a93a559b430fedded0684
4
+ data.tar.gz: 10a52ed10df4f64515867a4174b5d7901af26060
5
5
  SHA512:
6
- metadata.gz: 2d01fdb3e4326e24f8ec013a8ea341d732f9e78d371c46839485f7b3a3d81c780f2e0f390f0908af13b876b67ad787b12fb71bcaf298e9cc948802f54b6b5e3f
7
- data.tar.gz: aa57b268a2488f0a23bddcb80427a51f311895d30202328b19092a017b1d35315d0d14a5fdc29f860182e9df0c10101ea176f92bf5006029163812d1cbcc5b0c
6
+ metadata.gz: c8bbd313972599e4c742574f6e4a8ebcdfd026f506f81c5d2cf8e2e8fa0494991f7d3a99827f391e0d32b1225f2b28e0c7d99b7f9cf2484e5d959047a894a476
7
+ data.tar.gz: 46229689d74458d2e28b0a6c733dc9b7f090f890a592fde75fb1b54edb192ad1456e94df427c9bef2ca9da8a44836b74736ed3d32237ef8ce85222c825bc2cb7
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,9 @@
1
+ === 1.1.0 / 2014-09-26
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * Added total and percentages to report.
6
+
1
7
  === 1.0.0 / 2014-08-29
2
8
 
3
9
  * 1 major enhancement
data/Rakefile CHANGED
@@ -7,6 +7,8 @@ Hoe.plugin :isolate
7
7
  Hoe.plugin :seattlerb
8
8
  Hoe.plugin :rdoc
9
9
 
10
+ Hoe.add_include_dirs "../../minitest/dev/lib"
11
+
10
12
  Hoe.spec "minitest-gcstats" do
11
13
  developer "Ryan Davis", "ryand-ruby@zenspider.com"
12
14
  license "MIT"
@@ -1,7 +1,7 @@
1
1
  require "minitest"
2
2
 
3
3
  module Minitest::GCStats
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
 
6
6
  attr_accessor :gc_stats
7
7
 
@@ -41,16 +41,21 @@ class Minitest::GCStatsReporter < Minitest::AbstractReporter
41
41
  end
42
42
 
43
43
  def record result
44
- self.stats["#{result.class.name}##{result.name}"] = result.gc_stats
44
+ self.stats[result] = result.gc_stats
45
45
  end
46
46
 
47
47
  def report
48
+ total = stats.values.inject(&:+)
49
+ pct = total / 100.0
50
+
48
51
  puts
49
52
  puts "Top #{max} tests by objects allocated"
50
53
  puts
51
- stats.sort_by { |k,v| [-v, k] }.first(max).each do |k,v|
52
- puts "%6d: %s" % [v, k]
54
+ stats.sort_by { |k,v| [-v, k.class.name, k.name] }.first(max).each do |k,v|
55
+ puts "%6d (%5.2f%%): %s" % [v, v / pct, k]
53
56
  end
54
57
  puts
58
+
59
+ puts "%6d: %s" % [total, "Total"]
55
60
  end
56
61
  end
@@ -1,14 +1,349 @@
1
1
  require "minitest/autorun"
2
- require "minitest/gcstats"
3
2
 
4
3
  module TestMinitest; end
5
4
 
6
5
  class TestMinitest::TestGcstats < Minitest::Test
7
6
  def test_empty
8
- # do nothing
7
+ # 0 objects
9
8
  end
10
9
 
11
10
  def test_full
12
- Object.new
11
+ Object.new # 1 object
12
+ end
13
+
14
+ def test_assert
15
+ assert :woot
16
+ end
17
+
18
+ def test_assert_bad
19
+ assert nil
20
+ rescue Minitest::Assertion
21
+ # do nothing
22
+ end
23
+
24
+ def test_assert_empty
25
+ assert_empty []
26
+ end
27
+
28
+ def test_assert_empty_bad
29
+ assert_empty [42]
30
+ rescue Minitest::Assertion
31
+ # do nothing
32
+ end
33
+
34
+ def test_assert_equal
35
+ assert_equal :a, :a
36
+ end
37
+
38
+ def test_assert_equal_bad
39
+ assert_equal :a, :b
40
+ rescue Minitest::Assertion
41
+ # do nothing
42
+ end
43
+
44
+ def test_assert_in_delta
45
+ assert_in_delta 1.0, 1.0001
46
+ end
47
+
48
+ def test_assert_in_delta_bad
49
+ assert_in_delta 1.0, 1.1
50
+ rescue Minitest::Assertion
51
+ # do nothing
52
+ end
53
+
54
+ def test_assert_in_epsilon
55
+ assert_in_epsilon 1.0, 1.001
56
+ end
57
+
58
+ def test_assert_in_epsilon_bad
59
+ assert_in_epsilon 1.0, 1.1
60
+ rescue Minitest::Assertion
61
+ # do nothing
62
+ end
63
+
64
+ def test_assert_includes
65
+ assert_includes [:a, :woot, :c], :woot
66
+ end
67
+
68
+ def test_assert_includes_bad
69
+ assert_includes [:a, :woot, :c], :b
70
+ rescue Minitest::Assertion
71
+ # do nothing
72
+ end
73
+
74
+ def test_assert_instance_of
75
+ assert_instance_of Symbol, :woot
76
+ end
77
+
78
+ def test_assert_instance_of_bad
79
+ assert_instance_of Array, :woot
80
+ rescue Minitest::Assertion
81
+ # do nothing
82
+ end
83
+
84
+ def test_assert_kind_of
85
+ assert_kind_of Symbol, :woot
86
+ end
87
+
88
+ def test_assert_kind_of_bad
89
+ assert_kind_of Array, :woot
90
+ rescue Minitest::Assertion
91
+ # do nothing
92
+ end
93
+
94
+ def test_assert_match
95
+ assert_match(/woot/, "woot")
96
+ end
97
+
98
+ def test_assert_match_bad
99
+ assert_match(/woot/, "blah")
100
+ rescue Minitest::Assertion
101
+ # do nothing
102
+ end
103
+
104
+ def test_assert_nil
105
+ assert_nil nil
106
+ end
107
+
108
+ def test_assert_nil_bad
109
+ assert_nil true
110
+ rescue Minitest::Assertion
111
+ # do nothing
112
+ end
113
+
114
+ def test_assert_operator
115
+ assert_operator [:a], :include?, :a
116
+ end
117
+
118
+ def test_assert_operator_bad
119
+ assert_operator [:b], :include?, :a
120
+ rescue Minitest::Assertion
121
+ # do nothing
122
+ end
123
+
124
+ def test_assert_output
125
+ assert_output "woot\n" do
126
+ puts "woot"
127
+ end
128
+ end
129
+
130
+ def test_assert_output_bad
131
+ assert_output "woot" do
132
+ # do nothing
133
+ end
134
+ rescue Minitest::Assertion
135
+ # do nothing
136
+ end
137
+
138
+ def test_assert_predicate
139
+ assert_predicate "", :empty?
140
+ end
141
+
142
+ def test_assert_predicate_bad
143
+ assert_predicate "woot", :empty?
144
+ rescue Minitest::Assertion
145
+ # do nothing
146
+ end
147
+
148
+ def test_assert_raises
149
+ assert_raises RuntimeError do
150
+ raise "woot"
151
+ end
152
+ end
153
+
154
+ def test_assert_raises_bad
155
+ assert_raises RuntimeError do
156
+ # do nothing
157
+ end
158
+ rescue Minitest::Assertion
159
+ # do nothing
160
+ end
161
+
162
+ def test_assert_respond_to
163
+ assert_respond_to :a, :empty?
164
+ end
165
+
166
+ def test_assert_respond_to_bad
167
+ assert_respond_to :a, :full?
168
+ rescue Minitest::Assertion
169
+ # do nothing
170
+ end
171
+
172
+ def test_assert_same
173
+ assert_same :a, :a
174
+ end
175
+
176
+ def test_assert_same_bad
177
+ assert_same :a, :b
178
+ rescue Minitest::Assertion
179
+ # do nothing
180
+ end
181
+
182
+ def test_assert_silent
183
+ assert_silent do
184
+ # do nothing
185
+ end
186
+ end
187
+
188
+ def test_assert_silent_bad
189
+ assert_silent do
190
+ puts "woot"
191
+ end
192
+ rescue Minitest::Assertion
193
+ # do nothing
194
+ end
195
+
196
+ def test_assert_throws
197
+ assert_throws :woot do
198
+ throw :woot
199
+ end
200
+ end
201
+
202
+ def test_assert_throws_bad
203
+ assert_throws :woot do
204
+ # do nothing
205
+ end
206
+ rescue Minitest::Assertion
207
+ # do nothing
208
+ end
209
+
210
+ def test_refute
211
+ refute false
212
+ end
213
+
214
+ def test_refute_bad
215
+ refute true
216
+ rescue Minitest::Assertion
217
+ # do nothing
218
+ end
219
+
220
+ def test_refute_empty
221
+ refute_empty [:a]
222
+ end
223
+
224
+ def test_refute_empty_bad
225
+ refute_empty []
226
+ rescue Minitest::Assertion
227
+ # do nothing
228
+ end
229
+
230
+ def test_refute_equal
231
+ refute_equal :a, :b
232
+ end
233
+
234
+ def test_refute_equal_bad
235
+ refute_equal :a, :a
236
+ rescue Minitest::Assertion
237
+ # do nothing
238
+ end
239
+
240
+ def test_refute_in_delta
241
+ refute_in_delta 1.0, 1.1
242
+ end
243
+
244
+ def test_refute_in_delta_bad
245
+ refute_in_delta 1.0, 1.0001
246
+ rescue Minitest::Assertion
247
+ # do nothing
248
+ end
249
+
250
+ def test_refute_in_epsilon
251
+ refute_in_epsilon 1.0, 1.1
252
+ end
253
+
254
+ def test_refute_in_epsilon_bad
255
+ refute_in_epsilon 1.0, 1.001
256
+ rescue Minitest::Assertion
257
+ # do nothing
258
+ end
259
+
260
+ def test_refute_includes
261
+ refute_includes [:a, :woot, :c], :b
262
+ end
263
+
264
+ def test_refute_includes_bad
265
+ refute_includes [:a, :woot, :c], :woot
266
+ rescue Minitest::Assertion
267
+ # do nothing
268
+ end
269
+
270
+ def test_refute_instance_of
271
+ refute_instance_of Array, :a
272
+ end
273
+
274
+ def test_refute_instance_of_bad
275
+ refute_instance_of Symbol, :a
276
+ rescue Minitest::Assertion
277
+ # do nothing
278
+ end
279
+
280
+ def test_refute_kind_of
281
+ refute_kind_of Array, :woot
282
+ end
283
+
284
+ def test_refute_kind_of_bad
285
+ refute_kind_of Symbol, :woot
286
+ rescue Minitest::Assertion
287
+ # do nothing
288
+ end
289
+
290
+ def test_refute_match
291
+ refute_match(/woot/, "blah")
292
+ end
293
+
294
+ def test_refute_match_bad
295
+ refute_match(/woot/, "woot")
296
+ rescue Minitest::Assertion
297
+ # do nothing
298
+ end
299
+
300
+ def test_refute_nil
301
+ refute_nil true
302
+ end
303
+
304
+ def test_refute_nil_bad
305
+ refute_nil nil
306
+ rescue Minitest::Assertion
307
+ # do nothing
308
+ end
309
+
310
+ def test_refute_operator
311
+ refute_operator [:b], :include?, :a
312
+ end
313
+
314
+ def test_refute_operator_bad
315
+ assert_operator [:a], :include?, :a
316
+ rescue Minitest::Assertion
317
+ # do nothing
318
+ end
319
+
320
+ def test_refute_predicate
321
+ refute_predicate "woot", :empty?
322
+ end
323
+
324
+ def test_refute_predicate_bad
325
+ refute_predicate "", :empty?
326
+ rescue Minitest::Assertion
327
+ # do nothing
328
+ end
329
+
330
+ def test_refute_respond_to
331
+ refute_respond_to :a, :full?
332
+ end
333
+
334
+ def test_refute_respond_to_bad
335
+ refute_respond_to :a, :empty?
336
+ rescue Minitest::Assertion
337
+ # do nothing
338
+ end
339
+
340
+ def test_refute_same
341
+ refute_same :a, :b
342
+ end
343
+
344
+ def test_refute_same_bad
345
+ refute_same :a, :a
346
+ rescue Minitest::Assertion
347
+ # do nothing
13
348
  end
14
349
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-gcstats
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -10,9 +10,9 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDPjCCAiagAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDPjCCAiagAwIBAgIBAjANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
14
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTEzMDkxNjIzMDQxMloXDTE0MDkxNjIzMDQxMlowRTETMBEGA1UE
15
+ GRYDY29tMB4XDTE0MDkxNzIzMDcwN1oXDTE1MDkxNzIzMDcwN1owRTETMBEGA1UE
16
16
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
17
  JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
18
18
  b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -22,14 +22,14 @@ cert_chain:
22
22
  qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
23
23
  gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
24
24
  HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
25
- AQCFZ7JTzoy1gcG4d8A6dmOJy7ygtO5MFpRIz8HuKCF5566nOvpy7aHhDDzFmQuu
26
- FX3zDU6ghx5cQIueDhf2SGOncyBmmJRRYawm3wI0o1MeN6LZJ/3cRaOTjSFy6+S6
27
- zqDmHBp8fVA2TGJtO0BLNkbGVrBJjh0UPmSoGzWlRhEVnYC33TpDAbNA+u39UrQI
28
- ynwhNN7YbnmSR7+JU2cUjBFv2iPBO+TGuWC+9L2zn3NHjuc6tnmSYipA9y8Hv+As
29
- Y4evBVezr3SjXz08vPqRO5YRdO3zfeMT8gBjRqZjWJGMZ2lD4XNfrs7eky74CyZw
30
- xx3n58i0lQkBE1EpKE0lFu/y
25
+ AQAFoDJRokCQdxFfOrmsKX41KOFlU/zjrbDVM9hgB/Ur999M6OXGSi8FitXNtMwY
26
+ FVjsiAPeU7HaWVVcZkj6IhINelTkXsxgGz/qCzjHy3iUMuZWw36cS0fiWJ5rvH+e
27
+ hD7uXxJSFuyf1riDGI1aeWbQ74WMwvNstOxLUMiV5a1fzBhlxPqb537ubDjq/M/h
28
+ zPUFPVYeL5KjDHLCqI2FwIk2sEMOQgjpXHzl+3NlD2LUgUhHDMevmgVua0e2GT1B
29
+ xJcC6UN6NHMOVMyAXsr2HR0gRRx4ofN1LoP2KhXzSr8UMvQYlwPmE0N5GQv1b5AO
30
+ VpzF30vNaJK6ZT7xlIsIlwmH
31
31
  -----END CERTIFICATE-----
32
- date: 2014-08-30 00:00:00.000000000 Z
32
+ date: 2014-09-26 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: minitest
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  requirements: []
118
118
  rubyforge_project:
119
- rubygems_version: 2.2.1
119
+ rubygems_version: 2.4.1
120
120
  signing_key:
121
121
  specification_version: 4
122
122
  summary: A minitest plugin that adds a report of the top tests by number of objects
metadata.gz.sig CHANGED
Binary file