mutant 0.7.5 → 0.7.6
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 +4 -4
- data/Changelog.md +4 -0
- data/README.md +1 -1
- data/circle.yml +1 -1
- data/config/reek.yml +1 -0
- data/lib/mutant/actor.rb +4 -4
- data/lib/mutant/integration.rb +17 -0
- data/lib/mutant/parallel/master.rb +10 -12
- data/lib/mutant/parallel/worker.rb +3 -3
- data/lib/mutant/version.rb +1 -1
- data/spec/unit/mutant/integration_spec.rb +18 -1
- data/spec/unit/mutant/parallel/master_spec.rb +2 -2
- data/spec/unit/mutant/parallel/worker_spec.rb +4 -4
- 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: 2d6ae44ce91c40d94361aed00cac550fcb5554ac
|
4
|
+
data.tar.gz: 848b79ae105ed3249cb2f8ade2d4c5bad65b240d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03488412903104aa688bd949081d33d0c5f87514727cde14c380cf856e389f91edfe8b493bddcf9d529a4f669d7fe44c2e22c43fe3b7d99795b2b27b6e776cbb
|
7
|
+
data.tar.gz: 272c8b14d6a38877d05686610d9b9a815697893e63dc103d26a0b2620c4e8b87e488fb3ec05c21988c09a95755df7c8dd0b5d0e0fa63493adb02eac68e18205d
|
data/Changelog.md
CHANGED
data/README.md
CHANGED
@@ -176,7 +176,7 @@ Credits
|
|
176
176
|
-------
|
177
177
|
|
178
178
|
* [Markus Schirp (mbj)](https://github.com/mbj)
|
179
|
-
* A
|
179
|
+
* A gist, now removed, from [dkubb](https://github.com/dkubb) showing ideas.
|
180
180
|
* Older abandoned [mutant](https://github.com/txus/mutant). For motivating me doing this one.
|
181
181
|
* [heckle](https://github.com/seattlerb/heckle). For getting me into mutation testing.
|
182
182
|
|
data/circle.yml
CHANGED
data/config/reek.yml
CHANGED
@@ -127,6 +127,7 @@ UtilityFunction:
|
|
127
127
|
- Mutant::Actor::Env#new_mailbox
|
128
128
|
- Mutant::AST::Sexp#s
|
129
129
|
- Mutant::CLI#reporter
|
130
|
+
- Mutant::Integration::Null#call
|
130
131
|
- Mutant::Integration::Rspec#parse_example
|
131
132
|
- Mutant::Meta::Example::Verification#format_mutation
|
132
133
|
- Mutant::Reporter::CLI::Format::Progressive#new_buffer
|
data/lib/mutant/actor.rb
CHANGED
@@ -40,9 +40,9 @@ module Mutant
|
|
40
40
|
|
41
41
|
end # Message
|
42
42
|
|
43
|
-
#
|
43
|
+
# Binding to othersactors sender for simple RPC
|
44
44
|
class Binding
|
45
|
-
include Concord.new(:
|
45
|
+
include Concord.new(:mailbox, :other)
|
46
46
|
|
47
47
|
# Send message and wait for reply
|
48
48
|
#
|
@@ -53,8 +53,8 @@ module Mutant
|
|
53
53
|
# @api private
|
54
54
|
#
|
55
55
|
def call(type)
|
56
|
-
other.call(Message.new(type,
|
57
|
-
message =
|
56
|
+
other.call(Message.new(type, mailbox.sender))
|
57
|
+
message = mailbox.receiver.call
|
58
58
|
fail ProtocolError, "Expected #{type} but got #{message.type}" unless type.equal?(message.type)
|
59
59
|
message.payload
|
60
60
|
end
|
data/lib/mutant/integration.rb
CHANGED
@@ -77,6 +77,23 @@ module Mutant
|
|
77
77
|
EMPTY_ARRAY
|
78
78
|
end
|
79
79
|
|
80
|
+
# Return report for test
|
81
|
+
#
|
82
|
+
# @param [Enumerable<Mutant::Test>] tests
|
83
|
+
#
|
84
|
+
# @return [Result::Test]
|
85
|
+
#
|
86
|
+
# @api private
|
87
|
+
#
|
88
|
+
def call(tests)
|
89
|
+
Result::Test.new(
|
90
|
+
tests: tests,
|
91
|
+
output: '',
|
92
|
+
runtime: 0.0,
|
93
|
+
passed: true
|
94
|
+
)
|
95
|
+
end
|
96
|
+
|
80
97
|
end # Null
|
81
98
|
|
82
99
|
end # Integration
|
@@ -2,21 +2,21 @@ module Mutant
|
|
2
2
|
module Parallel
|
3
3
|
# Master parallel worker
|
4
4
|
class Master
|
5
|
-
include Concord.new(:config, :
|
5
|
+
include Concord.new(:config, :mailbox)
|
6
6
|
|
7
7
|
private_class_method :new
|
8
8
|
|
9
|
-
# Run master
|
9
|
+
# Run master
|
10
10
|
#
|
11
|
-
# @param [
|
11
|
+
# @param [Config] config
|
12
12
|
#
|
13
13
|
# @return [Actor::Sender]
|
14
14
|
#
|
15
15
|
# @api private
|
16
16
|
#
|
17
17
|
def self.call(config)
|
18
|
-
config.env.spawn do |
|
19
|
-
new(config,
|
18
|
+
config.env.spawn do |mailbox|
|
19
|
+
new(config, mailbox).__send__(:run)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -39,8 +39,6 @@ module Mutant
|
|
39
39
|
|
40
40
|
# Run work loop
|
41
41
|
#
|
42
|
-
# @return [self]
|
43
|
-
#
|
44
42
|
# @api private
|
45
43
|
#
|
46
44
|
# rubocop:disable MethodLength
|
@@ -48,11 +46,11 @@ module Mutant
|
|
48
46
|
def run
|
49
47
|
config.jobs.times do
|
50
48
|
@workers += 1
|
51
|
-
config.env.spawn do |
|
49
|
+
config.env.spawn do |worker_mailbox|
|
52
50
|
Worker.run(
|
53
|
-
|
51
|
+
mailbox: worker_mailbox,
|
54
52
|
processor: config.processor,
|
55
|
-
parent:
|
53
|
+
parent: mailbox.sender
|
56
54
|
)
|
57
55
|
end
|
58
56
|
end
|
@@ -90,7 +88,7 @@ module Mutant
|
|
90
88
|
# @api private
|
91
89
|
#
|
92
90
|
def receive_loop
|
93
|
-
handle(
|
91
|
+
handle(mailbox.receiver.call) until @workers.zero? && @stop
|
94
92
|
end
|
95
93
|
|
96
94
|
# Handle status
|
@@ -204,7 +202,7 @@ module Mutant
|
|
204
202
|
config.source
|
205
203
|
end
|
206
204
|
|
207
|
-
# Return
|
205
|
+
# Return sink
|
208
206
|
#
|
209
207
|
# @return [Sink]
|
210
208
|
#
|
@@ -2,7 +2,7 @@ module Mutant
|
|
2
2
|
module Parallel
|
3
3
|
# Parallel execution worker
|
4
4
|
class Worker
|
5
|
-
include Adamantium::Flat, Anima.new(:
|
5
|
+
include Adamantium::Flat, Anima.new(:mailbox, :processor, :parent)
|
6
6
|
|
7
7
|
# Run worker
|
8
8
|
#
|
@@ -29,8 +29,8 @@ module Mutant
|
|
29
29
|
#
|
30
30
|
def run
|
31
31
|
begin
|
32
|
-
parent.call(Actor::Message.new(:ready,
|
33
|
-
end until handle(
|
32
|
+
parent.call(Actor::Message.new(:ready, mailbox.sender))
|
33
|
+
end until handle(mailbox.receiver.call)
|
34
34
|
end
|
35
35
|
|
36
36
|
private
|
data/lib/mutant/version.rb
CHANGED
@@ -16,11 +16,28 @@ RSpec.describe Mutant::Integration::Null do
|
|
16
16
|
|
17
17
|
let(:object) { described_class.new }
|
18
18
|
|
19
|
-
describe '#
|
19
|
+
describe '#all_tests' do
|
20
20
|
subject { object.all_tests }
|
21
21
|
|
22
22
|
it { should eql([]) }
|
23
23
|
|
24
24
|
it_should_behave_like 'an idempotent method'
|
25
25
|
end
|
26
|
+
|
27
|
+
describe '#call' do
|
28
|
+
let(:tests) { double('Tests') }
|
29
|
+
|
30
|
+
subject { object.call(tests) }
|
31
|
+
|
32
|
+
it 'returns test result' do
|
33
|
+
should eql(
|
34
|
+
Mutant::Result::Test.new(
|
35
|
+
tests: tests,
|
36
|
+
runtime: 0.0,
|
37
|
+
passed: true,
|
38
|
+
output: ''
|
39
|
+
)
|
40
|
+
)
|
41
|
+
end
|
42
|
+
end
|
26
43
|
end
|
@@ -83,7 +83,7 @@ RSpec.describe Mutant::Parallel::Master do
|
|
83
83
|
|
84
84
|
before do
|
85
85
|
expect(Mutant::Parallel::Worker).to receive(:run).with(
|
86
|
-
|
86
|
+
mailbox: actor_env.mailbox(:worker_a),
|
87
87
|
processor: processor,
|
88
88
|
parent: actor_env.mailbox(:master).sender
|
89
89
|
).and_return(worker_a)
|
@@ -97,7 +97,7 @@ RSpec.describe Mutant::Parallel::Master do
|
|
97
97
|
|
98
98
|
before do
|
99
99
|
expect(Mutant::Parallel::Worker).to receive(:run).with(
|
100
|
-
|
100
|
+
mailbox: actor_env.mailbox(:worker_b),
|
101
101
|
processor: processor,
|
102
102
|
parent: actor_env.mailbox(:master).sender
|
103
103
|
).and_return(worker_b)
|
@@ -5,7 +5,7 @@ RSpec.describe Mutant::Parallel::Worker do
|
|
5
5
|
|
6
6
|
let(:message_sequence) { FakeActor::MessageSequence.new }
|
7
7
|
let(:processor) { double('Processor') }
|
8
|
-
let(:
|
8
|
+
let(:mailbox) { actor_env.mailbox(:worker) }
|
9
9
|
let(:parent) { actor_env.mailbox(:parent).sender }
|
10
10
|
let(:payload) { double('Payload') }
|
11
11
|
let(:result_payload) { double('Result Payload') }
|
@@ -14,12 +14,12 @@ RSpec.describe Mutant::Parallel::Worker do
|
|
14
14
|
{
|
15
15
|
processor: processor,
|
16
16
|
parent: parent,
|
17
|
-
|
17
|
+
mailbox: mailbox
|
18
18
|
}
|
19
19
|
end
|
20
20
|
|
21
21
|
before do
|
22
|
-
message_sequence.add(:parent, :ready,
|
22
|
+
message_sequence.add(:parent, :ready, mailbox.sender)
|
23
23
|
end
|
24
24
|
|
25
25
|
describe '.run' do
|
@@ -36,7 +36,7 @@ RSpec.describe Mutant::Parallel::Worker do
|
|
36
36
|
|
37
37
|
message_sequence.add(:worker, :job, job)
|
38
38
|
message_sequence.add(:parent, :result, job_result)
|
39
|
-
message_sequence.add(:parent, :ready,
|
39
|
+
message_sequence.add(:parent, :ready, mailbox.sender)
|
40
40
|
message_sequence.add(:worker, :stop)
|
41
41
|
end
|
42
42
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mutant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|