pork 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +6 -0
- data/lib/pork/more/color.rb +27 -21
- data/lib/pork/stat.rb +10 -2
- data/lib/pork/version.rb +1 -1
- data/pork.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c261975cc7cf0b2bcacb506cc04b3e1c088ea9b5
|
4
|
+
data.tar.gz: 0aeb04d6e629d99461713681d2b611863c97f582
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72a8a67eb1423fd9faa19a4d7eec5ec336ee9ce2b9fd261ba2329c8bf28de762ffbf6b5013d547c07a27880654ac9819402816bd435881f9512280dfcedca966
|
7
|
+
data.tar.gz: 32b9c1379c816168dcde3f84148793516ed85f477cebb50ea95bdbe2807c8a38f94490bb980e3d69b73750dc665e52350332446bcd977c4819bfdf4d8ed21b09
|
data/CHANGES.md
CHANGED
data/lib/pork/more/color.rb
CHANGED
@@ -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
|
7
|
-
def case_failed msg='F'; super(magenta
|
8
|
-
def case_errored msg='E'; super(red
|
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
|
12
|
+
gray(super)
|
13
13
|
end
|
14
14
|
|
15
15
|
def message msg
|
16
|
-
blue
|
16
|
+
blue(super)
|
17
17
|
end
|
18
18
|
|
19
19
|
def show_exception err
|
20
|
-
magenta
|
20
|
+
magenta(super)
|
21
21
|
end
|
22
22
|
|
23
23
|
def time_spent
|
24
|
-
cyan
|
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
|
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
|
47
|
+
msg = msgs.sub(/(\d+):/){red($1)+':'}.sub(/`.+?'/){green($&)}
|
42
48
|
|
43
|
-
"#{dir+'/'}#{yellow
|
49
|
+
"#{dir+'/'}#{yellow(file)}:#{msg}"
|
44
50
|
end
|
45
51
|
end
|
46
52
|
|
47
|
-
def gray
|
48
|
-
def black
|
49
|
-
def red
|
50
|
-
def green
|
51
|
-
def yellow
|
52
|
-
def blue
|
53
|
-
def magenta
|
54
|
-
def cyan
|
55
|
-
def white
|
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#{
|
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
|
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
|
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
data/pork.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: pork 1.2.
|
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.
|
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-
|
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.
|
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-
|
11
|
+
date: 2015-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: muack
|