mutant 0.5.12 → 0.5.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +10 -0
- data/circle.yml +1 -1
- data/config/flay.yml +1 -1
- data/config/flog.yml +1 -1
- data/config/mutant.yml +1 -2
- data/config/reek.yml +12 -3
- data/config/rubocop.yml +4 -0
- data/lib/mutant.rb +45 -16
- data/lib/mutant/constants.rb +11 -11
- data/lib/mutant/delegator.rb +50 -0
- data/lib/mutant/{differ.rb → diff.rb} +5 -5
- data/lib/mutant/killer.rb +29 -106
- data/lib/mutant/matcher/method.rb +2 -11
- data/lib/mutant/mutation.rb +17 -3
- data/lib/mutant/mutation/evil.rb +2 -10
- data/lib/mutant/mutation/neutral.rb +4 -30
- data/lib/mutant/mutator/node/literal/fixnum.rb +0 -1
- data/lib/mutant/mutator/node/literal/float.rb +0 -1
- data/lib/mutant/mutator/node/literal/string.rb +0 -1
- data/lib/mutant/mutator/node/literal/symbol.rb +6 -2
- data/lib/mutant/mutator/node/named_value/variable_assignment.rb +8 -3
- data/lib/mutant/mutator/util/symbol.rb +3 -1
- data/lib/mutant/node_helpers.rb +1 -3
- data/lib/mutant/reporter.rb +10 -0
- data/lib/mutant/reporter/cli.rb +15 -2
- data/lib/mutant/reporter/cli/printer.rb +12 -105
- data/lib/mutant/reporter/cli/progress.rb +12 -0
- data/lib/mutant/reporter/cli/progress/config.rb +32 -0
- data/lib/mutant/reporter/cli/{printer/killer.rb → progress/mutation.rb} +9 -16
- data/lib/mutant/reporter/cli/progress/noop.rb +22 -0
- data/lib/mutant/reporter/cli/progress/subject.rb +118 -0
- data/lib/mutant/reporter/cli/registry.rb +77 -0
- data/lib/mutant/reporter/cli/report.rb +12 -0
- data/lib/mutant/reporter/cli/report/config.rb +118 -0
- data/lib/mutant/reporter/cli/report/mutation.rb +112 -0
- data/lib/mutant/reporter/cli/report/subject.rb +33 -0
- data/lib/mutant/reporter/null.rb +13 -0
- data/lib/mutant/reporter/trace.rb +41 -0
- data/lib/mutant/runner.rb +22 -20
- data/lib/mutant/runner/config.rb +6 -5
- data/lib/mutant/runner/killer.rb +59 -0
- data/lib/mutant/runner/mutation.rb +17 -10
- data/lib/mutant/runner/subject.rb +14 -4
- data/lib/mutant/strategy.rb +30 -16
- data/lib/mutant/subject/method/instance.rb +1 -1
- data/lib/mutant/test.rb +86 -0
- data/lib/mutant/version.rb +1 -1
- data/spec/integration/mutant/null_spec.rb +18 -0
- data/spec/integration/mutant/rspec_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -2
- data/spec/unit/mutant/diff_spec.rb +162 -0
- data/spec/unit/mutant/mutation_spec.rb +8 -5
- data/spec/unit/mutant/mutator/node/and_asgn_spec.rb +1 -9
- data/spec/unit/mutant/mutator/node/block_spec.rb +6 -18
- data/spec/unit/mutant/mutator/node/case_spec.rb +10 -16
- data/spec/unit/mutant/mutator/node/define_spec.rb +5 -17
- data/spec/unit/mutant/mutator/node/dstr_spec.rb +0 -6
- data/spec/unit/mutant/mutator/node/dsym_spec.rb +0 -5
- data/spec/unit/mutant/mutator/node/if_spec.rb +13 -17
- data/spec/unit/mutant/mutator/node/literal/fixnum_spec.rb +1 -7
- data/spec/unit/mutant/mutator/node/literal/float_spec.rb +0 -9
- data/spec/unit/mutant/mutator/node/literal/range_spec.rb +0 -10
- data/spec/unit/mutant/mutator/node/literal/string_spec.rb +1 -5
- data/spec/unit/mutant/mutator/node/literal/symbol_spec.rb +1 -5
- data/spec/unit/mutant/mutator/node/named_value/access_spec.rb +4 -7
- data/spec/unit/mutant/mutator/node/named_value/constant_assignment_spec.rb +1 -5
- data/spec/unit/mutant/mutator/node/named_value/variable_assignment_spec.rb +4 -8
- data/spec/unit/mutant/mutator/node/op_assgn_spec.rb +0 -7
- data/spec/unit/mutant/mutator/node/or_asgn_spec.rb +1 -9
- data/spec/unit/mutant/mutator/node/rescue_spec.rb +0 -4
- data/spec/unit/mutant/reporter/null_spec.rb +11 -0
- data/spec/unit/mutant/runner/config_spec.rb +6 -7
- data/spec/unit/mutant/runner/mutation_spec.rb +101 -0
- data/spec/unit/mutant/runner/subject_spec.rb +10 -7
- data/spec/unit/mutant_spec.rb +53 -0
- metadata +65 -62
- data/lib/mutant/killer/forked.rb +0 -46
- data/lib/mutant/killer/forking.rb +0 -46
- data/lib/mutant/killer/static.rb +0 -34
- data/lib/mutant/mutator/node/literal/dynamic.rb +0 -27
- data/lib/mutant/random.rb +0 -38
- data/lib/mutant/reporter/cli/printer/config.rb +0 -154
- data/lib/mutant/reporter/cli/printer/mutation.rb +0 -103
- data/lib/mutant/reporter/cli/printer/subject.rb +0 -150
- data/spec/unit/mutant/differ/diff_spec.rb +0 -123
- data/spec/unit/mutant/differ_spec.rb +0 -42
- data/spec/unit/mutant/killer/success_predicate_spec.rb +0 -30
- data/spec/unit/mutant/rspec/killer_spec.rb +0 -57
- data/spec/unit/mutant/runner/mutation/killer_spec.rb +0 -44
@@ -25,16 +25,12 @@ describe Mutant::Mutator, 'block' do
|
|
25
25
|
|
26
26
|
let(:source) { 'foo { |a, b| }' }
|
27
27
|
|
28
|
-
before do
|
29
|
-
Mutant::Random.stub(hex_string: 'random')
|
30
|
-
end
|
31
|
-
|
32
28
|
let(:mutations) do
|
33
29
|
mutations = []
|
34
30
|
mutations << 'foo'
|
35
31
|
mutations << 'foo { |a, b| raise }'
|
36
|
-
mutations << 'foo { |a,
|
37
|
-
mutations << 'foo { |
|
32
|
+
mutations << 'foo { |a, b__mutant__| }'
|
33
|
+
mutations << 'foo { |a__mutant__, b| }'
|
38
34
|
mutations << 'foo { |a| }'
|
39
35
|
mutations << 'foo { |b| }'
|
40
36
|
mutations << 'foo { || }'
|
@@ -46,10 +42,6 @@ describe Mutant::Mutator, 'block' do
|
|
46
42
|
|
47
43
|
context 'with block pattern args' do
|
48
44
|
|
49
|
-
before do
|
50
|
-
Mutant::Random.stub(hex_string: 'random')
|
51
|
-
end
|
52
|
-
|
53
45
|
let(:source) { 'foo { |(a, b), c| }' }
|
54
46
|
|
55
47
|
let(:mutations) do
|
@@ -61,9 +53,9 @@ describe Mutant::Mutator, 'block' do
|
|
61
53
|
mutations << 'foo { |(b), c| }'
|
62
54
|
mutations << 'foo { |(a, b)| }'
|
63
55
|
mutations << 'foo { |c| }'
|
64
|
-
mutations << 'foo { |(
|
65
|
-
mutations << 'foo { |(a,
|
66
|
-
mutations << 'foo { |(a, b),
|
56
|
+
mutations << 'foo { |(a__mutant__, b), c| }'
|
57
|
+
mutations << 'foo { |(a, b__mutant__), c| }'
|
58
|
+
mutations << 'foo { |(a, b), c__mutant__| }'
|
67
59
|
mutations << 'foo'
|
68
60
|
mutations << 'nil'
|
69
61
|
end
|
@@ -73,10 +65,6 @@ describe Mutant::Mutator, 'block' do
|
|
73
65
|
|
74
66
|
context 'with mini block pattern arg' do
|
75
67
|
|
76
|
-
before do
|
77
|
-
Mutant::Random.stub(hex_string: 'random')
|
78
|
-
end
|
79
|
-
|
80
68
|
let(:source) { 'foo { |(a)| }' }
|
81
69
|
|
82
70
|
let(:mutations) do
|
@@ -84,7 +72,7 @@ describe Mutant::Mutator, 'block' do
|
|
84
72
|
mutations << 'foo { || }'
|
85
73
|
mutations << 'foo { |a| }'
|
86
74
|
mutations << 'foo { |(a)| raise }'
|
87
|
-
mutations << 'foo { |(
|
75
|
+
mutations << 'foo { |(a__mutant__)| }'
|
88
76
|
mutations << 'foo'
|
89
77
|
mutations << 'nil'
|
90
78
|
end
|
@@ -3,12 +3,6 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Mutant::Mutator::Node::Case do
|
6
|
-
let(:random_string) { 'random' }
|
7
|
-
|
8
|
-
before do
|
9
|
-
Mutant::Random.stub(hex_string: random_string)
|
10
|
-
end
|
11
|
-
|
12
6
|
context 'without condition' do
|
13
7
|
let(:source) do
|
14
8
|
<<-RUBY
|
@@ -97,7 +91,7 @@ describe Mutant::Mutator::Node::Case do
|
|
97
91
|
end
|
98
92
|
RUBY
|
99
93
|
mutations << <<-RUBY
|
100
|
-
case :
|
94
|
+
case :condition__mutant__
|
101
95
|
when :foo
|
102
96
|
when :bar, :baz
|
103
97
|
:barbaz
|
@@ -121,7 +115,7 @@ describe Mutant::Mutator::Node::Case do
|
|
121
115
|
case :condition
|
122
116
|
when :foo
|
123
117
|
when :bar, :baz
|
124
|
-
:
|
118
|
+
:barbaz__mutant__
|
125
119
|
else
|
126
120
|
:else
|
127
121
|
end
|
@@ -141,7 +135,7 @@ describe Mutant::Mutator::Node::Case do
|
|
141
135
|
when :bar, :baz
|
142
136
|
:barbaz
|
143
137
|
else
|
144
|
-
:
|
138
|
+
:else__mutant__
|
145
139
|
end
|
146
140
|
RUBY
|
147
141
|
mutations << <<-RUBY
|
@@ -157,7 +151,7 @@ describe Mutant::Mutator::Node::Case do
|
|
157
151
|
# Mutations of when conditions
|
158
152
|
mutations << <<-RUBY
|
159
153
|
case :condition
|
160
|
-
when :
|
154
|
+
when :foo__mutant__
|
161
155
|
when :bar, :baz
|
162
156
|
:barbaz
|
163
157
|
else
|
@@ -176,7 +170,7 @@ describe Mutant::Mutator::Node::Case do
|
|
176
170
|
mutations << <<-RUBY
|
177
171
|
case :condition
|
178
172
|
when :foo
|
179
|
-
when :
|
173
|
+
when :bar__mutant__, :baz
|
180
174
|
:barbaz
|
181
175
|
else
|
182
176
|
:else
|
@@ -203,7 +197,7 @@ describe Mutant::Mutator::Node::Case do
|
|
203
197
|
mutations << <<-RUBY
|
204
198
|
case :condition
|
205
199
|
when :foo
|
206
|
-
when :bar, :
|
200
|
+
when :bar, :baz__mutant__
|
207
201
|
:barbaz
|
208
202
|
else
|
209
203
|
:else
|
@@ -267,7 +261,7 @@ describe Mutant::Mutator::Node::Case do
|
|
267
261
|
end
|
268
262
|
RUBY
|
269
263
|
mutations << <<-RUBY
|
270
|
-
case :
|
264
|
+
case :condition__mutant__
|
271
265
|
when :foo
|
272
266
|
:foo
|
273
267
|
else
|
@@ -287,7 +281,7 @@ describe Mutant::Mutator::Node::Case do
|
|
287
281
|
mutations << <<-RUBY
|
288
282
|
case :condition
|
289
283
|
when :foo
|
290
|
-
:
|
284
|
+
:foo__mutant__
|
291
285
|
else
|
292
286
|
:else
|
293
287
|
end
|
@@ -297,7 +291,7 @@ describe Mutant::Mutator::Node::Case do
|
|
297
291
|
when :foo
|
298
292
|
:foo
|
299
293
|
else
|
300
|
-
:
|
294
|
+
:else__mutant__
|
301
295
|
end
|
302
296
|
RUBY
|
303
297
|
mutations << <<-RUBY
|
@@ -312,7 +306,7 @@ describe Mutant::Mutator::Node::Case do
|
|
312
306
|
# Mutations of when conditions
|
313
307
|
mutations << <<-RUBY
|
314
308
|
case :condition
|
315
|
-
when :
|
309
|
+
when :foo__mutant__
|
316
310
|
:foo
|
317
311
|
else
|
318
312
|
:else
|
@@ -55,10 +55,6 @@ describe Mutant::Mutator, 'def' do
|
|
55
55
|
context 'with arguments' do
|
56
56
|
let(:source) { 'def foo(a, b); end' }
|
57
57
|
|
58
|
-
before do
|
59
|
-
Mutant::Random.stub(hex_string: 'random')
|
60
|
-
end
|
61
|
-
|
62
58
|
let(:mutations) do
|
63
59
|
mutations = []
|
64
60
|
|
@@ -70,8 +66,8 @@ describe Mutant::Mutator, 'def' do
|
|
70
66
|
mutations << 'def foo; end'
|
71
67
|
|
72
68
|
# Rename each argument
|
73
|
-
mutations << 'def foo(
|
74
|
-
mutations << 'def foo(a,
|
69
|
+
mutations << 'def foo(a__mutant__, b); end'
|
70
|
+
mutations << 'def foo(a, b__mutant__); end'
|
75
71
|
|
76
72
|
# Mutation of body
|
77
73
|
mutations << 'def foo(a, b); raise; end'
|
@@ -110,17 +106,13 @@ describe Mutant::Mutator, 'def' do
|
|
110
106
|
context 'default argument' do
|
111
107
|
let(:source) { 'def foo(a = true); end' }
|
112
108
|
|
113
|
-
before do
|
114
|
-
Mutant::Random.stub(hex_string: 'random')
|
115
|
-
end
|
116
|
-
|
117
109
|
let(:mutations) do
|
118
110
|
mutations = []
|
119
111
|
mutations << 'def foo(a); end'
|
120
112
|
mutations << 'def foo(); end'
|
121
113
|
mutations << 'def foo(a = false); end'
|
122
114
|
mutations << 'def foo(a = nil); end'
|
123
|
-
mutations << 'def foo(
|
115
|
+
mutations << 'def foo(a__mutant__ = true); end'
|
124
116
|
mutations << 'def foo(a = true); raise; end'
|
125
117
|
end
|
126
118
|
|
@@ -154,10 +146,6 @@ describe Mutant::Mutator, 'def' do
|
|
154
146
|
|
155
147
|
context 'define on singleton with argument' do
|
156
148
|
|
157
|
-
before do
|
158
|
-
Mutant::Random.stub(hex_string: 'random')
|
159
|
-
end
|
160
|
-
|
161
149
|
let(:source) { 'def self.foo(a, b); end' }
|
162
150
|
|
163
151
|
let(:mutations) do
|
@@ -171,8 +159,8 @@ describe Mutant::Mutator, 'def' do
|
|
171
159
|
mutations << 'def self.foo; end'
|
172
160
|
|
173
161
|
# Rename each argument
|
174
|
-
mutations << 'def self.foo(
|
175
|
-
mutations << 'def self.foo(a,
|
162
|
+
mutations << 'def self.foo(a__mutant__, b); end'
|
163
|
+
mutations << 'def self.foo(a, b__mutant__); end'
|
176
164
|
|
177
165
|
# Mutation of body
|
178
166
|
mutations << 'def self.foo(a, b); raise; end'
|
@@ -3,17 +3,11 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Mutant::Mutator::Node::Dstr, 'dstr' do
|
6
|
-
before do
|
7
|
-
Mutant::Random.stub(hex_string: 'random')
|
8
|
-
end
|
9
|
-
|
10
6
|
let(:source) { '"foo#{bar}baz"' }
|
11
7
|
|
12
8
|
let(:mutations) do
|
13
9
|
mutations = []
|
14
|
-
mutations << '"random#{bar}baz"'
|
15
10
|
mutations << '"#{nil}#{bar}baz"'
|
16
|
-
mutations << '"foo#{bar}random"'
|
17
11
|
mutations << '"foo#{bar}#{nil}"'
|
18
12
|
mutations << '"foo#{nil}baz"'
|
19
13
|
mutations << 'nil'
|
@@ -3,17 +3,12 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Mutant::Mutator::Node::Dsym, 'dsym' do
|
6
|
-
before do
|
7
|
-
Mutant::Random.stub(hex_string: 'random')
|
8
|
-
end
|
9
6
|
|
10
7
|
let(:source) { ':"foo#{bar}baz"' }
|
11
8
|
|
12
9
|
let(:mutations) do
|
13
10
|
mutations = []
|
14
|
-
mutations << ':"random#{bar}baz"'
|
15
11
|
mutations << ':"#{nil}#{bar}baz"'
|
16
|
-
mutations << ':"foo#{bar}random"'
|
17
12
|
mutations << ':"foo#{bar}#{nil}"'
|
18
13
|
mutations << ':"foo#{nil}baz"'
|
19
14
|
mutations << 'nil'
|
@@ -3,10 +3,6 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Mutant::Mutator, 'if' do
|
6
|
-
before do
|
7
|
-
Mutant::Random.stub(hex_string: 'random')
|
8
|
-
end
|
9
|
-
|
10
6
|
context 'with if and else branches' do
|
11
7
|
let(:source) { 'if :condition; true; else false; end' }
|
12
8
|
|
@@ -14,11 +10,11 @@ describe Mutant::Mutator, 'if' do
|
|
14
10
|
mutants = []
|
15
11
|
|
16
12
|
# mutations of condition
|
17
|
-
mutants << 'if :
|
18
|
-
mutants << 'if !:condition;
|
19
|
-
mutants << 'if nil;
|
20
|
-
mutants << 'if true;
|
21
|
-
mutants << 'if false;
|
13
|
+
mutants << 'if :condition__mutant__; true; else false; end'
|
14
|
+
mutants << 'if !:condition; true; else false; end'
|
15
|
+
mutants << 'if nil; true; else false; end'
|
16
|
+
mutants << 'if true; true; else false; end'
|
17
|
+
mutants << 'if false; true; else false; end'
|
22
18
|
|
23
19
|
# Deleted else branch
|
24
20
|
mutants << 'if :condition; true end'
|
@@ -65,14 +61,14 @@ describe Mutant::Mutator, 'if' do
|
|
65
61
|
|
66
62
|
let(:mutations) do
|
67
63
|
mutants = []
|
68
|
-
mutants << 'unless !:condition;
|
69
|
-
mutants << 'unless :
|
70
|
-
mutants << 'unless nil;
|
71
|
-
mutants << 'unless :condition;
|
72
|
-
mutants << 'unless :condition;
|
73
|
-
mutants << 'unless true;
|
74
|
-
mutants << 'unless false;
|
75
|
-
mutants << 'if :condition;
|
64
|
+
mutants << 'unless !:condition; true; end'
|
65
|
+
mutants << 'unless :condition__mutant__; true; end'
|
66
|
+
mutants << 'unless nil; true; end'
|
67
|
+
mutants << 'unless :condition; false; end'
|
68
|
+
mutants << 'unless :condition; nil; end'
|
69
|
+
mutants << 'unless true; true; end'
|
70
|
+
mutants << 'unless false; true; end'
|
71
|
+
mutants << 'if :condition; true; end'
|
76
72
|
mutants << 'nil'
|
77
73
|
end
|
78
74
|
|
@@ -3,16 +3,10 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Mutant::Mutator::Node::Literal, 'fixnum' do
|
6
|
-
let(:random_fixnum) { 5 }
|
7
|
-
|
8
6
|
let(:source) { '10' }
|
9
7
|
|
10
8
|
let(:mutations) do
|
11
|
-
%W(nil 0 1
|
12
|
-
end
|
13
|
-
|
14
|
-
before do
|
15
|
-
Mutant::Random.stub(fixnum: random_fixnum)
|
9
|
+
%W(nil 0 1 -10 9 11)
|
16
10
|
end
|
17
11
|
|
18
12
|
it_should_behave_like 'a mutator'
|
@@ -4,12 +4,6 @@ require 'spec_helper'
|
|
4
4
|
|
5
5
|
describe Mutant::Mutator::Node::Literal, 'float' do
|
6
6
|
|
7
|
-
before do
|
8
|
-
Mutant::Random.stub(float: random_float)
|
9
|
-
end
|
10
|
-
|
11
|
-
let(:random_float) { 7.123 }
|
12
|
-
|
13
7
|
context 'positive number' do
|
14
8
|
let(:source) { '10.0' }
|
15
9
|
|
@@ -18,7 +12,6 @@ describe Mutant::Mutator::Node::Literal, 'float' do
|
|
18
12
|
mutations << 'nil'
|
19
13
|
mutations << '0.0'
|
20
14
|
mutations << '1.0'
|
21
|
-
mutations << random_float.to_s
|
22
15
|
mutations << '(0.0 / 0.0)'
|
23
16
|
mutations << '(1.0 / 0.0)'
|
24
17
|
mutations << '(-1.0 / 0.0)'
|
@@ -35,7 +28,6 @@ describe Mutant::Mutator::Node::Literal, 'float' do
|
|
35
28
|
mutations = []
|
36
29
|
mutations << 'nil'
|
37
30
|
mutations << '1.0'
|
38
|
-
mutations << random_float.to_s
|
39
31
|
mutations << '(0.0 / 0.0)'
|
40
32
|
mutations << '(1.0 / 0.0)'
|
41
33
|
mutations << '(-1.0 / 0.0)'
|
@@ -51,7 +43,6 @@ describe Mutant::Mutator::Node::Literal, 'float' do
|
|
51
43
|
mutations = []
|
52
44
|
mutations << 'nil'
|
53
45
|
mutations << '1.0'
|
54
|
-
mutations << random_float.to_s
|
55
46
|
mutations << '(0.0 / 0.0)'
|
56
47
|
mutations << '(1.0 / 0.0)'
|
57
48
|
mutations << '(-1.0 / 0.0)'
|
@@ -4,12 +4,6 @@ require 'spec_helper'
|
|
4
4
|
|
5
5
|
describe Mutant::Mutator::Node::Literal, 'range' do
|
6
6
|
|
7
|
-
before :each do
|
8
|
-
Mutant::Random.stub(fixnum: random_fixnum)
|
9
|
-
end
|
10
|
-
|
11
|
-
let(:random_fixnum) { 5 }
|
12
|
-
|
13
7
|
context 'inclusive range literal' do
|
14
8
|
let(:source) { '1..100' }
|
15
9
|
|
@@ -21,7 +15,6 @@ describe Mutant::Mutator::Node::Literal, 'range' do
|
|
21
15
|
mutations << '1..(1.0 / 0.0)'
|
22
16
|
mutations << '1..(0.0 / 0.0)'
|
23
17
|
mutations << '-1..100'
|
24
|
-
mutations << '5..100'
|
25
18
|
mutations << '0..100'
|
26
19
|
mutations << '2..100'
|
27
20
|
mutations << 'nil..100'
|
@@ -31,7 +24,6 @@ describe Mutant::Mutator::Node::Literal, 'range' do
|
|
31
24
|
mutations << '1..99'
|
32
25
|
mutations << '1..101'
|
33
26
|
mutations << '1..-100'
|
34
|
-
mutations << '1..5'
|
35
27
|
end
|
36
28
|
|
37
29
|
it_should_behave_like 'a mutator'
|
@@ -48,7 +40,6 @@ describe Mutant::Mutator::Node::Literal, 'range' do
|
|
48
40
|
mutations << '1...(1.0 / 0.0)'
|
49
41
|
mutations << '1...(0.0 / 0.0)'
|
50
42
|
mutations << '-1...100'
|
51
|
-
mutations << '5...100'
|
52
43
|
mutations << '0...100'
|
53
44
|
mutations << '2...100'
|
54
45
|
mutations << 'nil...100'
|
@@ -58,7 +49,6 @@ describe Mutant::Mutator::Node::Literal, 'range' do
|
|
58
49
|
mutations << '1...99'
|
59
50
|
mutations << '1...101'
|
60
51
|
mutations << '1...-100'
|
61
|
-
mutations << '1...5'
|
62
52
|
end
|
63
53
|
|
64
54
|
it_should_behave_like 'a mutator'
|
@@ -8,11 +8,7 @@ describe Mutant::Mutator::Node::Literal, 'string' do
|
|
8
8
|
let(:source) { '"foo"' }
|
9
9
|
|
10
10
|
let(:mutations) do
|
11
|
-
%W(nil
|
12
|
-
end
|
13
|
-
|
14
|
-
before do
|
15
|
-
Mutant::Random.stub(hex_string: random_string)
|
11
|
+
%W(nil)
|
16
12
|
end
|
17
13
|
|
18
14
|
it_should_behave_like 'a mutator'
|
@@ -8,11 +8,7 @@ describe Mutant::Mutator::Node::Literal, 'symbol' do
|
|
8
8
|
let(:source) { ':foo' }
|
9
9
|
|
10
10
|
let(:mutations) do
|
11
|
-
%w(nil) <<
|
12
|
-
end
|
13
|
-
|
14
|
-
before do
|
15
|
-
Mutant::Random.stub(hex_string: random_string)
|
11
|
+
%w(nil) << ':foo__mutant__'
|
16
12
|
end
|
17
13
|
|
18
14
|
it_should_behave_like 'a mutator'
|
@@ -3,9 +3,6 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Mutant::Mutator::Node::NamedValue::Access, 'mutations' do
|
6
|
-
before do
|
7
|
-
Mutant::Random.stub(hex_string: 'random')
|
8
|
-
end
|
9
6
|
|
10
7
|
context 'global variable' do
|
11
8
|
let(:source) { '$a = nil; $a' }
|
@@ -15,7 +12,7 @@ describe Mutant::Mutator::Node::NamedValue::Access, 'mutations' do
|
|
15
12
|
mutants << '$a = nil; nil'
|
16
13
|
mutants << '$a = nil'
|
17
14
|
mutants << '$a'
|
18
|
-
mutants << '$
|
15
|
+
mutants << '$a__mutant__ = nil; $a'
|
19
16
|
mutants << 'nil; $a'
|
20
17
|
end
|
21
18
|
|
@@ -30,7 +27,7 @@ describe Mutant::Mutator::Node::NamedValue::Access, 'mutations' do
|
|
30
27
|
mutants << '@@a = nil; nil'
|
31
28
|
mutants << '@@a = nil'
|
32
29
|
mutants << '@@a'
|
33
|
-
mutants << '@@
|
30
|
+
mutants << '@@a__mutant__ = nil; @@a'
|
34
31
|
mutants << 'nil; @@a'
|
35
32
|
end
|
36
33
|
end
|
@@ -43,7 +40,7 @@ describe Mutant::Mutator::Node::NamedValue::Access, 'mutations' do
|
|
43
40
|
mutants << '@a = nil; nil'
|
44
41
|
mutants << '@a = nil'
|
45
42
|
mutants << '@a'
|
46
|
-
mutants << '@
|
43
|
+
mutants << '@a__mutant__ = nil; @a'
|
47
44
|
mutants << 'nil; @a'
|
48
45
|
end
|
49
46
|
|
@@ -60,7 +57,7 @@ describe Mutant::Mutator::Node::NamedValue::Access, 'mutations' do
|
|
60
57
|
# TODO: fix invalid AST
|
61
58
|
# These ASTs are not valid and should NOT be emitted
|
62
59
|
# Mutations of lvarasgn need to be special cased to avoid this.
|
63
|
-
mutants << s(:begin, s(:lvasgn, :
|
60
|
+
mutants << s(:begin, s(:lvasgn, :a__mutant__, s(:nil)), s(:lvar, :a))
|
64
61
|
mutants << s(:begin, s(:nil), s(:lvar, :a))
|
65
62
|
mutants << s(:lvar, :a)
|
66
63
|
end
|