mutant 0.5.3 → 0.5.4
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 +6 -0
- data/Gemfile.devtools +12 -11
- data/README.md +1 -1
- data/config/flay.yml +1 -1
- data/lib/mutant/cli/classifier/method.rb +1 -1
- data/lib/mutant/cli.rb +7 -7
- data/lib/mutant/differ.rb +1 -1
- data/lib/mutant/reporter/cli/printer/mutation.rb +1 -1
- data/lib/mutant/runner/config.rb +2 -2
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/walker.rb +2 -0
- data/mutant.gemspec +1 -1
- data/spec/integration/mutant/rspec_spec.rb +1 -1
- data/spec/unit/mutant/cli_new_spec.rb +1 -1
- data/spec/unit/mutant/runner/config_spec.rb +68 -10
- data/spec/unit/mutant/subject_spec.rb +1 -1
- data/test_app/Gemfile.devtools +12 -11
- metadata +4 -5
- data/Gemfile.triage +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfc07195d6693ad63b0433992030c150ca915db7
|
4
|
+
data.tar.gz: 7684770e50ba078c967eb31cb2ea0f94170b2589
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7f32cb5878c9c63305998d23375e9978837b0f8b4243b5361d8d27351869acdc9f93f03bfced9e3977ffd4672aa078316c34078e13da4890e5ddf87cb3da488
|
7
|
+
data.tar.gz: efd706cf179d1dd8081d54a5e7b0b515c385f1a669c15bc2058768f56405fc80f59e8e4f932fa28a172482b18a006ec07cec2f0186ef52c76efdd33c2e13b2f6
|
data/Changelog.md
CHANGED
data/Gemfile.devtools
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
group :development do
|
4
|
-
gem 'rake',
|
5
|
-
gem 'rspec',
|
6
|
-
gem '
|
4
|
+
gem 'rake', '~> 10.1.0'
|
5
|
+
gem 'rspec', '~> 2.14.1'
|
6
|
+
gem 'rspec-core', '~> 2.14.8'
|
7
|
+
gem 'yard', '~> 0.8.7'
|
7
8
|
|
8
9
|
platform :rbx do
|
9
10
|
gem 'rubysl-singleton', '~> 2.0.0'
|
@@ -11,17 +12,17 @@ group :development do
|
|
11
12
|
end
|
12
13
|
|
13
14
|
group :yard do
|
14
|
-
gem 'kramdown', '~> 1.3.
|
15
|
+
gem 'kramdown', '~> 1.3.2'
|
15
16
|
end
|
16
17
|
|
17
18
|
group :guard do
|
18
|
-
gem 'guard', '~> 2.
|
19
|
+
gem 'guard', '~> 2.4.0'
|
19
20
|
gem 'guard-bundler', '~> 2.0.0'
|
20
|
-
gem 'guard-rspec', '~> 4.2.
|
21
|
-
gem 'guard-rubocop', '~> 1.0.
|
21
|
+
gem 'guard-rspec', '~> 4.2.6'
|
22
|
+
gem 'guard-rubocop', '~> 1.0.2'
|
22
23
|
|
23
24
|
# file system change event handling
|
24
|
-
gem 'listen', '~> 2.
|
25
|
+
gem 'listen', '~> 2.5.0'
|
25
26
|
gem 'rb-fchange', '~> 0.0.6', require: false
|
26
27
|
gem 'rb-fsevent', '~> 0.9.3', require: false
|
27
28
|
gem 'rb-inotify', '~> 0.9.0', require: false
|
@@ -37,9 +38,9 @@ group :metrics do
|
|
37
38
|
gem 'flay', '~> 2.4.0'
|
38
39
|
gem 'flog', '~> 4.2.0'
|
39
40
|
gem 'reek', '~> 1.3.2'
|
40
|
-
gem 'rubocop', '~> 0.
|
41
|
+
gem 'rubocop', '~> 0.18.1'
|
41
42
|
gem 'simplecov', '~> 0.8.2'
|
42
|
-
gem 'yardstick', '~> 0.9.
|
43
|
+
gem 'yardstick', '~> 0.9.9'
|
43
44
|
|
44
45
|
platforms :ruby_19, :ruby_20 do
|
45
46
|
gem 'yard-spellcheck', '~> 0.1.5'
|
@@ -47,7 +48,7 @@ group :metrics do
|
|
47
48
|
|
48
49
|
platform :rbx do
|
49
50
|
gem 'json', '~> 1.8.1'
|
50
|
-
gem 'racc', '~> 1.4
|
51
|
+
gem 'racc', '~> 1.4'
|
51
52
|
gem 'rubysl-logger', '~> 2.0.0'
|
52
53
|
gem 'rubysl-open-uri', '~> 2.0.0'
|
53
54
|
gem 'rubysl-prettyprint', '~> 2.0.2'
|
data/README.md
CHANGED
@@ -128,7 +128,7 @@ Example for a subject like `Foo::Bar#baz` it will run all example groups with de
|
|
128
128
|
current prefix level, these example groups *must* kill the mutation.
|
129
129
|
|
130
130
|
This test selection strategy is compatible with the old `--rspec-dm2` and `--rspec-unit` strategy.
|
131
|
-
The old flags
|
131
|
+
The old flags were removed. It allows to define very fine grained specs, or coarse grained - as you like.
|
132
132
|
|
133
133
|
Support
|
134
134
|
-------
|
data/config/flay.yml
CHANGED
data/lib/mutant/cli.rb
CHANGED
@@ -112,7 +112,7 @@ module Mutant
|
|
112
112
|
#
|
113
113
|
def subject_selector
|
114
114
|
if @subject_selectors.any?
|
115
|
-
Morpher::Evaluator::Predicate::Or.new(@subject_selectors)
|
115
|
+
Morpher::Evaluator::Predicate::Boolean::Or.new(@subject_selectors)
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
@@ -128,7 +128,7 @@ module Mutant
|
|
128
128
|
#
|
129
129
|
def predicate
|
130
130
|
if subject_selector && subject_rejector
|
131
|
-
Morpher::Evaluator::Predicate::And.new([
|
131
|
+
Morpher::Evaluator::Predicate::Boolean::And.new([
|
132
132
|
subject_selector,
|
133
133
|
Morpher::Evaluator::Predicate::Negation.new(subject_rejector)
|
134
134
|
])
|
@@ -149,11 +149,11 @@ module Mutant
|
|
149
149
|
#
|
150
150
|
def subject_rejector
|
151
151
|
rejectors = @subject_ignores.flat_map(&:to_a).map do |subject|
|
152
|
-
Morpher.
|
152
|
+
Morpher.compile(s(:eql, s(:attribute, :identification), s(:static, subject.identification)))
|
153
153
|
end
|
154
154
|
|
155
155
|
if rejectors.any?
|
156
|
-
Morpher::Evaluator::Predicate::Or.new(rejectors)
|
156
|
+
Morpher::Evaluator::Predicate::Boolean::Or.new(rejectors)
|
157
157
|
end
|
158
158
|
end
|
159
159
|
end
|
@@ -169,7 +169,7 @@ module Mutant
|
|
169
169
|
def initialize(arguments = [])
|
170
170
|
@builder = Builder.new
|
171
171
|
@debug = @fail_fast = @zombie = false
|
172
|
-
@
|
172
|
+
@expected_coverage = 100.0
|
173
173
|
@strategy = Strategy::Null.new
|
174
174
|
@cache = Mutant::Cache.new
|
175
175
|
parse(arguments)
|
@@ -191,7 +191,7 @@ module Mutant
|
|
191
191
|
strategy: @strategy,
|
192
192
|
fail_fast: @fail_fast,
|
193
193
|
reporter: Reporter::CLI.new($stdout),
|
194
|
-
expected_coverage: @
|
194
|
+
expected_coverage: @expected_coverage
|
195
195
|
)
|
196
196
|
end
|
197
197
|
memoize :config
|
@@ -315,7 +315,7 @@ module Mutant
|
|
315
315
|
@builder.add_subject_ignore(Classifier.run(@cache, pattern))
|
316
316
|
end
|
317
317
|
opts.on('--code CODE', 'Scope execution to subjects with CODE') do |code|
|
318
|
-
@builder.add_subject_selector(Morpher.
|
318
|
+
@builder.add_subject_selector(Morpher.compile(s(:eql, s(:attribute, :code), s(:static, code))))
|
319
319
|
end
|
320
320
|
end
|
321
321
|
|
data/lib/mutant/differ.rb
CHANGED
data/lib/mutant/runner/config.rb
CHANGED
@@ -74,8 +74,8 @@ module Mutant
|
|
74
74
|
# @api private
|
75
75
|
#
|
76
76
|
def coverage
|
77
|
-
return 0.0 if amount_mutations.zero?
|
78
|
-
|
77
|
+
return 0.0 if amount_mutations.zero? && amount_kills.zero?
|
78
|
+
(amount_kills.to_f / amount_mutations) * 100
|
79
79
|
end
|
80
80
|
memoize :coverage
|
81
81
|
|
data/lib/mutant/version.rb
CHANGED
data/lib/mutant/walker.rb
CHANGED
data/mutant.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |gem|
|
|
24
24
|
gem.required_ruby_version = '>= 1.9.3'
|
25
25
|
|
26
26
|
gem.add_runtime_dependency('parser', '~> 2.1.6')
|
27
|
-
gem.add_runtime_dependency('morpher', '~> 0.0
|
27
|
+
gem.add_runtime_dependency('morpher', '~> 0.1.0')
|
28
28
|
gem.add_runtime_dependency('procto', '~> 0.0.2')
|
29
29
|
gem.add_runtime_dependency('abstract_type', '~> 0.0.7')
|
30
30
|
gem.add_runtime_dependency('unparser', '~> 0.1.8')
|
@@ -4,7 +4,7 @@ require 'spec_helper'
|
|
4
4
|
|
5
5
|
describe Mutant, 'rspec integration' do
|
6
6
|
|
7
|
-
let(:base_cmd) {
|
7
|
+
let(:base_cmd) { 'bundle exec mutant -I lib --require test_app --use rspec' }
|
8
8
|
|
9
9
|
shared_examples_for 'rspec integration' do
|
10
10
|
around do |example|
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Mutant::Runner::Config do
|
6
|
+
let(:object) { described_class.run(config) }
|
6
7
|
|
7
8
|
let(:config) do
|
8
9
|
Mutant::Config.new(
|
@@ -17,8 +18,12 @@ describe Mutant::Runner::Config do
|
|
17
18
|
)
|
18
19
|
end
|
19
20
|
|
20
|
-
let(:fail_fast) { false
|
21
|
-
let(:expected_coverage) { 100.0
|
21
|
+
let(:fail_fast) { false }
|
22
|
+
let(:expected_coverage) { 100.0 }
|
23
|
+
let(:reporter) { double('Reporter') }
|
24
|
+
let(:strategy) { double('Strategy') }
|
25
|
+
let(:subject_a) { double('Subject A') }
|
26
|
+
let(:subject_b) { double('Subject B') }
|
22
27
|
|
23
28
|
before do
|
24
29
|
reporter.stub(report: reporter)
|
@@ -28,13 +33,7 @@ describe Mutant::Runner::Config do
|
|
28
33
|
Mutant::Runner.stub(:run).with(config, subject_b).and_return(runner_b)
|
29
34
|
end
|
30
35
|
|
31
|
-
let(:reporter) { double('Reporter') }
|
32
|
-
let(:strategy) { double('Strategy') }
|
33
|
-
let(:subject_a) { double('Subject A') }
|
34
|
-
let(:subject_b) { double('Subject B') }
|
35
|
-
|
36
36
|
describe '#subjects' do
|
37
|
-
let(:object) { described_class.run(config) }
|
38
37
|
|
39
38
|
subject { object.subjects }
|
40
39
|
|
@@ -60,11 +59,62 @@ describe Mutant::Runner::Config do
|
|
60
59
|
end
|
61
60
|
end
|
62
61
|
|
62
|
+
describe '#coverage' do
|
63
|
+
subject { object.coverage }
|
64
|
+
|
65
|
+
let(:runner_a) { double('Runner A', stop?: false, :mutations => mutations_a) }
|
66
|
+
let(:runner_b) { double('Runner B', stop?: false, :mutations => []) }
|
67
|
+
|
68
|
+
let(:mutations_a) do
|
69
|
+
Array.new(amount_mutations) do |number|
|
70
|
+
double('Mutation', success?: number <= amount_kills - 1)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'with zero mutations and kills' do
|
75
|
+
let(:amount_mutations) { 0 }
|
76
|
+
let(:amount_kills) { 0 }
|
77
|
+
|
78
|
+
it { should eql(0.0) }
|
79
|
+
end
|
80
|
+
|
81
|
+
context 'with one mutation' do
|
82
|
+
let(:amount_mutations) { 1 }
|
83
|
+
|
84
|
+
context 'and one kill' do
|
85
|
+
let(:amount_kills) { 1 }
|
86
|
+
it { should eql(100.0) }
|
87
|
+
end
|
88
|
+
|
89
|
+
context 'and no kills' do
|
90
|
+
let(:amount_kills) { 0 }
|
91
|
+
it { should eql(0.0) }
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
context 'with many mutations' do
|
96
|
+
let(:amount_mutations) { 10 }
|
97
|
+
|
98
|
+
context 'and no kill' do
|
99
|
+
let(:amount_kills) { 0 }
|
100
|
+
it { should eql(0.0) }
|
101
|
+
end
|
102
|
+
|
103
|
+
context 'and some kills' do
|
104
|
+
let(:amount_kills) { 2 }
|
105
|
+
it { should eql(20.0) }
|
106
|
+
end
|
107
|
+
|
108
|
+
context 'and as many kills' do
|
109
|
+
let(:amount_kills) { amount_mutations }
|
110
|
+
it { should eql(100.0) }
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
63
115
|
describe '#success?' do
|
64
116
|
subject { object.success? }
|
65
117
|
|
66
|
-
let(:object) { described_class.new(config) }
|
67
|
-
|
68
118
|
let(:mutation_a) do
|
69
119
|
double('Mutation A', success?: false)
|
70
120
|
end
|
@@ -81,6 +131,14 @@ describe Mutant::Runner::Config do
|
|
81
131
|
double('Runner B', stop?: false, success?: true, mutations: [mutation_b])
|
82
132
|
end
|
83
133
|
|
134
|
+
let(:runner_a) do
|
135
|
+
double('Runner A', stop?: false, success?: false, mutations: [mutation_a])
|
136
|
+
end
|
137
|
+
|
138
|
+
let(:runner_b) do
|
139
|
+
double('Runner B', stop?: false, success?: true, mutations: [mutation_b])
|
140
|
+
end
|
141
|
+
|
84
142
|
context 'without fail fast' do
|
85
143
|
|
86
144
|
context 'when expected coverage equals actual coverage' do
|
data/test_app/Gemfile.devtools
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
group :development do
|
4
|
-
gem 'rake',
|
5
|
-
gem 'rspec',
|
6
|
-
gem '
|
4
|
+
gem 'rake', '~> 10.1.0'
|
5
|
+
gem 'rspec', '~> 2.14.1'
|
6
|
+
gem 'rspec-core', '~> 2.14.8'
|
7
|
+
gem 'yard', '~> 0.8.7'
|
7
8
|
|
8
9
|
platform :rbx do
|
9
10
|
gem 'rubysl-singleton', '~> 2.0.0'
|
@@ -11,17 +12,17 @@ group :development do
|
|
11
12
|
end
|
12
13
|
|
13
14
|
group :yard do
|
14
|
-
gem 'kramdown', '~> 1.3.
|
15
|
+
gem 'kramdown', '~> 1.3.2'
|
15
16
|
end
|
16
17
|
|
17
18
|
group :guard do
|
18
|
-
gem 'guard', '~> 2.
|
19
|
+
gem 'guard', '~> 2.4.0'
|
19
20
|
gem 'guard-bundler', '~> 2.0.0'
|
20
|
-
gem 'guard-rspec', '~> 4.2.
|
21
|
-
gem 'guard-rubocop', '~> 1.0.
|
21
|
+
gem 'guard-rspec', '~> 4.2.6'
|
22
|
+
gem 'guard-rubocop', '~> 1.0.2'
|
22
23
|
|
23
24
|
# file system change event handling
|
24
|
-
gem 'listen', '~> 2.
|
25
|
+
gem 'listen', '~> 2.5.0'
|
25
26
|
gem 'rb-fchange', '~> 0.0.6', require: false
|
26
27
|
gem 'rb-fsevent', '~> 0.9.3', require: false
|
27
28
|
gem 'rb-inotify', '~> 0.9.0', require: false
|
@@ -37,9 +38,9 @@ group :metrics do
|
|
37
38
|
gem 'flay', '~> 2.4.0'
|
38
39
|
gem 'flog', '~> 4.2.0'
|
39
40
|
gem 'reek', '~> 1.3.2'
|
40
|
-
gem 'rubocop', '~> 0.
|
41
|
+
gem 'rubocop', '~> 0.18.1'
|
41
42
|
gem 'simplecov', '~> 0.8.2'
|
42
|
-
gem 'yardstick', '~> 0.9.
|
43
|
+
gem 'yardstick', '~> 0.9.9'
|
43
44
|
|
44
45
|
platforms :ruby_19, :ruby_20 do
|
45
46
|
gem 'yard-spellcheck', '~> 0.1.5'
|
@@ -47,7 +48,7 @@ group :metrics do
|
|
47
48
|
|
48
49
|
platform :rbx do
|
49
50
|
gem 'json', '~> 1.8.1'
|
50
|
-
gem 'racc', '~> 1.4
|
51
|
+
gem 'racc', '~> 1.4'
|
51
52
|
gem 'rubysl-logger', '~> 2.0.0'
|
52
53
|
gem 'rubysl-open-uri', '~> 2.0.0'
|
53
54
|
gem 'rubysl-prettyprint', '~> 2.0.2'
|
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.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.0
|
33
|
+
version: 0.1.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.0
|
40
|
+
version: 0.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: procto
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -216,7 +216,6 @@ files:
|
|
216
216
|
- Changelog.md
|
217
217
|
- Gemfile
|
218
218
|
- Gemfile.devtools
|
219
|
-
- Gemfile.triage
|
220
219
|
- Guardfile
|
221
220
|
- LICENSE
|
222
221
|
- README.md
|
data/Gemfile.triage
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
group :development do
|
4
|
-
gem 'rake', '~> 10.1.0'
|
5
|
-
gem 'rspec', '~> 2.14.1'
|
6
|
-
gem 'yard', '~> 0.8.7'
|
7
|
-
end
|
8
|
-
|
9
|
-
group :yard do
|
10
|
-
gem 'kramdown', '~> 1.2.0'
|
11
|
-
end
|
12
|
-
|
13
|
-
group :guard do
|
14
|
-
gem 'guard', '~> 1.8.1'
|
15
|
-
gem 'guard-bundler', '~> 1.0.0'
|
16
|
-
gem 'guard-rspec', '~> 3.0.2'
|
17
|
-
gem 'guard-rubocop', '~> 0.2.0'
|
18
|
-
gem 'guard-mutant', '~> 0.0.1'
|
19
|
-
|
20
|
-
# file system change event handling
|
21
|
-
gem 'listen', '~> 1.3.0'
|
22
|
-
gem 'rb-fchange', '~> 0.0.6', require: false
|
23
|
-
gem 'rb-fsevent', '~> 0.9.3', require: false
|
24
|
-
gem 'rb-inotify', '~> 0.9.0', require: false
|
25
|
-
|
26
|
-
# notification handling
|
27
|
-
gem 'libnotify', '~> 0.8.0', require: false
|
28
|
-
gem 'rb-notifu', '~> 0.0.4', require: false
|
29
|
-
gem 'terminal-notifier-guard', '~> 1.5.3', require: false
|
30
|
-
end
|
31
|
-
|
32
|
-
group :metrics do
|
33
|
-
gem 'coveralls', '~> 0.7.0'
|
34
|
-
gem 'flay', '~> 2.4.0'
|
35
|
-
gem 'flog', '~> 4.1.1'
|
36
|
-
gem 'reek', '~> 1.3.2'
|
37
|
-
gem 'rubocop', '~> 0.14.1'
|
38
|
-
gem 'simplecov', '~> 0.7.1'
|
39
|
-
gem 'yardstick', '~> 0.9.7', git: 'https://github.com/dkubb/yardstick.git'
|
40
|
-
|
41
|
-
platforms :ruby_19, :ruby_20 do
|
42
|
-
gem 'yard-spellcheck', '~> 0.1.5'
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
group :benchmarks do
|
47
|
-
gem 'rbench', '~> 0.2.3'
|
48
|
-
end
|
49
|
-
|
50
|
-
platform :jruby do
|
51
|
-
group :jruby do
|
52
|
-
gem 'jruby-openssl', '~> 0.8.5'
|
53
|
-
end
|
54
|
-
end
|