mutant 0.8.8 → 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +9 -0
- data/README.md +1 -1
- data/Rakefile +12 -8
- data/bin/mutant +5 -1
- data/config/flay.yml +1 -1
- data/lib/mutant.rb +18 -17
- data/lib/mutant/actor.rb +1 -7
- data/lib/mutant/actor/env.rb +0 -4
- data/lib/mutant/actor/mailbox.rb +0 -4
- data/lib/mutant/actor/receiver.rb +0 -4
- data/lib/mutant/actor/sender.rb +0 -2
- data/lib/mutant/ast.rb +1 -5
- data/lib/mutant/ast/meta/const.rb +0 -2
- data/lib/mutant/ast/meta/optarg.rb +0 -2
- data/lib/mutant/ast/meta/send.rb +0 -12
- data/lib/mutant/ast/named_children.rb +0 -10
- data/lib/mutant/ast/sexp.rb +1 -5
- data/lib/mutant/cli.rb +19 -38
- data/lib/mutant/color.rb +1 -7
- data/lib/mutant/config.rb +11 -7
- data/lib/mutant/context.rb +0 -4
- data/lib/mutant/context/scope.rb +0 -18
- data/lib/mutant/delegator.rb +0 -6
- data/lib/mutant/diff.rb +0 -18
- data/lib/mutant/env.rb +8 -24
- data/lib/mutant/env/bootstrap.rb +18 -41
- data/lib/mutant/expression.rb +0 -8
- data/lib/mutant/expression/method.rb +6 -7
- data/lib/mutant/expression/methods.rb +5 -9
- data/lib/mutant/expression/namespace.rb +0 -13
- data/lib/mutant/expression/parser.rb +0 -6
- data/lib/mutant/integration.rb +2 -20
- data/lib/mutant/isolation.rb +0 -4
- data/lib/mutant/loader.rb +20 -35
- data/lib/mutant/matcher.rb +1 -1
- data/lib/mutant/matcher/chain.rb +1 -3
- data/lib/mutant/matcher/compiler.rb +0 -8
- data/lib/mutant/matcher/config.rb +2 -10
- data/lib/mutant/matcher/filter.rb +1 -3
- data/lib/mutant/matcher/method.rb +4 -26
- data/lib/mutant/matcher/method/instance.rb +1 -7
- data/lib/mutant/matcher/method/singleton.rb +0 -12
- data/lib/mutant/matcher/methods.rb +1 -19
- data/lib/mutant/matcher/namespace.rb +1 -7
- data/lib/mutant/matcher/null.rb +1 -3
- data/lib/mutant/matcher/scope.rb +1 -5
- data/lib/mutant/matcher/static.rb +0 -2
- data/lib/mutant/meta.rb +0 -2
- data/lib/mutant/meta/example.rb +0 -28
- data/lib/mutant/meta/example/dsl.rb +2 -16
- data/lib/mutant/mutation.rb +9 -18
- data/lib/mutant/mutator.rb +0 -24
- data/lib/mutant/mutator/node.rb +1 -33
- data/lib/mutant/mutator/node/and_asgn.rb +0 -2
- data/lib/mutant/mutator/node/argument.rb +0 -10
- data/lib/mutant/mutator/node/arguments.rb +0 -12
- data/lib/mutant/mutator/node/begin.rb +0 -4
- data/lib/mutant/mutator/node/binary.rb +2 -11
- data/lib/mutant/mutator/node/block.rb +0 -6
- data/lib/mutant/mutator/node/break.rb +0 -2
- data/lib/mutant/mutator/node/case.rb +0 -6
- data/lib/mutant/mutator/node/conditional_loop.rb +0 -2
- data/lib/mutant/mutator/node/const.rb +1 -3
- data/lib/mutant/mutator/node/define.rb +4 -11
- data/lib/mutant/mutator/node/defined.rb +0 -2
- data/lib/mutant/mutator/node/dstr.rb +0 -2
- data/lib/mutant/mutator/node/dsym.rb +0 -2
- data/lib/mutant/mutator/node/generic.rb +1 -3
- data/lib/mutant/mutator/node/if.rb +0 -8
- data/lib/mutant/mutator/node/kwbegin.rb +0 -2
- data/lib/mutant/mutator/node/literal/array.rb +0 -4
- data/lib/mutant/mutator/node/literal/boolean.rb +0 -2
- data/lib/mutant/mutator/node/literal/fixnum.rb +0 -6
- data/lib/mutant/mutator/node/literal/float.rb +0 -6
- data/lib/mutant/mutator/node/literal/hash.rb +0 -6
- data/lib/mutant/mutator/node/literal/nil.rb +0 -2
- data/lib/mutant/mutator/node/literal/range.rb +0 -8
- data/lib/mutant/mutator/node/literal/regex.rb +0 -4
- data/lib/mutant/mutator/node/literal/string.rb +0 -2
- data/lib/mutant/mutator/node/literal/symbol.rb +0 -2
- data/lib/mutant/mutator/node/masgn.rb +0 -2
- data/lib/mutant/mutator/node/match_current_line.rb +0 -2
- data/lib/mutant/mutator/node/mlhs.rb +0 -2
- data/lib/mutant/mutator/node/named_value/access.rb +0 -8
- data/lib/mutant/mutator/node/named_value/constant_assignment.rb +1 -7
- data/lib/mutant/mutator/node/named_value/variable_assignment.rb +0 -4
- data/lib/mutant/mutator/node/next.rb +0 -2
- data/lib/mutant/mutator/node/noop.rb +0 -2
- data/lib/mutant/mutator/node/nthref.rb +0 -2
- data/lib/mutant/mutator/node/op_asgn.rb +0 -2
- data/lib/mutant/mutator/node/or_asgn.rb +0 -2
- data/lib/mutant/mutator/node/resbody.rb +0 -4
- data/lib/mutant/mutator/node/rescue.rb +0 -10
- data/lib/mutant/mutator/node/return.rb +0 -2
- data/lib/mutant/mutator/node/send.rb +4 -32
- data/lib/mutant/mutator/node/send/attribute_assignment.rb +0 -6
- data/lib/mutant/mutator/node/send/binary.rb +0 -6
- data/lib/mutant/mutator/node/send/index.rb +0 -6
- data/lib/mutant/mutator/node/splat.rb +0 -2
- data/lib/mutant/mutator/node/super.rb +0 -2
- data/lib/mutant/mutator/node/when.rb +0 -10
- data/lib/mutant/mutator/node/yield.rb +0 -2
- data/lib/mutant/mutator/node/zsuper.rb +0 -2
- data/lib/mutant/mutator/registry.rb +0 -6
- data/lib/mutant/mutator/util.rb +0 -4
- data/lib/mutant/mutator/util/array.rb +0 -6
- data/lib/mutant/mutator/util/symbol.rb +0 -2
- data/lib/mutant/parallel.rb +21 -17
- data/lib/mutant/parallel/master.rb +0 -28
- data/lib/mutant/parallel/source.rb +0 -10
- data/lib/mutant/parallel/worker.rb +15 -10
- data/lib/mutant/parser.rb +23 -0
- data/lib/mutant/reporter.rb +5 -8
- data/lib/mutant/reporter/cli.rb +1 -15
- data/lib/mutant/reporter/cli/format.rb +3 -25
- data/lib/mutant/reporter/cli/printer.rb +0 -18
- data/lib/mutant/reporter/cli/printer/config.rb +0 -2
- data/lib/mutant/reporter/cli/printer/env_progress.rb +0 -2
- data/lib/mutant/reporter/cli/printer/env_result.rb +0 -2
- data/lib/mutant/reporter/cli/printer/mutation_progress_result.rb +0 -4
- data/lib/mutant/reporter/cli/printer/mutation_result.rb +0 -16
- data/lib/mutant/reporter/cli/printer/status.rb +0 -6
- data/lib/mutant/reporter/cli/printer/status_progressive.rb +0 -4
- data/lib/mutant/reporter/cli/printer/subject_progress.rb +0 -8
- data/lib/mutant/reporter/cli/printer/subject_result.rb +0 -2
- data/lib/mutant/reporter/cli/printer/test_result.rb +0 -2
- data/lib/mutant/reporter/cli/tput.rb +0 -4
- data/lib/mutant/repository.rb +4 -22
- data/lib/mutant/require_highjack.rb +0 -2
- data/lib/mutant/result.rb +23 -43
- data/lib/mutant/runner.rb +7 -20
- data/lib/mutant/runner/sink.rb +43 -86
- data/lib/mutant/selector.rb +0 -2
- data/lib/mutant/selector/expression.rb +0 -2
- data/lib/mutant/subject.rb +0 -22
- data/lib/mutant/subject/method.rb +2 -10
- data/lib/mutant/subject/method/instance.rb +0 -6
- data/lib/mutant/subject/method/singleton.rb +0 -2
- data/lib/mutant/test.rb +4 -3
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/warning_filter.rb +0 -10
- data/lib/mutant/zombifier.rb +5 -20
- data/meta/or_asgn.rb +6 -0
- data/meta/send.rb +29 -0
- data/mutant-rspec.gemspec +1 -1
- data/spec/integration/mutant/rspec_spec.rb +1 -1
- data/spec/integrations.yml +2 -3
- data/spec/shared/method_matcher_behavior.rb +7 -7
- data/spec/spec_helper.rb +2 -9
- data/spec/support/corpus.rb +37 -30
- data/spec/support/rb_bug.rb +1 -2
- data/spec/support/ruby_vm.rb +6 -3
- data/spec/support/shared_context.rb +19 -20
- data/spec/unit/mutant/actor/binding_spec.rb +6 -6
- data/spec/unit/mutant/actor/env_spec.rb +2 -2
- data/spec/unit/mutant/actor/mailbox_spec.rb +6 -6
- data/spec/unit/mutant/actor/message_spec.rb +2 -2
- data/spec/unit/mutant/actor/receiver_spec.rb +4 -4
- data/spec/unit/mutant/actor/sender_spec.rb +6 -6
- data/spec/unit/mutant/ast_spec.rb +9 -0
- data/spec/unit/mutant/cli_spec.rb +16 -10
- data/spec/unit/mutant/context/scope/root_spec.rb +1 -1
- data/spec/unit/mutant/context/scope/unqualified_name_spec.rb +1 -1
- data/spec/unit/mutant/context/scope_spec.rb +3 -3
- data/spec/unit/mutant/context_spec.rb +0 -22
- data/spec/unit/mutant/env/boostrap_spec.rb +34 -41
- data/spec/unit/mutant/env_spec.rb +74 -32
- data/spec/unit/mutant/integration/rspec_spec.rb +23 -17
- data/spec/unit/mutant/integration_spec.rb +4 -4
- data/spec/unit/mutant/isolation_spec.rb +4 -4
- data/spec/unit/mutant/loader_spec.rb +42 -0
- data/spec/unit/mutant/matcher/compiler_spec.rb +3 -3
- data/spec/unit/mutant/matcher/config_spec.rb +1 -1
- data/spec/unit/mutant/matcher/method/instance_spec.rb +8 -1
- data/spec/unit/mutant/matcher/method/singleton_spec.rb +8 -1
- data/spec/unit/mutant/matcher/namespace_spec.rb +7 -8
- data/spec/unit/mutant/matcher/null_spec.rb +3 -2
- data/spec/unit/mutant/mutation_spec.rb +11 -5
- data/spec/unit/mutant/mutator/registry_spec.rb +1 -1
- data/spec/unit/mutant/parallel/master_spec.rb +9 -9
- data/spec/unit/mutant/parallel/source/array_spec.rb +3 -3
- data/spec/unit/mutant/parallel/worker_spec.rb +5 -5
- data/spec/unit/mutant/parallel_spec.rb +4 -4
- data/spec/unit/mutant/parser_spec.rb +24 -0
- data/spec/unit/mutant/reporter/cli/printer_spec.rb +3 -3
- data/spec/unit/mutant/reporter/cli/tput_spec.rb +2 -2
- data/spec/unit/mutant/reporter/cli_spec.rb +7 -7
- data/spec/unit/mutant/reporter/null_spec.rb +5 -4
- data/spec/unit/mutant/repository/diff_spec.rb +30 -18
- data/spec/unit/mutant/repository/subject_filter_spec.rb +5 -5
- data/spec/unit/mutant/require_highjack_spec.rb +1 -1
- data/spec/unit/mutant/result/env_spec.rb +9 -9
- data/spec/unit/mutant/result/subject_spec.rb +5 -5
- data/spec/unit/mutant/runner/driver_spec.rb +4 -4
- data/spec/unit/mutant/runner/{sink/mutation_spec.rb → sink_spec.rb} +16 -4
- data/spec/unit/mutant/runner_spec.rb +31 -31
- data/spec/unit/mutant/selector/expression_spec.rb +8 -8
- data/spec/unit/mutant/subject/method/instance_spec.rb +9 -3
- data/spec/unit/mutant/subject/method/singleton_spec.rb +1 -1
- data/spec/unit/mutant/subject_spec.rb +1 -5
- data/spec/unit/mutant_spec.rb +3 -3
- metadata +9 -15
- data/config/mutant.yml +0 -14
- data/lib/mutant/cache.rb +0 -29
- data/lib/mutant/reporter/trace.rb +0 -36
- data/spec/support/rspec.rb +0 -21
- data/spec/unit/mutant/cache_spec.rb +0 -22
- data/spec/unit/mutant/loader/eval_spec.rb +0 -44
- data/spec/unit/mutant/reporter/trace_spec.rb +0 -21
- data/test_app/Gemfile.rspec3.2 +0 -7
@@ -6,8 +6,8 @@ RSpec.describe Mutant::Reporter::CLI::Tput do
|
|
6
6
|
allow(Open3).to receive(:capture3).with(command).ordered.and_return(
|
7
7
|
[
|
8
8
|
stdout,
|
9
|
-
|
10
|
-
|
9
|
+
instance_double(IO),
|
10
|
+
instance_double(Process::Status, success?: success)
|
11
11
|
]
|
12
12
|
)
|
13
13
|
end
|
@@ -5,8 +5,8 @@ RSpec.describe Mutant::Reporter::CLI do
|
|
5
5
|
let(:output) { StringIO.new }
|
6
6
|
|
7
7
|
let(:tput) do
|
8
|
-
|
9
|
-
|
8
|
+
instance_double(
|
9
|
+
Mutant::Reporter::CLI::Tput,
|
10
10
|
restore: '[tput-restore]',
|
11
11
|
prepare: '[tput-prepare]'
|
12
12
|
)
|
@@ -61,9 +61,9 @@ RSpec.describe Mutant::Reporter::CLI do
|
|
61
61
|
expect(ENV).to receive(:key?).with('CI').and_return(ci?)
|
62
62
|
end
|
63
63
|
|
64
|
-
let(:output) {
|
65
|
-
let(:tty?) { true
|
66
|
-
let(:ci?) { false
|
64
|
+
let(:output) { instance_double(IO, tty?: tty?) }
|
65
|
+
let(:tty?) { true }
|
66
|
+
let(:ci?) { false }
|
67
67
|
|
68
68
|
context 'when not on CI and on a tty' do
|
69
69
|
before do
|
@@ -92,8 +92,8 @@ RSpec.describe Mutant::Reporter::CLI do
|
|
92
92
|
end
|
93
93
|
|
94
94
|
context 'when output does not respond to #tty?' do
|
95
|
-
let(:output) {
|
96
|
-
let(:tty?) { false
|
95
|
+
let(:output) { instance_double(IO) }
|
96
|
+
let(:tty?) { false }
|
97
97
|
|
98
98
|
it { should eql(described_class.new(output, progressive_format)) }
|
99
99
|
end
|
@@ -1,20 +1,21 @@
|
|
1
1
|
RSpec.describe Mutant::Reporter::Null do
|
2
|
-
let(:object) { described_class.new
|
2
|
+
let(:object) { described_class.new }
|
3
|
+
let(:value) { instance_double(Object) }
|
3
4
|
|
4
5
|
describe '#report' do
|
5
|
-
subject { object.report(
|
6
|
+
subject { object.report(value) }
|
6
7
|
|
7
8
|
it_should_behave_like 'a command method'
|
8
9
|
end
|
9
10
|
|
10
11
|
describe '#warn' do
|
11
|
-
subject { object.warn(
|
12
|
+
subject { object.warn(value) }
|
12
13
|
|
13
14
|
it_should_behave_like 'a command method'
|
14
15
|
end
|
15
16
|
|
16
17
|
describe '#progress' do
|
17
|
-
subject { object.progress(
|
18
|
+
subject { object.progress(value) }
|
18
19
|
|
19
20
|
it_should_behave_like 'a command method'
|
20
21
|
end
|
@@ -1,22 +1,34 @@
|
|
1
1
|
describe Mutant::Repository::Diff do
|
2
|
-
describe '
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
describe '#touches?' do
|
3
|
+
let(:object) do
|
4
|
+
described_class.new(
|
5
|
+
config: config,
|
6
|
+
from: 'from_rev',
|
7
|
+
to: 'to_rev'
|
8
|
+
)
|
9
|
+
end
|
6
10
|
|
7
|
-
|
8
|
-
|
11
|
+
let(:config) do
|
12
|
+
instance_double(
|
13
|
+
Mutant::Config,
|
14
|
+
kernel: kernel,
|
15
|
+
open3: open3,
|
16
|
+
pathname: pathname
|
17
|
+
)
|
18
|
+
end
|
9
19
|
|
10
|
-
|
11
|
-
let(:
|
12
|
-
let(:
|
13
|
-
let(:
|
20
|
+
let(:pathname) { instance_double(Pathname.singleton_class, pwd: pwd) }
|
21
|
+
let(:open3) { instance_double(Open3.singleton_class) }
|
22
|
+
let(:kernel) { instance_double(Kernel.singleton_class) }
|
23
|
+
let(:pwd) { Pathname.new('/foo') }
|
24
|
+
let(:path) { Pathname.new('/foo/bar.rb') }
|
25
|
+
let(:line_range) { 1..2 }
|
14
26
|
|
15
27
|
subject { object.touches?(path, line_range) }
|
16
28
|
|
17
29
|
shared_context 'test if git tracks the file' do
|
18
30
|
before do
|
19
|
-
expect(
|
31
|
+
expect(config.kernel).to receive(:system)
|
20
32
|
.ordered
|
21
33
|
.with(
|
22
34
|
*%W[git ls-files --error-unmatch -- #{path}],
|
@@ -27,10 +39,10 @@ describe Mutant::Repository::Diff do
|
|
27
39
|
end
|
28
40
|
|
29
41
|
context 'when file is in a different subdirectory' do
|
30
|
-
let(:path) { Pathname.new('/
|
42
|
+
let(:path) { Pathname.new('/baz/bar.rb') }
|
31
43
|
|
32
44
|
before do
|
33
|
-
expect(
|
45
|
+
expect(config.kernel).to_not receive(:system)
|
34
46
|
end
|
35
47
|
|
36
48
|
it { should be(false) }
|
@@ -45,15 +57,15 @@ describe Mutant::Repository::Diff do
|
|
45
57
|
end
|
46
58
|
|
47
59
|
context 'when file is tracked in repository' do
|
48
|
-
let(:git_ls_success?) { true
|
49
|
-
let(:status) {
|
50
|
-
let(:stdout) {
|
51
|
-
let(:stdout_empty?) { false
|
60
|
+
let(:git_ls_success?) { true }
|
61
|
+
let(:status) { instance_double(Process::Status, success?: success?) }
|
62
|
+
let(:stdout) { instance_double(String, empty?: stdout_empty?) }
|
63
|
+
let(:stdout_empty?) { false }
|
52
64
|
|
53
65
|
include_context 'test if git tracks the file'
|
54
66
|
|
55
67
|
before do
|
56
|
-
expect(
|
68
|
+
expect(config.open3).to receive(:capture2)
|
57
69
|
.ordered
|
58
70
|
.with(*expected_git_log_command, binmode: true)
|
59
71
|
.and_return([stdout, status])
|
@@ -2,9 +2,9 @@ RSpec.describe Mutant::Repository::SubjectFilter do
|
|
2
2
|
context '#call' do
|
3
3
|
subject { object.call(mutant_subject) }
|
4
4
|
|
5
|
-
let(:object)
|
6
|
-
let(:diff)
|
7
|
-
let(:
|
5
|
+
let(:object) { described_class.new(diff) }
|
6
|
+
let(:diff) { instance_double(Mutant::Repository::Diff) }
|
7
|
+
let(:value) { instance_double(Object, 'value') }
|
8
8
|
|
9
9
|
let(:mutant_subject) do
|
10
10
|
double(
|
@@ -18,11 +18,11 @@ RSpec.describe Mutant::Repository::SubjectFilter do
|
|
18
18
|
expect(diff).to receive(:touches?).with(
|
19
19
|
mutant_subject.source_path,
|
20
20
|
mutant_subject.source_lines
|
21
|
-
).and_return(
|
21
|
+
).and_return(value)
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'connects return value to repository diff API' do
|
25
|
-
expect(subject).to be(
|
25
|
+
expect(subject).to be(value)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -1,31 +1,31 @@
|
|
1
1
|
RSpec.describe Mutant::Result::Env do
|
2
2
|
let(:object) do
|
3
3
|
described_class.new(
|
4
|
-
runtime:
|
4
|
+
runtime: instance_double(Float),
|
5
5
|
env: env,
|
6
6
|
subject_results: [subject_result]
|
7
7
|
)
|
8
8
|
end
|
9
9
|
|
10
10
|
let(:env) do
|
11
|
-
|
12
|
-
|
11
|
+
instance_double(
|
12
|
+
Mutant::Env,
|
13
13
|
config: config,
|
14
|
-
subjects: [
|
15
|
-
mutations: [
|
14
|
+
subjects: [instance_double(Mutant::Subject)],
|
15
|
+
mutations: [instance_double(Mutant::Mutation)]
|
16
16
|
)
|
17
17
|
end
|
18
18
|
|
19
19
|
let(:config) do
|
20
|
-
|
21
|
-
|
20
|
+
instance_double(
|
21
|
+
Mutant::Config,
|
22
22
|
expected_coverage: Rational(1, 1)
|
23
23
|
)
|
24
24
|
end
|
25
25
|
|
26
26
|
let(:subject_result) do
|
27
|
-
|
28
|
-
|
27
|
+
instance_double(
|
28
|
+
Mutant::Result::Subject,
|
29
29
|
amount_mutation_results: results,
|
30
30
|
amount_mutations_killed: killed,
|
31
31
|
success?: true
|
@@ -7,7 +7,7 @@ RSpec.describe Mutant::Result::Subject do
|
|
7
7
|
)
|
8
8
|
end
|
9
9
|
|
10
|
-
let(:mutation_subject) {
|
10
|
+
let(:mutation_subject) { instance_double(Mutant::Subject) }
|
11
11
|
|
12
12
|
describe '#continue?' do
|
13
13
|
subject { object.continue? }
|
@@ -19,13 +19,13 @@ RSpec.describe Mutant::Result::Subject do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
context 'with failing mutation result' do
|
22
|
-
let(:mutation_results) { [
|
22
|
+
let(:mutation_results) { [instance_double(Mutant::Result::Mutation, success?: false)] }
|
23
23
|
|
24
24
|
it { should be(false) }
|
25
25
|
end
|
26
26
|
|
27
27
|
context 'with successful mutation result' do
|
28
|
-
let(:mutation_results) { [
|
28
|
+
let(:mutation_results) { [instance_double(Mutant::Result::Mutation, success?: true)] }
|
29
29
|
|
30
30
|
it { should be(true) }
|
31
31
|
end
|
@@ -33,8 +33,8 @@ RSpec.describe Mutant::Result::Subject do
|
|
33
33
|
context 'with failed and successful mutation result' do
|
34
34
|
let(:mutation_results) do
|
35
35
|
[
|
36
|
-
|
37
|
-
|
36
|
+
instance_double(Mutant::Result::Mutation, success?: true),
|
37
|
+
instance_double(Mutant::Result::Mutation, success?: false)
|
38
38
|
]
|
39
39
|
end
|
40
40
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
RSpec.describe Mutant::Parallel::Driver do
|
2
2
|
let(:object) { described_class.new(binding) }
|
3
3
|
|
4
|
-
let(:binding) {
|
5
|
-
let(:
|
4
|
+
let(:binding) { instance_double(Mutant::Actor::Binding) }
|
5
|
+
let(:value) { instance_double(Object, 'value') }
|
6
6
|
|
7
7
|
describe '#stop' do
|
8
8
|
subject { object.stop }
|
@@ -18,9 +18,9 @@ RSpec.describe Mutant::Parallel::Driver do
|
|
18
18
|
subject { object.status }
|
19
19
|
|
20
20
|
before do
|
21
|
-
expect(binding).to receive(:call).with(:status).and_return(
|
21
|
+
expect(binding).to receive(:call).with(:status).and_return(value)
|
22
22
|
end
|
23
23
|
|
24
|
-
it { should be(
|
24
|
+
it { should be(value) }
|
25
25
|
end
|
26
26
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
describe Mutant::Runner::Sink
|
1
|
+
describe Mutant::Runner::Sink do
|
2
2
|
setup_shared_context
|
3
3
|
|
4
4
|
shared_context 'one result' do
|
@@ -43,7 +43,11 @@ describe Mutant::Runner::Sink::Mutation do
|
|
43
43
|
|
44
44
|
context 'no results' do
|
45
45
|
let(:expected_status) do
|
46
|
-
Mutant::Result::Env.new(
|
46
|
+
Mutant::Result::Env.new(
|
47
|
+
env: env,
|
48
|
+
runtime: 0.0,
|
49
|
+
subject_results: []
|
50
|
+
)
|
47
51
|
end
|
48
52
|
|
49
53
|
it { should eql(expected_status) }
|
@@ -55,7 +59,11 @@ describe Mutant::Runner::Sink::Mutation do
|
|
55
59
|
with(:subject_a_result) { { mutation_results: [mutation_a_result] } }
|
56
60
|
|
57
61
|
let(:expected_status) do
|
58
|
-
Mutant::Result::Env.new(
|
62
|
+
Mutant::Result::Env.new(
|
63
|
+
env: env,
|
64
|
+
runtime: 0.0,
|
65
|
+
subject_results: [subject_a_result]
|
66
|
+
)
|
59
67
|
end
|
60
68
|
|
61
69
|
it { should eql(expected_status) }
|
@@ -65,7 +73,11 @@ describe Mutant::Runner::Sink::Mutation do
|
|
65
73
|
include_context 'two results'
|
66
74
|
|
67
75
|
let(:expected_status) do
|
68
|
-
Mutant::Result::Env.new(
|
76
|
+
Mutant::Result::Env.new(
|
77
|
+
env: env,
|
78
|
+
runtime: 0.0,
|
79
|
+
subject_results: [subject_a_result]
|
80
|
+
)
|
69
81
|
end
|
70
82
|
|
71
83
|
it { should eql(expected_status) }
|
@@ -1,45 +1,45 @@
|
|
1
1
|
RSpec.describe Mutant::Runner do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
describe '.call' do
|
3
|
+
let(:integration) { instance_double(Mutant::Integration) }
|
4
|
+
let(:reporter) { instance_double(Mutant::Reporter, delay: delay) }
|
5
|
+
let(:driver) { instance_double(Mutant::Parallel::Driver) }
|
6
|
+
let(:delay) { instance_double(Float) }
|
7
|
+
let(:env_result) { instance_double(Mutant::Result::Env) }
|
8
|
+
let(:actor_env) { instance_double(Mutant::Actor::Env) }
|
9
|
+
let(:kernel) { instance_double(Kernel.singleton_class) }
|
10
|
+
let(:sleep) { instance_double(Method) }
|
6
11
|
|
7
|
-
|
8
|
-
|
12
|
+
let(:env) do
|
13
|
+
instance_double(
|
14
|
+
Mutant::Env,
|
15
|
+
actor_env: actor_env,
|
16
|
+
config: config,
|
17
|
+
mutations: []
|
18
|
+
)
|
9
19
|
end
|
10
|
-
end
|
11
|
-
|
12
|
-
describe '.call' do
|
13
|
-
let(:integration) { double('Integration') }
|
14
|
-
let(:reporter) { double('Reporter', delay: delay) }
|
15
|
-
let(:driver) { double('Driver') }
|
16
|
-
let(:delay) { double('Delay') }
|
17
|
-
let(:env) { FakeEnv }
|
18
|
-
let(:env_result) { double('Env Result') }
|
19
|
-
let(:actor_env) { double('Actor ENV') }
|
20
20
|
|
21
21
|
let(:config) do
|
22
|
-
|
23
|
-
|
22
|
+
instance_double(
|
23
|
+
Mutant::Config,
|
24
24
|
integration: integration,
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
jobs: 1,
|
26
|
+
kernel: kernel,
|
27
|
+
reporter: reporter
|
28
28
|
)
|
29
29
|
end
|
30
30
|
|
31
31
|
before do
|
32
|
-
allow(
|
33
|
-
allow(
|
32
|
+
allow(env).to receive(:method).with(:kill).and_return(parallel_config.processor)
|
33
|
+
allow(kernel).to receive(:method).with(:sleep).and_return(sleep)
|
34
34
|
end
|
35
35
|
|
36
36
|
let(:parallel_config) do
|
37
37
|
Mutant::Parallel::Config.new(
|
38
|
-
jobs: 1,
|
39
38
|
env: actor_env,
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
jobs: 1,
|
40
|
+
processor: ->(_object) { fail },
|
41
|
+
sink: Mutant::Runner::Sink.new(env),
|
42
|
+
source: Mutant::Parallel::Source::Array.new(env.mutations)
|
43
43
|
)
|
44
44
|
end
|
45
45
|
|
@@ -51,7 +51,7 @@ RSpec.describe Mutant::Runner do
|
|
51
51
|
subject { described_class.call(env) }
|
52
52
|
|
53
53
|
context 'when runner finishes immediately' do
|
54
|
-
let(:status) {
|
54
|
+
let(:status) { instance_double(Mutant::Parallel::Status, done: true, payload: env_result) }
|
55
55
|
|
56
56
|
before do
|
57
57
|
expect(driver).to receive(:status).and_return(status)
|
@@ -62,13 +62,13 @@ RSpec.describe Mutant::Runner do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
context 'when report iterations are done' do
|
65
|
-
let(:status_a) {
|
66
|
-
let(:status_b) {
|
65
|
+
let(:status_a) { instance_double(Mutant::Parallel::Status, done: false) }
|
66
|
+
let(:status_b) { instance_double(Mutant::Parallel::Status, done: true, payload: env_result) }
|
67
67
|
|
68
68
|
before do
|
69
69
|
expect(driver).to receive(:status).and_return(status_a).ordered
|
70
70
|
expect(reporter).to receive(:progress).with(status_a).ordered
|
71
|
-
expect(
|
71
|
+
expect(sleep).to receive(:call).with(reporter.delay).ordered
|
72
72
|
|
73
73
|
expect(driver).to receive(:status).and_return(status_b).ordered
|
74
74
|
expect(reporter).to receive(:progress).with(status_b).ordered
|
@@ -16,14 +16,14 @@ RSpec.describe Mutant::Selector::Expression do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
let(:mutation_subject) { subject_class.new(context, node)
|
20
|
-
let(:context) {
|
21
|
-
let(:node) {
|
22
|
-
let(:config) { Mutant::Config::DEFAULT.with(integration: integration)
|
23
|
-
let(:integration) {
|
24
|
-
let(:test_a) {
|
25
|
-
let(:test_b) {
|
26
|
-
let(:test_c) {
|
19
|
+
let(:mutation_subject) { subject_class.new(context, node) }
|
20
|
+
let(:context) { instance_double(Mutant::Context) }
|
21
|
+
let(:node) { instance_double(Parser::AST::Node) }
|
22
|
+
let(:config) { Mutant::Config::DEFAULT.with(integration: integration) }
|
23
|
+
let(:integration) { instance_double(Mutant::Integration, all_tests: all_tests) }
|
24
|
+
let(:test_a) { instance_double(Mutant::Test, expression: parse_expression('SubjectA')) }
|
25
|
+
let(:test_b) { instance_double(Mutant::Test, expression: parse_expression('SubjectB')) }
|
26
|
+
let(:test_c) { instance_double(Mutant::Test, expression: parse_expression('SubjectC')) }
|
27
27
|
|
28
28
|
subject { object.call(mutation_subject) }
|
29
29
|
|