pork 1.2.1 → 1.2.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
  SHA1:
3
- metadata.gz: 6903decbd7e24cdc4848e408399a9140b99ba00a
4
- data.tar.gz: 6c063a3b6d9f2d235a01d0ac8ddfc5747469f310
3
+ metadata.gz: c261975cc7cf0b2bcacb506cc04b3e1c088ea9b5
4
+ data.tar.gz: 0aeb04d6e629d99461713681d2b611863c97f582
5
5
  SHA512:
6
- metadata.gz: d43f1c00c61f6a5ba2b960488a5fddc704019274a2aa07be09deb1dddd86c1f5071cbc3f1a137d05e74982d34f03f7c918c10b893edcf42c9d339ab625603c3b
7
- data.tar.gz: 7efae535ea50be7e15e4506721a43d06219d91d0dcec549224413b68224429a6350f5bbbab36c2a4d1f7ec3a01d172ee0146b4660c8fa2d37159e8add997cfa1
6
+ metadata.gz: 72a8a67eb1423fd9faa19a4d7eec5ec336ee9ce2b9fd261ba2329c8bf28de762ffbf6b5013d547c07a27880654ac9819402816bd435881f9512280dfcedca966
7
+ data.tar.gz: 32b9c1379c816168dcde3f84148793516ed85f477cebb50ea95bdbe2807c8a38f94490bb980e3d69b73750dc665e52350332446bcd977c4819bfdf4d8ed21b09
data/CHANGES.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # CHANGES
2
2
 
3
+ ## Pork 1.2.2 -- 2015-03-19
4
+
5
+ ### Enhancement
6
+
7
+ * Show tests per second and assertions per second as in minitest.
8
+
3
9
  ## Pork 1.2.1 -- 2015-03-18
4
10
 
5
11
  ### Bugs fixed
@@ -3,25 +3,25 @@ require 'pork/stat'
3
3
 
4
4
  module Pork
5
5
  module Color
6
- def case_skip msg='s'; super(yellow {msg}); end
7
- def case_failed msg='F'; super(magenta{msg}); end
8
- def case_errored msg='E'; super(red {msg}); end
6
+ def case_skip msg='s'; super(yellow( msg)); end
7
+ def case_failed msg='F'; super(magenta(msg)); end
8
+ def case_errored msg='E'; super(red( msg)); end
9
9
 
10
10
  private
11
11
  def command name
12
- gray{super}
12
+ gray(super)
13
13
  end
14
14
 
15
15
  def message msg
16
- blue{super}
16
+ blue(super)
17
17
  end
18
18
 
19
19
  def show_exception err
20
- magenta{super}
20
+ magenta(super)
21
21
  end
22
22
 
23
23
  def time_spent
24
- cyan{super}
24
+ cyan(super)
25
25
  end
26
26
 
27
27
  def numbers
@@ -29,33 +29,39 @@ module Pork
29
29
  if num == 0
30
30
  num
31
31
  else
32
- send(col){ num }
32
+ send(col, num)
33
33
  end
34
34
  end
35
35
  end
36
36
 
37
+ def velocity
38
+ super.zip(%w[cyan blue blue]).map do |(str, col)|
39
+ send(col, str)
40
+ end
41
+ end
42
+
37
43
  def backtrace err
38
44
  super.map do |b|
39
45
  path, msgs = b.split(':', 2)
40
46
  dir , file = ::File.split(path)
41
- msg = msgs.sub(/(\d+):/){red{$1}+':'}.sub(/`.+?'/){green{$&}}
47
+ msg = msgs.sub(/(\d+):/){red($1)+':'}.sub(/`.+?'/){green($&)}
42
48
 
43
- "#{dir+'/'}#{yellow{file}}:#{msg}"
49
+ "#{dir+'/'}#{yellow(file)}:#{msg}"
44
50
  end
45
51
  end
46
52
 
47
- def gray █ color('1;30', &block); end
48
- def black █ color( 30 , &block); end
49
- def red █ color( 31 , &block); end
50
- def green █ color( 32 , &block); end
51
- def yellow █ color( 33 , &block); end
52
- def blue █ color( 34 , &block); end
53
- def magenta █ color( 35 , &block); end
54
- def cyan █ color( 36 , &block); end
55
- def white █ color( 37 , &block); end
53
+ def gray text; color('1;30', text); end
54
+ def black text; color( 30 , text); end
55
+ def red text; color( 31 , text); end
56
+ def green text; color( 32 , text); end
57
+ def yellow text; color( 33 , text); end
58
+ def blue text; color( 34 , text); end
59
+ def magenta text; color( 35 , text); end
60
+ def cyan text; color( 36 , text); end
61
+ def white text; color( 37 , text); end
56
62
 
57
- def color rgb
58
- "\e[#{rgb}m#{yield}\e[0m"
63
+ def color rgb, text
64
+ "\e[#{rgb}m#{text}\e[0m"
59
65
  end
60
66
  end
61
67
 
data/lib/pork/stat.rb CHANGED
@@ -7,6 +7,7 @@ module Pork
7
7
  :exceptions)
8
8
 
9
9
  Stat::Imp = Module.new do
10
+ attr_accessor :stop
10
11
  def initialize io=$stdout, st=Time.now, mu=Mutex.new,
11
12
  t=0, a=0, s=0, f=0, e=0, x=[]
12
13
  super
@@ -32,11 +33,18 @@ module Pork
32
33
  def case_errored msg='E'; io.print msg; end
33
34
  def passed?; exceptions.size == 0 ; end
34
35
  def numbers; [tests, assertions, failures, errors, skips]; end
35
- def time_spent; Time.now - start; end
36
+ def velocity
37
+ time_spent = stop - start
38
+ [time_spent.round(6),
39
+ (tests / time_spent).round(4),
40
+ (assertions / time_spent).round(4)]
41
+ end
36
42
  def report
43
+ self.stop = Time.now
37
44
  io.puts
38
45
  io.puts report_exceptions
39
- io.printf("\nFinished in %s seconds.\n", time_spent)
46
+ io.printf("\nFinished in %s seconds, %s tests/s, %s assertions/s \n",
47
+ *velocity)
40
48
  io.printf("%s tests, %s assertions, %s failures, %s errors, %s skips\n",
41
49
  *numbers)
42
50
  end
data/lib/pork/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Pork
3
- VERSION = '1.2.1'
3
+ VERSION = '1.2.2'
4
4
  end
data/pork.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: pork 1.2.1 ruby lib
2
+ # stub: pork 1.2.2 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "pork"
6
- s.version = "1.2.1"
6
+ s.version = "1.2.2"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib"]
10
10
  s.authors = ["Lin Jen-Shin (godfat)"]
11
- s.date = "2015-03-18"
11
+ s.date = "2015-03-19"
12
12
  s.description = "Pork -- Simple and clean and modular testing library.\n\nInspired by [Bacon][].\n\n[Bacon]: https://github.com/chneukirchen/bacon"
13
13
  s.email = ["godfat (XD) godfat.org"]
14
14
  s.files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pork
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lin Jen-Shin (godfat)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-18 00:00:00.000000000 Z
11
+ date: 2015-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: muack