pork 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +7 -0
- data/lib/pork/mode/parallel.rb +6 -3
- data/lib/pork/stat.rb +27 -12
- data/lib/pork/test.rb +1 -1
- 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: b3309a4342d94a048959287afbbc330bfbcffdd6
|
4
|
+
data.tar.gz: 90549fc74cc0d7ed04c47d09b7c011001acc5b01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c2c045065fec739b79b34e07f47eb0826123226d08e5b7b5845f9a490be0dfdeaa450468a0c268ed6bce38353e288d30993efcfba58f94b13a98d4d338e325d
|
7
|
+
data.tar.gz: 5c9d5b7aaa8125292a92183cf524d44dc6328f3f44c23f9991273163fdf178fadf62a626d213c587f0bb30b38977814fa9beb711f83d88f62247e98353b863dc
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# CHANGES
|
2
2
|
|
3
|
+
## Pork 1.0.4 -- 2014-12-29
|
4
|
+
|
5
|
+
* Make backtrace easier to read by using `.` and `~`.
|
6
|
+
* Fix parallels mode to detect missing assertions properly.
|
7
|
+
* Slightly changed `Pork::Stat`. A kinda incompatible change,
|
8
|
+
but using `Pork::Stat` should be considered private.
|
9
|
+
|
3
10
|
## Pork 1.0.3 -- 2014-12-26
|
4
11
|
|
5
12
|
* Fix `Kernel#should` compatibility for JRuby 1.7.18- and Ruby 2.2.0 by
|
data/lib/pork/mode/parallel.rb
CHANGED
@@ -6,9 +6,12 @@ module Pork
|
|
6
6
|
module Parallel
|
7
7
|
def parallel cores=8, stat=Stat.new
|
8
8
|
all_tests.keys.shuffle.each_slice(cores).map do |names|
|
9
|
-
Thread.new
|
10
|
-
|
11
|
-
|
9
|
+
Thread.new do
|
10
|
+
s = Stat.new
|
11
|
+
names.each{ |n| isolate(n, s) }
|
12
|
+
s
|
13
|
+
end
|
14
|
+
end.map(&:value).inject(stat, &:merge)
|
12
15
|
end
|
13
16
|
end
|
14
17
|
|
data/lib/pork/stat.rb
CHANGED
@@ -2,18 +2,17 @@
|
|
2
2
|
require 'thread'
|
3
3
|
|
4
4
|
module Pork
|
5
|
-
class Stat < Struct.new(:
|
6
|
-
:
|
7
|
-
def initialize io=$stdout
|
8
|
-
|
9
|
-
super
|
5
|
+
class Stat < Struct.new(:io, :start, :mutex,
|
6
|
+
:tests, :assertions, :skips, :failures, :errors)
|
7
|
+
def initialize io=$stdout, st=Time.now, mu=Mutex.new,
|
8
|
+
t=0, a=0, s=0, f=[], e=[]
|
9
|
+
super
|
10
10
|
end
|
11
|
-
|
12
|
-
def
|
13
|
-
def
|
14
|
-
def
|
15
|
-
def
|
16
|
-
def add_error *e ; @mutex.synchronize{ errors << e }; end
|
11
|
+
def incr_assertions; mutex.synchronize{ self.assertions += 1 }; end
|
12
|
+
def incr_tests ; mutex.synchronize{ self.tests += 1 }; end
|
13
|
+
def incr_skips ; mutex.synchronize{ self.skips += 1 }; end
|
14
|
+
def add_failure *e ; mutex.synchronize{ failures << e }; end
|
15
|
+
def add_error *e ; mutex.synchronize{ errors << e }; end
|
17
16
|
def passed?; failures.size + errors.size == 0 ; end
|
18
17
|
def numbers; [tests, assertions, failures.size, errors.size, skips]; end
|
19
18
|
def report
|
@@ -25,14 +24,30 @@ module Pork
|
|
25
24
|
io.printf("%d tests, %d assertions, %d failures, %d errors, %d skips\n",
|
26
25
|
*numbers)
|
27
26
|
end
|
27
|
+
def merge stat
|
28
|
+
self.class.new(io, start, nil,
|
29
|
+
*to_a.drop(3).zip(stat.to_a.drop(3)).map{ |(a, b)| a + b })
|
30
|
+
end
|
28
31
|
|
29
32
|
private
|
30
33
|
def backtrace e
|
31
34
|
if $VERBOSE
|
32
35
|
e.backtrace
|
33
36
|
else
|
34
|
-
e.backtrace.reject{ |line| line =~ %r{/pork(/\w+)?\.rb:\d+} }
|
37
|
+
strip(e.backtrace.reject{ |line| line =~ %r{/pork(/\w+)?\.rb:\d+} })
|
35
38
|
end.join("\n ")
|
36
39
|
end
|
40
|
+
|
41
|
+
def strip backtrace
|
42
|
+
strip_home(strip_cwd(backtrace))
|
43
|
+
end
|
44
|
+
|
45
|
+
def strip_home backtrace
|
46
|
+
backtrace.map{ |path| path.sub(ENV['HOME'], '~') }
|
47
|
+
end
|
48
|
+
|
49
|
+
def strip_cwd backtrace
|
50
|
+
backtrace.map{ |path| path.sub(Dir.pwd, '.') }
|
51
|
+
end
|
37
52
|
end
|
38
53
|
end
|
data/lib/pork/test.rb
CHANGED
data/lib/pork/version.rb
CHANGED
data/pork.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: pork 1.0.
|
2
|
+
# stub: pork 1.0.4 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "pork"
|
6
|
-
s.version = "1.0.
|
6
|
+
s.version = "1.0.4"
|
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 = "2014-12-
|
11
|
+
s.date = "2014-12-29"
|
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.0.
|
4
|
+
version: 1.0.4
|
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: 2014-12-
|
11
|
+
date: 2014-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: muack
|