mutant 0.5.24 → 0.5.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +8 -0
- data/config/flay.yml +1 -1
- data/config/flog.yml +1 -1
- data/config/reek.yml +15 -13
- data/lib/mutant.rb +28 -12
- data/lib/mutant/ast/meta.rb +0 -10
- data/lib/mutant/ast/named_children.rb +1 -0
- data/lib/mutant/ast/types.rb +5 -5
- data/lib/mutant/cli.rb +84 -64
- data/lib/mutant/config.rb +7 -39
- data/lib/mutant/delegator.rb +2 -0
- data/lib/mutant/env.rb +119 -16
- data/lib/mutant/expression.rb +8 -2
- data/lib/mutant/expression/method.rb +6 -16
- data/lib/mutant/expression/methods.rb +5 -5
- data/lib/mutant/expression/namespace.rb +7 -7
- data/lib/mutant/integration.rb +0 -10
- data/lib/mutant/isolation.rb +41 -15
- data/lib/mutant/matcher/chain.rb +1 -17
- data/lib/mutant/matcher/compiler.rb +108 -0
- data/lib/mutant/matcher/config.rb +28 -0
- data/lib/mutant/matcher/method.rb +1 -1
- data/lib/mutant/matcher/namespace.rb +5 -52
- data/lib/mutant/matcher/null.rb +1 -1
- data/lib/mutant/matcher/scope.rb +1 -1
- data/lib/mutant/mutation.rb +29 -13
- data/lib/mutant/mutator/node.rb +2 -12
- data/lib/mutant/mutator/node/named_value/variable_assignment.rb +1 -1
- data/lib/mutant/reporter/cli.rb +0 -2
- data/lib/mutant/reporter/cli/printer.rb +14 -0
- data/lib/mutant/reporter/cli/progress.rb +1 -3
- data/lib/mutant/reporter/cli/progress/config.rb +5 -9
- data/lib/mutant/reporter/cli/progress/env.rb +30 -0
- data/lib/mutant/reporter/cli/progress/noop.rb +4 -1
- data/lib/mutant/reporter/cli/progress/result.rb +12 -0
- data/lib/mutant/reporter/cli/progress/result/mutation.rb +45 -0
- data/lib/mutant/reporter/cli/progress/result/subject.rb +54 -0
- data/lib/mutant/reporter/cli/progress/subject.rb +7 -90
- data/lib/mutant/reporter/cli/registry.rb +2 -0
- data/lib/mutant/reporter/cli/report/env.rb +92 -0
- data/lib/mutant/reporter/cli/report/mutation.rb +58 -77
- data/lib/mutant/reporter/cli/report/subject.rb +4 -3
- data/lib/mutant/reporter/cli/report/test.rb +28 -0
- data/lib/mutant/reporter/null.rb +1 -1
- data/lib/mutant/reporter/trace.rb +16 -3
- data/lib/mutant/result.rb +302 -0
- data/lib/mutant/runner.rb +77 -123
- data/lib/mutant/subject.rb +32 -16
- data/lib/mutant/subject/method.rb +0 -15
- data/lib/mutant/subject/method/instance.rb +3 -3
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/warning_expectation.rb +12 -5
- data/spec/integration/mutant/corpus_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -1
- data/spec/unit/mutant/cli_spec.rb +248 -0
- data/spec/unit/mutant/expression/namespace/flat_spec.rb +1 -1
- data/spec/unit/mutant/expression_spec.rb +55 -0
- data/spec/unit/mutant/integration_spec.rb +0 -5
- data/spec/unit/mutant/isolation_spec.rb +36 -5
- data/spec/unit/mutant/matcher/chain_spec.rb +1 -13
- data/spec/unit/mutant/matcher/compiler_spec.rb +95 -0
- data/spec/unit/mutant/matcher/filter_spec.rb +31 -0
- data/spec/unit/mutant/matcher/method/instance_spec.rb +33 -2
- data/spec/unit/mutant/matcher/method/singleton_spec.rb +1 -1
- data/spec/unit/mutant/matcher/methods/instance_spec.rb +1 -1
- data/spec/unit/mutant/matcher/methods/singleton_spec.rb +1 -1
- data/spec/unit/mutant/matcher/namespace_spec.rb +10 -6
- data/spec/unit/mutant/matcher/null_spec.rb +26 -0
- data/spec/unit/mutant/reporter/cli_spec.rb +337 -0
- data/spec/unit/mutant/reporter/null_spec.rb +12 -0
- data/spec/unit/mutant/runner_spec.rb +130 -0
- data/spec/unit/mutant/subject/context_spec.rb +4 -3
- data/spec/unit/mutant/subject/method/instance_spec.rb +5 -3
- data/spec/unit/mutant/subject/method/singleton_spec.rb +3 -2
- data/spec/unit/mutant/subject_spec.rb +36 -1
- data/spec/unit/mutant/test_spec.rb +25 -0
- data/spec/unit/mutant/warning_expectation.rb +11 -8
- data/spec/unit/mutant_spec.rb +11 -2
- metadata +27 -28
- data/lib/mutant/killer.rb +0 -44
- data/lib/mutant/matcher/builder.rb +0 -142
- data/lib/mutant/mutation/evil.rb +0 -23
- data/lib/mutant/mutation/neutral.rb +0 -18
- data/lib/mutant/reporter/cli/progress/mutation.rb +0 -46
- data/lib/mutant/reporter/cli/report/config.rb +0 -116
- data/lib/mutant/rspec.rb +0 -0
- data/lib/mutant/runner/config.rb +0 -138
- data/lib/mutant/runner/killer.rb +0 -75
- data/lib/mutant/runner/mutation.rb +0 -78
- data/lib/mutant/runner/subject.rb +0 -85
- data/lib/mutant/test/report.rb +0 -59
- data/spec/unit/mutant/cli_new_spec.rb +0 -147
- data/spec/unit/mutant/cli_run_spec.rb +0 -46
- data/spec/unit/mutant/runner/config_spec.rb +0 -157
- data/spec/unit/mutant/runner/mutation_spec.rb +0 -101
- data/spec/unit/mutant/runner/subject_spec.rb +0 -59
- data/spec/unit/mutant/subject/mutations_spec.rb +0 -23
- data/spec/unit/mutant/subject/node_spec.rb +0 -17
@@ -1,101 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Mutant::Runner::Mutation do
|
4
|
-
let(:object) { described_class.new(config, mutation, tests) }
|
5
|
-
|
6
|
-
let(:reporter) { double('Reporter') }
|
7
|
-
let(:mutation) { double('Mutation', class: Mutant::Mutation) }
|
8
|
-
let(:integration) { double('Integration') }
|
9
|
-
let(:killer_a) { Mutant::Killer.new(test: test_a, mutation: mutation) }
|
10
|
-
let(:killer_b) { Mutant::Killer.new(test: test_b, mutation: mutation) }
|
11
|
-
let(:runner_a) { double('Runner A', success?: success_a, stop?: stop_a, mutation_dead?: dead_a) }
|
12
|
-
let(:runner_b) { double('Runner B', success?: success_b, stop?: stop_b, mutation_dead?: dead_b) }
|
13
|
-
let(:runners) { [runner_a, runner_b] }
|
14
|
-
let(:killers) { [killer_a, killer_b] }
|
15
|
-
let(:fail_fast) { false }
|
16
|
-
let(:success_a) { true }
|
17
|
-
let(:success_b) { true }
|
18
|
-
let(:stop_a) { false }
|
19
|
-
let(:stop_b) { false }
|
20
|
-
let(:dead_a) { false }
|
21
|
-
let(:dead_b) { false }
|
22
|
-
let(:test_a) { double('test a') }
|
23
|
-
let(:test_b) { double('test b') }
|
24
|
-
let(:tests) { [test_a, test_b] }
|
25
|
-
|
26
|
-
before do
|
27
|
-
expect(Mutant::Runner).to receive(:run).with(config, killer_a).and_return(runner_a)
|
28
|
-
expect(Mutant::Runner).to receive(:run).with(config, killer_b).and_return(runner_b)
|
29
|
-
end
|
30
|
-
|
31
|
-
let(:config) do
|
32
|
-
double(
|
33
|
-
'Config',
|
34
|
-
fail_fast: fail_fast,
|
35
|
-
reporter: reporter,
|
36
|
-
integration: integration
|
37
|
-
)
|
38
|
-
end
|
39
|
-
|
40
|
-
before do
|
41
|
-
reporter.stub(progress: reporter)
|
42
|
-
integration.stub(killers: killers)
|
43
|
-
end
|
44
|
-
|
45
|
-
describe '#stop?' do
|
46
|
-
subject { object.stop? }
|
47
|
-
|
48
|
-
context 'when fail fast is false' do
|
49
|
-
it { should be(false) }
|
50
|
-
end
|
51
|
-
|
52
|
-
context 'when fail fast is true' do
|
53
|
-
let(:fail_fast) { true }
|
54
|
-
|
55
|
-
context 'when all killers are successful' do
|
56
|
-
it { should be(false) }
|
57
|
-
end
|
58
|
-
|
59
|
-
context 'when one killer is NOT successful' do
|
60
|
-
let(:success_b) { false }
|
61
|
-
it { should be(false) }
|
62
|
-
end
|
63
|
-
|
64
|
-
context 'when all killer are NOT successful' do
|
65
|
-
let(:success_b) { false }
|
66
|
-
let(:success_a) { false }
|
67
|
-
|
68
|
-
it { should be(true) }
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
describe '#success?' do
|
74
|
-
subject { object.success? }
|
75
|
-
|
76
|
-
context 'when all killers are successful' do
|
77
|
-
it { should be(true) }
|
78
|
-
end
|
79
|
-
|
80
|
-
context 'when one killer is not successful' do
|
81
|
-
let(:success_b) { false }
|
82
|
-
|
83
|
-
it { should be(true) }
|
84
|
-
end
|
85
|
-
|
86
|
-
context 'when all killer are not successful' do
|
87
|
-
let(:success_a) { false }
|
88
|
-
let(:success_b) { false }
|
89
|
-
|
90
|
-
it { should be(false) }
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
describe '#killers' do
|
95
|
-
subject { object.killers }
|
96
|
-
|
97
|
-
it { should eql(runners) }
|
98
|
-
|
99
|
-
it_should_behave_like 'an idempotent method'
|
100
|
-
end
|
101
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Mutant::Runner::Subject, '#success?' do
|
4
|
-
subject { object.success? }
|
5
|
-
|
6
|
-
let(:object) { described_class.new(config, mutation_subject) }
|
7
|
-
|
8
|
-
let(:mutation_subject) do
|
9
|
-
double(
|
10
|
-
'Subject',
|
11
|
-
class: Mutant::Subject,
|
12
|
-
mutations: [mutation_a, mutation_b]
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
let(:reporter) { Mutant::Reporter::Trace.new }
|
17
|
-
let(:config) { double('Config', reporter: reporter, integration: integration) }
|
18
|
-
let(:mutation_a) { double('Mutation A') }
|
19
|
-
let(:mutation_b) { double('Mutation B') }
|
20
|
-
let(:integration) { double('Integration') }
|
21
|
-
|
22
|
-
let(:runner_a) do
|
23
|
-
double('Runner A', success?: success_a, stop?: stop_a)
|
24
|
-
end
|
25
|
-
|
26
|
-
let(:runner_b) do
|
27
|
-
double('Runner B', success?: success_b, stop?: stop_b)
|
28
|
-
end
|
29
|
-
|
30
|
-
let(:tests) { [double('test a'), double('test b')] }
|
31
|
-
|
32
|
-
before do
|
33
|
-
expect(config).to receive(:tests).with(mutation_subject).and_return(tests)
|
34
|
-
expect(Mutant::Runner).to receive(:run).with(config, mutation_a, tests).and_return(runner_a)
|
35
|
-
expect(Mutant::Runner).to receive(:run).with(config, mutation_b, tests).and_return(runner_b)
|
36
|
-
end
|
37
|
-
|
38
|
-
context 'with failing mutations' do
|
39
|
-
let(:stop_a) { false }
|
40
|
-
let(:stop_b) { false }
|
41
|
-
let(:success_a) { false }
|
42
|
-
let(:success_b) { true }
|
43
|
-
|
44
|
-
it { should be(false) }
|
45
|
-
|
46
|
-
it_should_behave_like 'an idempotent method'
|
47
|
-
end
|
48
|
-
|
49
|
-
context 'without failing mutations' do
|
50
|
-
let(:stop_a) { false }
|
51
|
-
let(:stop_b) { false }
|
52
|
-
let(:success_a) { true }
|
53
|
-
let(:success_b) { true }
|
54
|
-
|
55
|
-
it { should be(true) }
|
56
|
-
|
57
|
-
it_should_behave_like 'an idempotent method'
|
58
|
-
end
|
59
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Mutant::Subject, '#mutations' do
|
4
|
-
subject { object.mutations }
|
5
|
-
|
6
|
-
let(:class_under_test) do
|
7
|
-
mutation_a, mutation_b = self.mutation_a, self.mutation_b
|
8
|
-
Class.new(described_class) do
|
9
|
-
define_method(:generate_mutations) do |emitter|
|
10
|
-
emitter << mutation_a
|
11
|
-
emitter << mutation_b
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
let(:object) { class_under_test.new(context, node) }
|
17
|
-
let(:node) { double('Node') }
|
18
|
-
let(:context) { double('Context') }
|
19
|
-
let(:mutation_a) { double('Mutation A') }
|
20
|
-
let(:mutation_b) { double('Mutation B') }
|
21
|
-
|
22
|
-
it { should eql([mutation_a, mutation_b]) }
|
23
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Mutant::Subject, '#node' do
|
4
|
-
subject { object.node }
|
5
|
-
|
6
|
-
let(:class_under_test) do
|
7
|
-
Class.new(described_class)
|
8
|
-
end
|
9
|
-
|
10
|
-
let(:object) { class_under_test.new(context, node) }
|
11
|
-
let(:node) { double('Node') }
|
12
|
-
let(:context) { double('Context') }
|
13
|
-
|
14
|
-
it { should be(node) }
|
15
|
-
|
16
|
-
it_should_behave_like 'an idempotent method'
|
17
|
-
end
|