minitest-ruby_golf_metrics 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,30 +6,32 @@ module Minitest
6
6
 
7
7
  class Reporter < ::Minitest::Reporter
8
8
 
9
- Erg = Struct.new(:method_name, :passed)
10
-
11
9
  def start
12
- @ergs = []
10
+ @ergs = {}
13
11
  end
14
12
 
15
13
  def record(erg)
16
- @ergs << Erg.new(erg.location.gsub("RubyGolfTest#test_", "").gsub(/ .*/, ""), erg.passed?)
14
+ method_name = erg.location.
15
+ gsub("RubyGolfTest#test_", "").
16
+ gsub(/_[0-9]+.*$/, "")
17
+ @ergs[method_name] ||= []
18
+ @ergs[method_name] << erg.passed?
17
19
  end
18
20
 
19
21
  def report
20
22
  io.puts "\nRuby Golf Metrics"
21
- @ergs.sort_by(&:method_name).each do |erg|
22
- if erg.passed
23
+ @ergs.each do |method_name, ergs|
24
+ if ergs.all?
23
25
  begin
24
- counter = CharacterCounter.new(erg.method_name)
25
- msg = " #{colorize(erg.method_name, 32)}: #{counter.cumulative_size} characters"
26
+ counter = CharacterCounter.new(method_name)
27
+ msg = " #{colorize(method_name, 32)}: #{counter.cumulative_size} characters"
26
28
  msg << " (#{counter.called_method_sizes.join(", ")})" if !counter.self_contained?
27
29
  io.puts msg
28
30
  rescue NoMethodError
29
- io.puts " #{colorize(erg.method_name, 31)}: UNDEFINED"
31
+ io.puts " #{colorize(method_name, 31)}: UNDEFINED"
30
32
  end
31
33
  else
32
- io.puts " #{colorize(erg.method_name, 31)}: FAILED"
34
+ io.puts " #{colorize(method_name, 31)}: FAILED"
33
35
  end
34
36
  end
35
37
  end
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module RubyGolfMetrics
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-ruby_golf_metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -110,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
110
  version: '0'
111
111
  segments:
112
112
  - 0
113
- hash: -1573464540783279000
113
+ hash: -3913661380911445686
114
114
  required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  none: false
116
116
  requirements:
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  segments:
121
121
  - 0
122
- hash: -1573464540783279000
122
+ hash: -3913661380911445686
123
123
  requirements: []
124
124
  rubyforge_project:
125
125
  rubygems_version: 1.8.23