mutant 0.8.0 → 0.8.1
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 +7 -0
- data/config/flay.yml +1 -1
- data/config/reek.yml +1 -0
- data/lib/mutant.rb +10 -3
- data/lib/mutant/actor.rb +2 -5
- data/lib/mutant/actor/env.rb +1 -3
- data/lib/mutant/actor/mailbox.rb +2 -4
- data/lib/mutant/actor/receiver.rb +0 -2
- data/lib/mutant/actor/sender.rb +0 -1
- data/lib/mutant/ast.rb +22 -28
- data/lib/mutant/ast/meta.rb +8 -88
- data/lib/mutant/ast/named_children.rb +1 -8
- data/lib/mutant/ast/sexp.rb +0 -2
- data/lib/mutant/cache.rb +1 -3
- data/lib/mutant/cli.rb +9 -19
- data/lib/mutant/color.rb +0 -3
- data/lib/mutant/config.rb +6 -2
- data/lib/mutant/context.rb +2 -4
- data/lib/mutant/context/scope.rb +10 -16
- data/lib/mutant/delegator.rb +0 -3
- data/lib/mutant/diff.rb +8 -17
- data/lib/mutant/env.rb +3 -5
- data/lib/mutant/env/bootstrap.rb +32 -39
- data/lib/mutant/expression.rb +14 -132
- data/lib/mutant/expression/method.rb +25 -42
- data/lib/mutant/expression/methods.rb +17 -29
- data/lib/mutant/expression/namespace.rb +33 -28
- data/lib/mutant/expression/parser.rb +71 -0
- data/lib/mutant/integration.rb +17 -16
- data/lib/mutant/isolation.rb +14 -14
- data/lib/mutant/loader.rb +2 -4
- data/lib/mutant/matcher.rb +1 -11
- data/lib/mutant/matcher/chain.rb +0 -1
- data/lib/mutant/matcher/compiler.rb +19 -52
- data/lib/mutant/matcher/config.rb +65 -5
- data/lib/mutant/matcher/filter.rb +11 -1
- data/lib/mutant/matcher/method.rb +11 -21
- data/lib/mutant/matcher/method/instance.rb +2 -16
- data/lib/mutant/matcher/method/singleton.rb +3 -20
- data/lib/mutant/matcher/methods.rb +11 -21
- data/lib/mutant/matcher/namespace.rb +0 -4
- data/lib/mutant/matcher/null.rb +0 -1
- data/lib/mutant/matcher/scope.rb +0 -12
- data/lib/mutant/meta.rb +0 -1
- data/lib/mutant/meta/example.rb +12 -26
- data/lib/mutant/meta/example/dsl.rb +1 -8
- data/lib/mutant/mutation.rb +6 -14
- data/lib/mutant/mutator.rb +2 -14
- data/lib/mutant/mutator/node.rb +6 -33
- data/lib/mutant/mutator/node/and_asgn.rb +0 -1
- data/lib/mutant/mutator/node/argument.rb +0 -5
- data/lib/mutant/mutator/node/arguments.rb +1 -7
- data/lib/mutant/mutator/node/begin.rb +0 -2
- data/lib/mutant/mutator/node/binary.rb +0 -3
- data/lib/mutant/mutator/node/block.rb +0 -2
- data/lib/mutant/mutator/node/break.rb +0 -1
- data/lib/mutant/mutator/node/case.rb +0 -3
- data/lib/mutant/mutator/node/conditional_loop.rb +0 -1
- data/lib/mutant/mutator/node/const.rb +0 -1
- data/lib/mutant/mutator/node/define.rb +0 -1
- data/lib/mutant/mutator/node/defined.rb +0 -1
- data/lib/mutant/mutator/node/dstr.rb +0 -1
- data/lib/mutant/mutator/node/dsym.rb +0 -1
- data/lib/mutant/mutator/node/generic.rb +0 -1
- data/lib/mutant/mutator/node/if.rb +0 -4
- data/lib/mutant/mutator/node/kwbegin.rb +0 -1
- data/lib/mutant/mutator/node/literal/array.rb +0 -2
- data/lib/mutant/mutator/node/literal/boolean.rb +0 -1
- data/lib/mutant/mutator/node/literal/fixnum.rb +2 -5
- data/lib/mutant/mutator/node/literal/float.rb +1 -4
- data/lib/mutant/mutator/node/literal/hash.rb +0 -3
- data/lib/mutant/mutator/node/literal/nil.rb +0 -1
- data/lib/mutant/mutator/node/literal/range.rb +1 -5
- data/lib/mutant/mutator/node/literal/regex.rb +1 -3
- data/lib/mutant/mutator/node/literal/string.rb +0 -1
- data/lib/mutant/mutator/node/literal/symbol.rb +0 -1
- data/lib/mutant/mutator/node/masgn.rb +0 -1
- data/lib/mutant/mutator/node/match_current_line.rb +0 -1
- data/lib/mutant/mutator/node/mlhs.rb +0 -1
- data/lib/mutant/mutator/node/named_value/access.rb +0 -1
- data/lib/mutant/mutator/node/named_value/constant_assignment.rb +0 -2
- data/lib/mutant/mutator/node/named_value/variable_assignment.rb +0 -2
- data/lib/mutant/mutator/node/next.rb +0 -1
- data/lib/mutant/mutator/node/noop.rb +0 -1
- data/lib/mutant/mutator/node/nthref.rb +0 -1
- data/lib/mutant/mutator/node/op_asgn.rb +0 -1
- data/lib/mutant/mutator/node/or_asgn.rb +1 -2
- data/lib/mutant/mutator/node/resbody.rb +0 -2
- data/lib/mutant/mutator/node/rescue.rb +1 -6
- data/lib/mutant/mutator/node/return.rb +0 -1
- data/lib/mutant/mutator/node/send.rb +16 -17
- data/lib/mutant/mutator/node/send/attribute_assignment.rb +0 -3
- data/lib/mutant/mutator/node/send/binary.rb +0 -1
- data/lib/mutant/mutator/node/send/index.rb +0 -3
- data/lib/mutant/mutator/node/splat.rb +0 -1
- data/lib/mutant/mutator/node/super.rb +0 -1
- data/lib/mutant/mutator/node/when.rb +2 -7
- data/lib/mutant/mutator/node/yield.rb +0 -1
- data/lib/mutant/mutator/node/zsuper.rb +0 -1
- data/lib/mutant/mutator/registry.rb +1 -4
- data/lib/mutant/mutator/util.rb +0 -2
- data/lib/mutant/mutator/util/array.rb +0 -3
- data/lib/mutant/mutator/util/symbol.rb +0 -1
- data/lib/mutant/parallel.rb +3 -9
- data/lib/mutant/parallel/master.rb +7 -17
- data/lib/mutant/parallel/source.rb +2 -7
- data/lib/mutant/parallel/worker.rb +1 -5
- data/lib/mutant/reporter.rb +0 -4
- data/lib/mutant/reporter/cli.rb +1 -8
- data/lib/mutant/reporter/cli/format.rb +7 -18
- data/lib/mutant/reporter/cli/printer.rb +2 -12
- data/lib/mutant/reporter/cli/printer/config.rb +1 -4
- data/lib/mutant/reporter/cli/printer/env_progress.rb +3 -7
- data/lib/mutant/reporter/cli/printer/env_result.rb +0 -1
- data/lib/mutant/reporter/cli/printer/mutation_progress_result.rb +0 -2
- data/lib/mutant/reporter/cli/printer/mutation_result.rb +3 -11
- data/lib/mutant/reporter/cli/printer/status.rb +1 -4
- data/lib/mutant/reporter/cli/printer/status_progressive.rb +1 -3
- data/lib/mutant/reporter/cli/printer/subject_progress.rb +0 -5
- data/lib/mutant/reporter/cli/printer/subject_result.rb +0 -1
- data/lib/mutant/reporter/cli/printer/test_result.rb +0 -1
- data/lib/mutant/reporter/cli/tput.rb +4 -1
- data/lib/mutant/reporter/trace.rb +2 -4
- data/lib/mutant/repository.rb +88 -0
- data/lib/mutant/require_highjack.rb +0 -1
- data/lib/mutant/result.rb +25 -48
- data/lib/mutant/runner.rb +7 -16
- data/lib/mutant/runner/sink.rb +3 -11
- data/lib/mutant/selector.rb +1 -2
- data/lib/mutant/selector/expression.rb +1 -2
- data/lib/mutant/subject.rb +10 -21
- data/lib/mutant/subject/method.rb +11 -12
- data/lib/mutant/subject/method/instance.rb +1 -5
- data/lib/mutant/subject/method/singleton.rb +1 -3
- data/lib/mutant/test.rb +1 -2
- data/lib/mutant/version.rb +2 -2
- data/lib/mutant/warning_filter.rb +2 -7
- data/lib/mutant/zombifier.rb +6 -10
- data/meta/send.rb +8 -0
- data/spec/spec_helper.rb +5 -1
- data/spec/support/corpus.rb +5 -9
- data/spec/support/rb_bug.rb +0 -1
- data/spec/support/rspec.rb +0 -1
- data/spec/support/ruby_vm.rb +0 -2
- data/spec/unit/mutant/ast/meta/send_spec.rb +42 -0
- data/spec/unit/mutant/ast/named_children_spec.rb +51 -0
- data/spec/unit/mutant/ast/sexp_spec.rb +36 -0
- data/spec/unit/mutant/ast_spec.rb +8 -0
- data/spec/unit/mutant/cli_spec.rb +34 -19
- data/spec/unit/mutant/context/scope_spec.rb +11 -0
- data/spec/unit/mutant/env/boostrap_spec.rb +5 -2
- data/spec/unit/mutant/env_spec.rb +14 -15
- data/spec/unit/mutant/expression/method_spec.rb +10 -14
- data/spec/unit/mutant/expression/methods_spec.rb +24 -11
- data/spec/unit/mutant/expression/namespace/flat_spec.rb +5 -6
- data/spec/unit/mutant/expression/namespace/recursive_spec.rb +16 -10
- data/spec/unit/mutant/expression/parser_spec.rb +67 -0
- data/spec/unit/mutant/expression_spec.rb +24 -57
- data/spec/unit/mutant/integration/rspec_spec.rb +7 -7
- data/spec/unit/mutant/integration_spec.rb +2 -2
- data/spec/unit/mutant/isolation_spec.rb +31 -29
- data/spec/unit/mutant/matcher/compiler/subject_prefix_spec.rb +2 -2
- data/spec/unit/mutant/matcher/compiler_spec.rb +27 -58
- data/spec/unit/mutant/matcher/config_spec.rb +45 -0
- data/spec/unit/mutant/matcher/filter_spec.rb +12 -5
- data/spec/unit/mutant/matcher/method/instance_spec.rb +0 -1
- data/spec/unit/mutant/matcher/method/singleton_spec.rb +0 -1
- data/spec/unit/mutant/matcher/namespace_spec.rb +4 -4
- data/spec/unit/mutant/parallel/worker_spec.rb +1 -1
- data/spec/unit/mutant/reporter/cli/printer/config_spec.rb +4 -4
- data/spec/unit/mutant/reporter/cli/printer/env_progress_spec.rb +7 -7
- data/spec/unit/mutant/reporter/cli/printer/env_result_spec.rb +2 -2
- data/spec/unit/mutant/reporter/cli/printer/status_progressive_spec.rb +2 -2
- data/spec/unit/mutant/reporter/cli/printer/status_spec.rb +12 -12
- data/spec/unit/mutant/reporter/cli/printer/subject_progress_spec.rb +1 -1
- data/spec/unit/mutant/reporter/cli_spec.rb +9 -10
- data/spec/unit/mutant/repository/diff_spec.rb +80 -0
- data/spec/unit/mutant/repository/subject_filter_spec.rb +28 -0
- data/spec/unit/mutant/result/env_spec.rb +1 -1
- data/spec/unit/mutant/runner_spec.rb +0 -1
- data/spec/unit/mutant/selector/expression_spec.rb +14 -14
- data/spec/unit/mutant/subject/method/instance_spec.rb +2 -2
- data/spec/unit/mutant/subject/method/singleton_spec.rb +2 -2
- data/spec/unit/mutant/subject_spec.rb +5 -2
- metadata +20 -3
- data/spec/support/mutation_verifier.rb +0 -96
@@ -8,14 +8,14 @@ RSpec.describe Mutant::Reporter::CLI::Printer::StatusProgressive do
|
|
8
8
|
update(:env_result) { { subject_results: [] } }
|
9
9
|
|
10
10
|
it_reports <<-REPORT
|
11
|
-
(00/02)
|
11
|
+
(00/02) 100% - killtime: 0.00s runtime: 4.00s overhead: 4.00s
|
12
12
|
REPORT
|
13
13
|
|
14
14
|
context 'on non default coverage expectation' do
|
15
15
|
update(:config) { { expected_coverage: 0.1r } }
|
16
16
|
|
17
17
|
it_reports <<-REPORT
|
18
|
-
(00/02)
|
18
|
+
(00/02) 100% - killtime: 0.00s runtime: 4.00s overhead: 4.00s
|
19
19
|
REPORT
|
20
20
|
end
|
21
21
|
end
|
@@ -9,8 +9,8 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
|
|
9
9
|
|
10
10
|
it_reports <<-REPORT
|
11
11
|
Mutant configuration:
|
12
|
-
Matcher: #<Mutant::Matcher::Config
|
13
|
-
Integration:
|
12
|
+
Matcher: #<Mutant::Matcher::Config empty>
|
13
|
+
Integration: Mutant::Integration::Null
|
14
14
|
Expect Coverage: 100.00%
|
15
15
|
Jobs: 1
|
16
16
|
Includes: []
|
@@ -22,7 +22,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
|
|
22
22
|
Runtime: 4.00s
|
23
23
|
Killtime: 0.00s
|
24
24
|
Overhead: Inf%
|
25
|
-
Coverage:
|
25
|
+
Coverage: 100.00%
|
26
26
|
Expected: 100.00%
|
27
27
|
Active subjects: 0
|
28
28
|
REPORT
|
@@ -32,8 +32,8 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
|
|
32
32
|
|
33
33
|
it_reports <<-REPORT
|
34
34
|
Mutant configuration:
|
35
|
-
Matcher: #<Mutant::Matcher::Config
|
36
|
-
Integration:
|
35
|
+
Matcher: #<Mutant::Matcher::Config empty>
|
36
|
+
Integration: Mutant::Integration::Null
|
37
37
|
Expect Coverage: 10.00%
|
38
38
|
Jobs: 1
|
39
39
|
Includes: []
|
@@ -45,7 +45,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
|
|
45
45
|
Runtime: 4.00s
|
46
46
|
Killtime: 0.00s
|
47
47
|
Overhead: Inf%
|
48
|
-
Coverage:
|
48
|
+
Coverage: 100.00%
|
49
49
|
Expected: 10.00%
|
50
50
|
Active subjects: 0
|
51
51
|
REPORT
|
@@ -58,8 +58,8 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
|
|
58
58
|
|
59
59
|
it_reports(<<-REPORT)
|
60
60
|
Mutant configuration:
|
61
|
-
Matcher: #<Mutant::Matcher::Config
|
62
|
-
Integration:
|
61
|
+
Matcher: #<Mutant::Matcher::Config empty>
|
62
|
+
Integration: Mutant::Integration::Null
|
63
63
|
Expect Coverage: 100.00%
|
64
64
|
Jobs: 1
|
65
65
|
Includes: []
|
@@ -85,8 +85,8 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
|
|
85
85
|
|
86
86
|
it_reports(<<-REPORT)
|
87
87
|
Mutant configuration:
|
88
|
-
Matcher: #<Mutant::Matcher::Config
|
89
|
-
Integration:
|
88
|
+
Matcher: #<Mutant::Matcher::Config empty>
|
89
|
+
Integration: Mutant::Integration::Null
|
90
90
|
Expect Coverage: 100.00%
|
91
91
|
Jobs: 1
|
92
92
|
Includes: []
|
@@ -114,8 +114,8 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
|
|
114
114
|
context 'on success' do
|
115
115
|
it_reports(<<-REPORT)
|
116
116
|
Mutant configuration:
|
117
|
-
Matcher: #<Mutant::Matcher::Config
|
118
|
-
Integration:
|
117
|
+
Matcher: #<Mutant::Matcher::Config empty>
|
118
|
+
Integration: Mutant::Integration::Null
|
119
119
|
Expect Coverage: 100.00%
|
120
120
|
Jobs: 1
|
121
121
|
Includes: []
|
@@ -29,7 +29,7 @@ RSpec.describe Mutant::Reporter::CLI::Printer::SubjectProgress do
|
|
29
29
|
|
30
30
|
it_reports <<-'STR'
|
31
31
|
subject-a mutations: 2
|
32
|
-
(00/02)
|
32
|
+
(00/02) 100% - killtime: 0.00s runtime: 0.00s overhead: 0.00s
|
33
33
|
- test-a
|
34
34
|
STR
|
35
35
|
end
|
@@ -121,8 +121,8 @@ RSpec.describe Mutant::Reporter::CLI do
|
|
121
121
|
|
122
122
|
it_reports(<<-REPORT)
|
123
123
|
Mutant configuration:
|
124
|
-
Matcher: #<Mutant::Matcher::Config
|
125
|
-
Integration:
|
124
|
+
Matcher: #<Mutant::Matcher::Config empty>
|
125
|
+
Integration: Mutant::Integration::Null
|
126
126
|
Expect Coverage: 100.00%
|
127
127
|
Jobs: 1
|
128
128
|
Includes: []
|
@@ -136,8 +136,8 @@ RSpec.describe Mutant::Reporter::CLI do
|
|
136
136
|
|
137
137
|
it_reports(<<-REPORT)
|
138
138
|
Mutant configuration:
|
139
|
-
Matcher: #<Mutant::Matcher::Config
|
140
|
-
Integration:
|
139
|
+
Matcher: #<Mutant::Matcher::Config empty>
|
140
|
+
Integration: Mutant::Integration::Null
|
141
141
|
Expect Coverage: 10.00%
|
142
142
|
Jobs: 1
|
143
143
|
Includes: []
|
@@ -155,8 +155,8 @@ RSpec.describe Mutant::Reporter::CLI do
|
|
155
155
|
|
156
156
|
it_reports(<<-REPORT)
|
157
157
|
Mutant configuration:
|
158
|
-
Matcher: #<Mutant::Matcher::Config
|
159
|
-
Integration:
|
158
|
+
Matcher: #<Mutant::Matcher::Config empty>
|
159
|
+
Integration: Mutant::Integration::Null
|
160
160
|
Expect Coverage: 100.00%
|
161
161
|
Jobs: 1
|
162
162
|
Includes: []
|
@@ -181,8 +181,8 @@ RSpec.describe Mutant::Reporter::CLI do
|
|
181
181
|
|
182
182
|
it_reports(<<-REPORT)
|
183
183
|
[tput-restore]Mutant configuration:
|
184
|
-
Matcher: #<Mutant::Matcher::Config
|
185
|
-
Integration:
|
184
|
+
Matcher: #<Mutant::Matcher::Config empty>
|
185
|
+
Integration: Mutant::Integration::Null
|
186
186
|
Expect Coverage: 100.00%
|
187
187
|
Jobs: 1
|
188
188
|
Includes: []
|
@@ -208,7 +208,7 @@ RSpec.describe Mutant::Reporter::CLI do
|
|
208
208
|
|
209
209
|
let(:tty?) { true }
|
210
210
|
|
211
|
-
it_reports Mutant::Color::
|
211
|
+
it_reports Mutant::Color::GREEN.format('(00/02) 100% - killtime: 0.00s runtime: 4.00s overhead: 4.00s') << "\n"
|
212
212
|
end
|
213
213
|
|
214
214
|
context 'with last mutation present' do
|
@@ -224,6 +224,5 @@ RSpec.describe Mutant::Reporter::CLI do
|
|
224
224
|
end
|
225
225
|
end
|
226
226
|
end
|
227
|
-
|
228
227
|
end
|
229
228
|
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
describe Mutant::Repository::Diff do
|
2
|
+
describe '.from_head' do
|
3
|
+
subject { described_class.from_head(to_revision) }
|
4
|
+
|
5
|
+
let(:to_revision) { double('to revision') }
|
6
|
+
|
7
|
+
it { should eql(described_class.new('HEAD', to_revision)) }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#touches?' do
|
11
|
+
let(:object) { described_class.new('from_rev', 'to_rev') }
|
12
|
+
let(:path) { Pathname.new('foo.rb') }
|
13
|
+
let(:line_range) { 1..2 }
|
14
|
+
|
15
|
+
subject { object.touches?(path, line_range) }
|
16
|
+
|
17
|
+
before do
|
18
|
+
expect(Kernel).to receive(:system)
|
19
|
+
.ordered
|
20
|
+
.with(
|
21
|
+
*%w[git ls-files --error-unmatch -- foo.rb],
|
22
|
+
out: File::NULL,
|
23
|
+
err: File::NULL
|
24
|
+
).and_return(git_ls_success?)
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'when file is NOT tracked in repository' do
|
28
|
+
let(:git_ls_success?) { false }
|
29
|
+
|
30
|
+
it { should be(false) }
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'when file is tracked in repository' do
|
34
|
+
let(:git_ls_success?) { true }
|
35
|
+
let(:status) { double('Status', success?: success?) }
|
36
|
+
let(:stdout) { double('Stdout', empty?: stdout_empty?) }
|
37
|
+
let(:stdout_empty?) { false }
|
38
|
+
|
39
|
+
before do
|
40
|
+
expect(Open3).to receive(:capture2)
|
41
|
+
.ordered
|
42
|
+
.with(*expected_git_log_command, binmode: true)
|
43
|
+
.and_return([stdout, status])
|
44
|
+
end
|
45
|
+
|
46
|
+
let(:expected_git_log_command) do
|
47
|
+
%w[
|
48
|
+
git log from_rev...to_rev -L 1,2:foo.rb
|
49
|
+
]
|
50
|
+
end
|
51
|
+
|
52
|
+
context 'on failure of git log command' do
|
53
|
+
let(:success?) { false }
|
54
|
+
|
55
|
+
it 'raises error' do
|
56
|
+
expect { subject }.to raise_error(
|
57
|
+
Mutant::Repository::RepositoryError,
|
58
|
+
"Command #{expected_git_log_command} failed!"
|
59
|
+
)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'on suuccess of git command' do
|
64
|
+
let(:success?) { true }
|
65
|
+
|
66
|
+
context 'on empty stdout' do
|
67
|
+
let(:stdout_empty?) { true }
|
68
|
+
|
69
|
+
it { should be(false) }
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'on non empty stdout' do
|
73
|
+
let(:stdout_empty?) { false }
|
74
|
+
|
75
|
+
it { should be(true) }
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
RSpec.describe Mutant::Repository::SubjectFilter do
|
2
|
+
context '#call' do
|
3
|
+
subject { object.call(mutant_subject) }
|
4
|
+
|
5
|
+
let(:object) { described_class.new(diff) }
|
6
|
+
let(:diff) { double('Diff') }
|
7
|
+
let(:return_value) { double('Return Value') }
|
8
|
+
|
9
|
+
let(:mutant_subject) do
|
10
|
+
double(
|
11
|
+
'Subject',
|
12
|
+
source_path: double('source path'),
|
13
|
+
source_lines: double('source lines')
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
before do
|
18
|
+
expect(diff).to receive(:touches?).with(
|
19
|
+
mutant_subject.source_path,
|
20
|
+
mutant_subject.source_lines
|
21
|
+
).and_return(return_value)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'connects return value to repository diff API' do
|
25
|
+
expect(subject).to be(return_value)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -3,27 +3,27 @@ RSpec.describe Mutant::Selector::Expression do
|
|
3
3
|
let(:object) { described_class.new(integration) }
|
4
4
|
|
5
5
|
let(:subject_class) do
|
6
|
+
parse = method(:parse_expression)
|
7
|
+
|
6
8
|
Class.new(Mutant::Subject) do
|
7
|
-
|
8
|
-
|
9
|
+
define_method(:expression) do
|
10
|
+
parse.('SubjectA')
|
9
11
|
end
|
10
12
|
|
11
|
-
|
12
|
-
[expression] <<
|
13
|
+
define_method(:match_expressions) do
|
14
|
+
[expression] << parse.('SubjectB')
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
17
|
-
let(:mutation_subject) { subject_class.new(context, node)
|
18
|
-
let(:context) { double('Context')
|
19
|
-
let(:node) { double('Node')
|
20
|
-
|
21
|
-
let(:
|
22
|
-
let(:
|
23
|
-
|
24
|
-
let(:
|
25
|
-
let(:test_b) { double('test b', expression: Mutant::Expression.parse('SubjectB')) }
|
26
|
-
let(:test_c) { double('test c', expression: Mutant::Expression.parse('SubjectC')) }
|
19
|
+
let(:mutation_subject) { subject_class.new(context, node) }
|
20
|
+
let(:context) { double('Context') }
|
21
|
+
let(:node) { double('Node') }
|
22
|
+
let(:config) { Mutant::Config::DEFAULT.update(integration: integration) }
|
23
|
+
let(:integration) { double('Integration', all_tests: all_tests) }
|
24
|
+
let(:test_a) { double('test a', expression: parse_expression('SubjectA')) }
|
25
|
+
let(:test_b) { double('test b', expression: parse_expression('SubjectB')) }
|
26
|
+
let(:test_c) { double('test c', expression: parse_expression('SubjectC')) }
|
27
27
|
|
28
28
|
subject { object.call(mutation_subject) }
|
29
29
|
|
@@ -26,7 +26,7 @@ RSpec.describe Mutant::Subject::Method::Instance do
|
|
26
26
|
describe '#expression' do
|
27
27
|
subject { object.expression }
|
28
28
|
|
29
|
-
it { should eql(
|
29
|
+
it { should eql(parse_expression('Test#foo')) }
|
30
30
|
|
31
31
|
it_should_behave_like 'an idempotent method'
|
32
32
|
end
|
@@ -34,7 +34,7 @@ RSpec.describe Mutant::Subject::Method::Instance do
|
|
34
34
|
describe '#match_expression' do
|
35
35
|
subject { object.match_expressions }
|
36
36
|
|
37
|
-
it { should eql(%w[Test#foo Test*].map(&
|
37
|
+
it { should eql(%w[Test#foo Test*].map(&method(:parse_expression))) }
|
38
38
|
|
39
39
|
it_should_behave_like 'an idempotent method'
|
40
40
|
end
|
@@ -21,7 +21,7 @@ RSpec.describe Mutant::Subject::Method::Singleton do
|
|
21
21
|
describe '#expression' do
|
22
22
|
subject { object.expression }
|
23
23
|
|
24
|
-
it { should eql(
|
24
|
+
it { should eql(parse_expression('Test.foo')) }
|
25
25
|
|
26
26
|
it_should_behave_like 'an idempotent method'
|
27
27
|
end
|
@@ -29,7 +29,7 @@ RSpec.describe Mutant::Subject::Method::Singleton do
|
|
29
29
|
describe '#match_expression' do
|
30
30
|
subject { object.match_expressions }
|
31
31
|
|
32
|
-
it { should eql(%w[Test.foo Test*].map(&
|
32
|
+
it { should eql(%w[Test.foo Test*].map(&method(:parse_expression))) }
|
33
33
|
|
34
34
|
it_should_behave_like 'an idempotent method'
|
35
35
|
end
|
@@ -2,11 +2,14 @@ RSpec.describe Mutant::Subject do
|
|
2
2
|
let(:class_under_test) do
|
3
3
|
Class.new(described_class) do
|
4
4
|
def expression
|
5
|
-
Mutant::Expression.
|
5
|
+
Mutant::Expression::Namespace::Exact.new(scope_name: 'SubjectA')
|
6
6
|
end
|
7
7
|
|
8
8
|
def match_expressions
|
9
|
-
[
|
9
|
+
[
|
10
|
+
expression,
|
11
|
+
Mutant::Expression::Namespace::Exact.new(scope_name: 'SubjectB')
|
12
|
+
]
|
10
13
|
end
|
11
14
|
end
|
12
15
|
end
|
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.8.
|
4
|
+
version: 0.8.1
|
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-
|
11
|
+
date: 2015-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -298,6 +298,7 @@ files:
|
|
298
298
|
- lib/mutant/expression/method.rb
|
299
299
|
- lib/mutant/expression/methods.rb
|
300
300
|
- lib/mutant/expression/namespace.rb
|
301
|
+
- lib/mutant/expression/parser.rb
|
301
302
|
- lib/mutant/integration.rb
|
302
303
|
- lib/mutant/isolation.rb
|
303
304
|
- lib/mutant/loader.rb
|
@@ -397,6 +398,7 @@ files:
|
|
397
398
|
- lib/mutant/reporter/cli/tput.rb
|
398
399
|
- lib/mutant/reporter/null.rb
|
399
400
|
- lib/mutant/reporter/trace.rb
|
401
|
+
- lib/mutant/repository.rb
|
400
402
|
- lib/mutant/require_highjack.rb
|
401
403
|
- lib/mutant/result.rb
|
402
404
|
- lib/mutant/runner.rb
|
@@ -481,7 +483,6 @@ files:
|
|
481
483
|
- spec/support/fake_actor.rb
|
482
484
|
- spec/support/file_system.rb
|
483
485
|
- spec/support/ice_nine_config.rb
|
484
|
-
- spec/support/mutation_verifier.rb
|
485
486
|
- spec/support/rb_bug.rb
|
486
487
|
- spec/support/rspec.rb
|
487
488
|
- spec/support/ruby_vm.rb
|
@@ -493,12 +494,16 @@ files:
|
|
493
494
|
- spec/unit/mutant/actor/message_spec.rb
|
494
495
|
- spec/unit/mutant/actor/receiver_spec.rb
|
495
496
|
- spec/unit/mutant/actor/sender_spec.rb
|
497
|
+
- spec/unit/mutant/ast/meta/send_spec.rb
|
498
|
+
- spec/unit/mutant/ast/named_children_spec.rb
|
499
|
+
- spec/unit/mutant/ast/sexp_spec.rb
|
496
500
|
- spec/unit/mutant/ast_spec.rb
|
497
501
|
- spec/unit/mutant/cache_spec.rb
|
498
502
|
- spec/unit/mutant/cli_spec.rb
|
499
503
|
- spec/unit/mutant/context/root_spec.rb
|
500
504
|
- spec/unit/mutant/context/scope/root_spec.rb
|
501
505
|
- spec/unit/mutant/context/scope/unqualified_name_spec.rb
|
506
|
+
- spec/unit/mutant/context/scope_spec.rb
|
502
507
|
- spec/unit/mutant/context_spec.rb
|
503
508
|
- spec/unit/mutant/diff_spec.rb
|
504
509
|
- spec/unit/mutant/env/boostrap_spec.rb
|
@@ -507,6 +512,7 @@ files:
|
|
507
512
|
- spec/unit/mutant/expression/methods_spec.rb
|
508
513
|
- spec/unit/mutant/expression/namespace/flat_spec.rb
|
509
514
|
- spec/unit/mutant/expression/namespace/recursive_spec.rb
|
515
|
+
- spec/unit/mutant/expression/parser_spec.rb
|
510
516
|
- spec/unit/mutant/expression_spec.rb
|
511
517
|
- spec/unit/mutant/integration/rspec_spec.rb
|
512
518
|
- spec/unit/mutant/integration_spec.rb
|
@@ -515,6 +521,7 @@ files:
|
|
515
521
|
- spec/unit/mutant/matcher/chain_spec.rb
|
516
522
|
- spec/unit/mutant/matcher/compiler/subject_prefix_spec.rb
|
517
523
|
- spec/unit/mutant/matcher/compiler_spec.rb
|
524
|
+
- spec/unit/mutant/matcher/config_spec.rb
|
518
525
|
- spec/unit/mutant/matcher/filter_spec.rb
|
519
526
|
- spec/unit/mutant/matcher/method/instance_spec.rb
|
520
527
|
- spec/unit/mutant/matcher/method/singleton_spec.rb
|
@@ -544,6 +551,8 @@ files:
|
|
544
551
|
- spec/unit/mutant/reporter/cli_spec.rb
|
545
552
|
- spec/unit/mutant/reporter/null_spec.rb
|
546
553
|
- spec/unit/mutant/reporter/trace_spec.rb
|
554
|
+
- spec/unit/mutant/repository/diff_spec.rb
|
555
|
+
- spec/unit/mutant/repository/subject_filter_spec.rb
|
547
556
|
- spec/unit/mutant/require_highjack_spec.rb
|
548
557
|
- spec/unit/mutant/result/env_spec.rb
|
549
558
|
- spec/unit/mutant/result/subject_spec.rb
|
@@ -601,12 +610,16 @@ test_files:
|
|
601
610
|
- spec/unit/mutant/actor/message_spec.rb
|
602
611
|
- spec/unit/mutant/actor/receiver_spec.rb
|
603
612
|
- spec/unit/mutant/actor/sender_spec.rb
|
613
|
+
- spec/unit/mutant/ast/meta/send_spec.rb
|
614
|
+
- spec/unit/mutant/ast/named_children_spec.rb
|
615
|
+
- spec/unit/mutant/ast/sexp_spec.rb
|
604
616
|
- spec/unit/mutant/ast_spec.rb
|
605
617
|
- spec/unit/mutant/cache_spec.rb
|
606
618
|
- spec/unit/mutant/cli_spec.rb
|
607
619
|
- spec/unit/mutant/context/root_spec.rb
|
608
620
|
- spec/unit/mutant/context/scope/root_spec.rb
|
609
621
|
- spec/unit/mutant/context/scope/unqualified_name_spec.rb
|
622
|
+
- spec/unit/mutant/context/scope_spec.rb
|
610
623
|
- spec/unit/mutant/context_spec.rb
|
611
624
|
- spec/unit/mutant/diff_spec.rb
|
612
625
|
- spec/unit/mutant/env/boostrap_spec.rb
|
@@ -615,6 +628,7 @@ test_files:
|
|
615
628
|
- spec/unit/mutant/expression/methods_spec.rb
|
616
629
|
- spec/unit/mutant/expression/namespace/flat_spec.rb
|
617
630
|
- spec/unit/mutant/expression/namespace/recursive_spec.rb
|
631
|
+
- spec/unit/mutant/expression/parser_spec.rb
|
618
632
|
- spec/unit/mutant/expression_spec.rb
|
619
633
|
- spec/unit/mutant/integration/rspec_spec.rb
|
620
634
|
- spec/unit/mutant/integration_spec.rb
|
@@ -623,6 +637,7 @@ test_files:
|
|
623
637
|
- spec/unit/mutant/matcher/chain_spec.rb
|
624
638
|
- spec/unit/mutant/matcher/compiler/subject_prefix_spec.rb
|
625
639
|
- spec/unit/mutant/matcher/compiler_spec.rb
|
640
|
+
- spec/unit/mutant/matcher/config_spec.rb
|
626
641
|
- spec/unit/mutant/matcher/filter_spec.rb
|
627
642
|
- spec/unit/mutant/matcher/method/instance_spec.rb
|
628
643
|
- spec/unit/mutant/matcher/method/singleton_spec.rb
|
@@ -652,6 +667,8 @@ test_files:
|
|
652
667
|
- spec/unit/mutant/reporter/cli_spec.rb
|
653
668
|
- spec/unit/mutant/reporter/null_spec.rb
|
654
669
|
- spec/unit/mutant/reporter/trace_spec.rb
|
670
|
+
- spec/unit/mutant/repository/diff_spec.rb
|
671
|
+
- spec/unit/mutant/repository/subject_filter_spec.rb
|
655
672
|
- spec/unit/mutant/require_highjack_spec.rb
|
656
673
|
- spec/unit/mutant/result/env_spec.rb
|
657
674
|
- spec/unit/mutant/result/subject_spec.rb
|