mutant 0.5.17 → 0.5.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +6 -0
- data/Rakefile +13 -0
- data/config/flay.yml +1 -1
- data/config/reek.yml +8 -1
- data/lib/mutant.rb +18 -3
- data/lib/mutant/cli.rb +6 -3
- data/lib/mutant/constants.rb +3 -0
- data/lib/mutant/expression.rb +110 -0
- data/lib/mutant/expression/method.rb +92 -0
- data/lib/mutant/expression/namespace.rb +90 -0
- data/lib/mutant/matcher/namespace.rb +3 -4
- data/lib/mutant/meta.rb +31 -0
- data/lib/mutant/meta/example.rb +152 -0
- data/lib/mutant/meta/example/dsl.rb +105 -0
- data/lib/mutant/mutator/node.rb +6 -6
- data/lib/mutant/mutator/node/arguments.rb +1 -1
- data/lib/mutant/mutator/node/begin.rb +1 -1
- data/lib/mutant/mutator/node/const.rb +1 -1
- data/lib/mutant/mutator/node/if.rb +6 -6
- data/lib/mutant/mutator/node/literal/array.rb +2 -2
- data/lib/mutant/mutator/node/literal/hash.rb +2 -2
- data/lib/mutant/mutator/node/literal/range.rb +3 -3
- data/lib/mutant/mutator/node/literal/regex.rb +2 -2
- data/lib/mutant/mutator/node/literal/symbol.rb +1 -1
- data/lib/mutant/mutator/node/op_asgn.rb +1 -3
- data/lib/mutant/mutator/node/or_asgn.rb +31 -0
- data/lib/mutant/mutator/node/send.rb +1 -1
- data/lib/mutant/mutator/node/send/attribute_assignment.rb +1 -1
- data/lib/mutant/reporter/cli/report/mutation.rb +11 -1
- data/lib/mutant/strategy.rb +1 -1
- data/lib/mutant/version.rb +1 -1
- data/meta/and.rb +12 -0
- data/meta/and_asgn.rb +12 -0
- data/meta/array.rb +30 -0
- data/meta/begin.rb +15 -0
- data/meta/binary.rb +12 -0
- data/meta/block.rb +55 -0
- data/meta/block_pass.rb +8 -0
- data/meta/blockarg.rb +10 -0
- data/meta/boolean.rb +15 -0
- data/meta/break.rb +11 -0
- data/meta/case.rb +303 -0
- data/meta/casgn.rb +9 -0
- data/meta/cbase.rb +8 -0
- data/meta/const.rb +9 -0
- data/meta/cvar.rb +7 -0
- data/meta/cvasgn.rb +10 -0
- data/meta/define.rb +118 -0
- data/meta/defined.rb +7 -0
- data/meta/dstr.rb +10 -0
- data/meta/dsym.rb +11 -0
- data/meta/ensure.rb +9 -0
- data/meta/fixnum.rb +19 -0
- data/meta/float.rb +38 -0
- data/meta/gvar.rb +7 -0
- data/meta/gvasgn.rb +10 -0
- data/meta/hash.rb +25 -0
- data/meta/if.rb +57 -0
- data/meta/ivasgn.rb +10 -0
- data/meta/kwbegin.rb +9 -0
- data/meta/lvar.rb +14 -0
- data/meta/lvasgn.rb +10 -0
- data/meta/masgn.rb +7 -0
- data/meta/match_current_line.rb +14 -0
- data/meta/next.rb +11 -0
- data/meta/nil.rb +5 -0
- data/meta/nthref.rb +14 -0
- data/meta/op_assgn.rb +15 -0
- data/meta/or_asgn.rb +22 -0
- data/meta/range.rb +41 -0
- data/meta/redo.rb +5 -0
- data/meta/regex.rb +20 -0
- data/meta/rescue.rb +38 -0
- data/meta/restarg.rb +11 -0
- data/meta/return.rb +15 -0
- data/meta/self.rb +7 -0
- data/meta/send.rb +240 -0
- data/meta/string.rb +7 -0
- data/meta/super.rb +26 -0
- data/meta/symbol.rb +8 -0
- data/meta/unless.rb +15 -0
- data/meta/while.rb +24 -0
- data/meta/yield.rb +10 -0
- data/mutant.gemspec +1 -0
- data/spec/integration/mutant/corpus_spec.rb +29 -25
- data/spec/spec_helper.rb +2 -0
- data/spec/support/mutation_verifier.rb +1 -0
- data/spec/unit/mutant/cli_new_spec.rb +6 -6
- data/spec/unit/mutant/expression/method_spec.rb +50 -0
- data/spec/unit/mutant/expression/namespace/flat_spec.rb +32 -0
- data/spec/unit/mutant/expression/namespace/recursive_spec.rb +37 -0
- data/spec/unit/mutant/matcher/namespace_spec.rb +2 -2
- data/spec/unit/mutant/mutation_spec.rb +1 -1
- data/spec/unit/mutant/mutator/node_spec.rb +14 -0
- metadata +123 -139
- data/lib/mutant/cli/classifier.rb +0 -139
- data/lib/mutant/cli/classifier/method.rb +0 -105
- data/lib/mutant/cli/classifier/namespace.rb +0 -49
- data/spec/unit/mutant/cli/classifier/method_spec.rb +0 -77
- data/spec/unit/mutant/cli/classifier/namespace/flat_spec.rb +0 -58
- data/spec/unit/mutant/cli/classifier/namespace/recursive_spec.rb +0 -58
- data/spec/unit/mutant/cli/classifier_spec.rb +0 -59
- data/spec/unit/mutant/mutator/node/and_asgn_spec.rb +0 -19
- data/spec/unit/mutant/mutator/node/begin_spec.rb +0 -32
- data/spec/unit/mutant/mutator/node/binary_spec.rb +0 -41
- data/spec/unit/mutant/mutator/node/block_pass_spec.rb +0 -15
- data/spec/unit/mutant/mutator/node/block_spec.rb +0 -83
- data/spec/unit/mutant/mutator/node/blockarg_spec.rb +0 -17
- data/spec/unit/mutant/mutator/node/case_spec.rb +0 -329
- data/spec/unit/mutant/mutator/node/cbase_spec.rb +0 -15
- data/spec/unit/mutant/mutator/node/conditional_loop_spec.rb +0 -58
- data/spec/unit/mutant/mutator/node/const_spec.rb +0 -16
- data/spec/unit/mutant/mutator/node/define_spec.rb +0 -171
- data/spec/unit/mutant/mutator/node/defined_spec.rb +0 -14
- data/spec/unit/mutant/mutator/node/dstr_spec.rb +0 -17
- data/spec/unit/mutant/mutator/node/dsym_spec.rb +0 -18
- data/spec/unit/mutant/mutator/node/ensure_spec.rb +0 -16
- data/spec/unit/mutant/mutator/node/if_spec.rb +0 -77
- data/spec/unit/mutant/mutator/node/kwbegin_spec.rb +0 -16
- data/spec/unit/mutant/mutator/node/literal/array_spec.rb +0 -47
- data/spec/unit/mutant/mutator/node/literal/boolean_spec.rb +0 -25
- data/spec/unit/mutant/mutator/node/literal/fixnum_spec.rb +0 -13
- data/spec/unit/mutant/mutator/node/literal/float_spec.rb +0 -53
- data/spec/unit/mutant/mutator/node/literal/hash_spec.rb +0 -33
- data/spec/unit/mutant/mutator/node/literal/nil_spec.rb +0 -10
- data/spec/unit/mutant/mutator/node/literal/range_spec.rb +0 -56
- data/spec/unit/mutant/mutator/node/literal/regex_spec.rb +0 -36
- data/spec/unit/mutant/mutator/node/literal/string_spec.rb +0 -15
- data/spec/unit/mutant/mutator/node/literal/symbol_spec.rb +0 -15
- data/spec/unit/mutant/mutator/node/loop_ctrl_spec.rb +0 -37
- data/spec/unit/mutant/mutator/node/masgn_spec.rb +0 -14
- data/spec/unit/mutant/mutator/node/match_current_line_spec.rb +0 -21
- data/spec/unit/mutant/mutator/node/named_value/access_spec.rb +0 -78
- data/spec/unit/mutant/mutator/node/named_value/constant_assignment_spec.rb +0 -16
- data/spec/unit/mutant/mutator/node/named_value/variable_assignment_spec.rb +0 -61
- data/spec/unit/mutant/mutator/node/nthref_spec.rb +0 -19
- data/spec/unit/mutant/mutator/node/op_assgn_spec.rb +0 -22
- data/spec/unit/mutant/mutator/node/or_asgn_spec.rb +0 -19
- data/spec/unit/mutant/mutator/node/redo_spec.rb +0 -10
- data/spec/unit/mutant/mutator/node/rescue_spec.rb +0 -63
- data/spec/unit/mutant/mutator/node/restarg_spec.rb +0 -18
- data/spec/unit/mutant/mutator/node/return_spec.rb +0 -31
- data/spec/unit/mutant/mutator/node/send_spec.rb +0 -382
- data/spec/unit/mutant/mutator/node/super_spec.rb +0 -46
- data/spec/unit/mutant/mutator/node/yield_spec.rb +0 -17
@@ -19,7 +19,7 @@ module Mutant
|
|
19
19
|
#
|
20
20
|
def dispatch
|
21
21
|
emit_nil
|
22
|
-
|
22
|
+
emit_type
|
23
23
|
mutate_body
|
24
24
|
end
|
25
25
|
|
@@ -34,7 +34,7 @@ module Mutant
|
|
34
34
|
mutate_child(index)
|
35
35
|
dup_children = children.dup
|
36
36
|
dup_children.delete_at(index)
|
37
|
-
|
37
|
+
emit_type(*dup_children)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -50,7 +50,7 @@ module Mutant
|
|
50
50
|
#
|
51
51
|
def emit_upper_bound_mutations
|
52
52
|
emit__end_mutations
|
53
|
-
|
53
|
+
emit_type(NAN, _end)
|
54
54
|
end
|
55
55
|
|
56
56
|
# Emit start mutations
|
@@ -61,8 +61,8 @@ module Mutant
|
|
61
61
|
#
|
62
62
|
def emit_lower_bound_mutations
|
63
63
|
emit_start_mutations
|
64
|
-
|
65
|
-
|
64
|
+
emit_type(start, INFINITY)
|
65
|
+
emit_type(start, NAN)
|
66
66
|
end
|
67
67
|
|
68
68
|
end # Range
|
@@ -35,8 +35,8 @@ module Mutant
|
|
35
35
|
children.each_with_index do |child, index|
|
36
36
|
mutate_child(index) unless child.type == :str
|
37
37
|
end
|
38
|
-
|
39
|
-
|
38
|
+
emit_type(options)
|
39
|
+
emit_type(s(:str, NULL_REGEXP_SOURCE), options)
|
40
40
|
end
|
41
41
|
|
42
42
|
end # Regex
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Mutant
|
4
|
+
class Mutator
|
5
|
+
class Node
|
6
|
+
|
7
|
+
# OpAsgn mutator
|
8
|
+
class OrAsgn < self
|
9
|
+
|
10
|
+
handle(:or_asgn)
|
11
|
+
|
12
|
+
children :left, :right
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
# Emit mutations
|
17
|
+
#
|
18
|
+
# @return [undefined]
|
19
|
+
#
|
20
|
+
# @api private
|
21
|
+
#
|
22
|
+
def dispatch
|
23
|
+
emit_nil
|
24
|
+
emit_left_mutations unless left.type.equal?(:ivasgn)
|
25
|
+
emit_right_mutations
|
26
|
+
end
|
27
|
+
|
28
|
+
end # OrAsgn
|
29
|
+
end # Node
|
30
|
+
end # Mutator
|
31
|
+
end # Mutant
|
@@ -99,12 +99,22 @@ module Mutant
|
|
99
99
|
#
|
100
100
|
def report_noop
|
101
101
|
info('NOOP MUTATION TESTS FAILED!')
|
102
|
-
|
102
|
+
noop_reports.each do |report|
|
103
103
|
puts(report.test.identification)
|
104
104
|
puts(report.output)
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
+
# Return test noop reports
|
109
|
+
#
|
110
|
+
# @return [Enumerable<Test::Report>]
|
111
|
+
#
|
112
|
+
# @api private
|
113
|
+
#
|
114
|
+
def noop_reports
|
115
|
+
killers.reject(&:success?).map(&:report).map(&:test_report)
|
116
|
+
end
|
117
|
+
|
108
118
|
end # Mutation
|
109
119
|
end # Report
|
110
120
|
end # CLI
|
data/lib/mutant/strategy.rb
CHANGED
data/lib/mutant/version.rb
CHANGED
data/meta/and.rb
ADDED
data/meta/and_asgn.rb
ADDED
data/meta/array.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
Mutant::Meta::Example.add do
|
4
|
+
source '[true]'
|
5
|
+
|
6
|
+
mutation 'nil'
|
7
|
+
mutation 'true'
|
8
|
+
mutation '[false]'
|
9
|
+
mutation '[nil]'
|
10
|
+
mutation '[]'
|
11
|
+
end
|
12
|
+
|
13
|
+
Mutant::Meta::Example.add do
|
14
|
+
source '[true, false]'
|
15
|
+
|
16
|
+
mutation 'nil'
|
17
|
+
|
18
|
+
# Mutation of each element in array
|
19
|
+
mutation '[nil, false]'
|
20
|
+
mutation '[false, false]'
|
21
|
+
mutation '[true, nil]'
|
22
|
+
mutation '[true, true]'
|
23
|
+
|
24
|
+
# Remove each element of array once
|
25
|
+
mutation '[true]'
|
26
|
+
mutation '[false]'
|
27
|
+
|
28
|
+
# Empty array
|
29
|
+
mutation '[]'
|
30
|
+
end
|
data/meta/begin.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
Mutant::Meta::Example.add do
|
4
|
+
|
5
|
+
source 'true; false'
|
6
|
+
# Mutation of each statement in block
|
7
|
+
mutation 'true; true'
|
8
|
+
mutation 'false; false'
|
9
|
+
mutation 'nil; false'
|
10
|
+
mutation 'true; nil'
|
11
|
+
|
12
|
+
# Delete each statement
|
13
|
+
mutation 'true'
|
14
|
+
mutation 'false'
|
15
|
+
end
|
data/meta/binary.rb
ADDED
data/meta/block.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
Mutant::Meta::Example.add do
|
4
|
+
source 'foo() { a; b }'
|
5
|
+
|
6
|
+
mutation 'foo { a }'
|
7
|
+
mutation 'foo { b }'
|
8
|
+
mutation 'foo {}'
|
9
|
+
mutation 'foo { raise }'
|
10
|
+
mutation 'foo { a; nil }'
|
11
|
+
mutation 'foo { nil; b }'
|
12
|
+
mutation 'foo'
|
13
|
+
mutation 'nil'
|
14
|
+
end
|
15
|
+
|
16
|
+
Mutant::Meta::Example.add do
|
17
|
+
source 'foo { |a, b| }'
|
18
|
+
|
19
|
+
mutation 'foo'
|
20
|
+
mutation 'foo { |a, b| raise }'
|
21
|
+
mutation 'foo { |a, b__mutant__| }'
|
22
|
+
mutation 'foo { |a__mutant__, b| }'
|
23
|
+
mutation 'foo { |a| }'
|
24
|
+
mutation 'foo { |b| }'
|
25
|
+
mutation 'foo { || }'
|
26
|
+
mutation 'nil'
|
27
|
+
end
|
28
|
+
|
29
|
+
Mutant::Meta::Example.add do
|
30
|
+
source 'foo { |(a, b), c| }'
|
31
|
+
|
32
|
+
mutation 'nil'
|
33
|
+
mutation 'foo { || }'
|
34
|
+
mutation 'foo { |a, b, c| }'
|
35
|
+
mutation 'foo { |(a, b), c| raise }'
|
36
|
+
mutation 'foo { |(a), c| }'
|
37
|
+
mutation 'foo { |(b), c| }'
|
38
|
+
mutation 'foo { |(a, b)| }'
|
39
|
+
mutation 'foo { |c| }'
|
40
|
+
mutation 'foo { |(a__mutant__, b), c| }'
|
41
|
+
mutation 'foo { |(a, b__mutant__), c| }'
|
42
|
+
mutation 'foo { |(a, b), c__mutant__| }'
|
43
|
+
mutation 'foo'
|
44
|
+
end
|
45
|
+
|
46
|
+
Mutant::Meta::Example.add do
|
47
|
+
source 'foo { |(a)| }'
|
48
|
+
|
49
|
+
mutation 'foo { || }'
|
50
|
+
mutation 'foo { |a| }'
|
51
|
+
mutation 'foo { |(a)| raise }'
|
52
|
+
mutation 'foo { |(a__mutant__)| }'
|
53
|
+
mutation 'foo'
|
54
|
+
mutation 'nil'
|
55
|
+
end
|
data/meta/block_pass.rb
ADDED
data/meta/blockarg.rb
ADDED
data/meta/boolean.rb
ADDED
data/meta/break.rb
ADDED
data/meta/case.rb
ADDED
@@ -0,0 +1,303 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
Mutant::Meta::Example.add do
|
4
|
+
source <<-RUBY
|
5
|
+
case
|
6
|
+
when true
|
7
|
+
else
|
8
|
+
end
|
9
|
+
RUBY
|
10
|
+
|
11
|
+
mutation 'nil'
|
12
|
+
|
13
|
+
mutation <<-RUBY
|
14
|
+
case
|
15
|
+
when true
|
16
|
+
raise
|
17
|
+
else
|
18
|
+
end
|
19
|
+
RUBY
|
20
|
+
mutation <<-RUBY
|
21
|
+
case
|
22
|
+
when false
|
23
|
+
else
|
24
|
+
end
|
25
|
+
RUBY
|
26
|
+
mutation <<-RUBY
|
27
|
+
case
|
28
|
+
when nil
|
29
|
+
else
|
30
|
+
end
|
31
|
+
RUBY
|
32
|
+
end
|
33
|
+
|
34
|
+
Mutant::Meta::Example.add do
|
35
|
+
source <<-RUBY
|
36
|
+
case :condition
|
37
|
+
when :foo
|
38
|
+
when :bar, :baz
|
39
|
+
:barbaz
|
40
|
+
else
|
41
|
+
:else
|
42
|
+
end
|
43
|
+
RUBY
|
44
|
+
|
45
|
+
# Presence of branches
|
46
|
+
mutation <<-RUBY
|
47
|
+
case :condition
|
48
|
+
when :bar, :baz
|
49
|
+
:barbaz
|
50
|
+
else
|
51
|
+
:else
|
52
|
+
end
|
53
|
+
RUBY
|
54
|
+
mutation <<-RUBY
|
55
|
+
case :condition
|
56
|
+
when :foo
|
57
|
+
else
|
58
|
+
:else
|
59
|
+
end
|
60
|
+
RUBY
|
61
|
+
mutation <<-RUBY
|
62
|
+
case :condition
|
63
|
+
when :foo
|
64
|
+
when :bar, :baz
|
65
|
+
:barbaz
|
66
|
+
end
|
67
|
+
RUBY
|
68
|
+
|
69
|
+
# Mutations of condition
|
70
|
+
mutation <<-RUBY
|
71
|
+
case nil
|
72
|
+
when :foo
|
73
|
+
when :bar, :baz
|
74
|
+
:barbaz
|
75
|
+
else
|
76
|
+
:else
|
77
|
+
end
|
78
|
+
RUBY
|
79
|
+
mutation <<-RUBY
|
80
|
+
case :condition__mutant__
|
81
|
+
when :foo
|
82
|
+
when :bar, :baz
|
83
|
+
:barbaz
|
84
|
+
else
|
85
|
+
:else
|
86
|
+
end
|
87
|
+
RUBY
|
88
|
+
|
89
|
+
# Mutations of branch bodies
|
90
|
+
mutation <<-RUBY
|
91
|
+
case :condition
|
92
|
+
when :foo
|
93
|
+
raise
|
94
|
+
when :bar, :baz
|
95
|
+
:barbaz
|
96
|
+
else
|
97
|
+
:else
|
98
|
+
end
|
99
|
+
RUBY
|
100
|
+
mutation <<-RUBY
|
101
|
+
case :condition
|
102
|
+
when :foo
|
103
|
+
when :bar, :baz
|
104
|
+
:barbaz__mutant__
|
105
|
+
else
|
106
|
+
:else
|
107
|
+
end
|
108
|
+
RUBY
|
109
|
+
mutation <<-RUBY
|
110
|
+
case :condition
|
111
|
+
when :foo
|
112
|
+
when :bar, :baz
|
113
|
+
nil
|
114
|
+
else
|
115
|
+
:else
|
116
|
+
end
|
117
|
+
RUBY
|
118
|
+
mutation <<-RUBY
|
119
|
+
case :condition
|
120
|
+
when :foo
|
121
|
+
when :bar, :baz
|
122
|
+
:barbaz
|
123
|
+
else
|
124
|
+
:else__mutant__
|
125
|
+
end
|
126
|
+
RUBY
|
127
|
+
mutation <<-RUBY
|
128
|
+
case :condition
|
129
|
+
when :foo
|
130
|
+
when :bar, :baz
|
131
|
+
:barbaz
|
132
|
+
else
|
133
|
+
nil
|
134
|
+
end
|
135
|
+
RUBY
|
136
|
+
|
137
|
+
# Mutations of when conditions
|
138
|
+
mutation <<-RUBY
|
139
|
+
case :condition
|
140
|
+
when :foo__mutant__
|
141
|
+
when :bar, :baz
|
142
|
+
:barbaz
|
143
|
+
else
|
144
|
+
:else
|
145
|
+
end
|
146
|
+
RUBY
|
147
|
+
mutation <<-RUBY
|
148
|
+
case :condition
|
149
|
+
when nil
|
150
|
+
when :bar, :baz
|
151
|
+
:barbaz
|
152
|
+
else
|
153
|
+
:else
|
154
|
+
end
|
155
|
+
RUBY
|
156
|
+
mutation <<-RUBY
|
157
|
+
case :condition
|
158
|
+
when :foo
|
159
|
+
when :bar__mutant__, :baz
|
160
|
+
:barbaz
|
161
|
+
else
|
162
|
+
:else
|
163
|
+
end
|
164
|
+
RUBY
|
165
|
+
mutation <<-RUBY
|
166
|
+
case :condition
|
167
|
+
when :foo
|
168
|
+
when nil, :baz
|
169
|
+
:barbaz
|
170
|
+
else
|
171
|
+
:else
|
172
|
+
end
|
173
|
+
RUBY
|
174
|
+
mutation <<-RUBY
|
175
|
+
case :condition
|
176
|
+
when :foo
|
177
|
+
when :bar, nil
|
178
|
+
:barbaz
|
179
|
+
else
|
180
|
+
:else
|
181
|
+
end
|
182
|
+
RUBY
|
183
|
+
mutation <<-RUBY
|
184
|
+
case :condition
|
185
|
+
when :foo
|
186
|
+
when :bar, :baz__mutant__
|
187
|
+
:barbaz
|
188
|
+
else
|
189
|
+
:else
|
190
|
+
end
|
191
|
+
RUBY
|
192
|
+
mutation <<-RUBY
|
193
|
+
case :condition
|
194
|
+
when :foo
|
195
|
+
when :baz
|
196
|
+
:barbaz
|
197
|
+
else
|
198
|
+
:else
|
199
|
+
end
|
200
|
+
RUBY
|
201
|
+
mutation <<-RUBY
|
202
|
+
case :condition
|
203
|
+
when :foo
|
204
|
+
when :bar
|
205
|
+
:barbaz
|
206
|
+
else
|
207
|
+
:else
|
208
|
+
end
|
209
|
+
RUBY
|
210
|
+
|
211
|
+
mutation 'nil'
|
212
|
+
end
|
213
|
+
|
214
|
+
Mutant::Meta::Example.add do
|
215
|
+
source <<-RUBY
|
216
|
+
case :condition
|
217
|
+
when :foo
|
218
|
+
:foo
|
219
|
+
else
|
220
|
+
:else
|
221
|
+
end
|
222
|
+
RUBY
|
223
|
+
|
224
|
+
# Presence of branches
|
225
|
+
mutation <<-RUBY
|
226
|
+
case :condition
|
227
|
+
when :foo
|
228
|
+
:foo
|
229
|
+
end
|
230
|
+
RUBY
|
231
|
+
|
232
|
+
# Mutations of condition
|
233
|
+
mutation <<-RUBY
|
234
|
+
case nil
|
235
|
+
when :foo
|
236
|
+
:foo
|
237
|
+
else
|
238
|
+
:else
|
239
|
+
end
|
240
|
+
RUBY
|
241
|
+
mutation <<-RUBY
|
242
|
+
case :condition__mutant__
|
243
|
+
when :foo
|
244
|
+
:foo
|
245
|
+
else
|
246
|
+
:else
|
247
|
+
end
|
248
|
+
RUBY
|
249
|
+
|
250
|
+
# Mutations of branch bodies
|
251
|
+
mutation <<-RUBY
|
252
|
+
case :condition
|
253
|
+
when :foo
|
254
|
+
nil
|
255
|
+
else
|
256
|
+
:else
|
257
|
+
end
|
258
|
+
RUBY
|
259
|
+
mutation <<-RUBY
|
260
|
+
case :condition
|
261
|
+
when :foo
|
262
|
+
:foo__mutant__
|
263
|
+
else
|
264
|
+
:else
|
265
|
+
end
|
266
|
+
RUBY
|
267
|
+
mutation <<-RUBY
|
268
|
+
case :condition
|
269
|
+
when :foo
|
270
|
+
:foo
|
271
|
+
else
|
272
|
+
:else__mutant__
|
273
|
+
end
|
274
|
+
RUBY
|
275
|
+
mutation <<-RUBY
|
276
|
+
case :condition
|
277
|
+
when :foo
|
278
|
+
:foo
|
279
|
+
else
|
280
|
+
nil
|
281
|
+
end
|
282
|
+
RUBY
|
283
|
+
|
284
|
+
# Mutations of when conditions
|
285
|
+
mutation <<-RUBY
|
286
|
+
case :condition
|
287
|
+
when :foo__mutant__
|
288
|
+
:foo
|
289
|
+
else
|
290
|
+
:else
|
291
|
+
end
|
292
|
+
RUBY
|
293
|
+
mutation <<-RUBY
|
294
|
+
case :condition
|
295
|
+
when nil
|
296
|
+
:foo
|
297
|
+
else
|
298
|
+
:else
|
299
|
+
end
|
300
|
+
RUBY
|
301
|
+
|
302
|
+
mutation 'nil'
|
303
|
+
end
|