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
@@ -0,0 +1,14 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
Mutant::Meta::Example.add do
|
4
|
+
source 'true if /foo/'
|
5
|
+
|
6
|
+
mutation 'false if /foo/'
|
7
|
+
mutation 'true if //'
|
8
|
+
mutation 'nil if /foo/'
|
9
|
+
mutation 'true if true'
|
10
|
+
mutation 'true if false'
|
11
|
+
mutation 'true if nil'
|
12
|
+
mutation 'true if /a\A/'
|
13
|
+
mutation 'nil'
|
14
|
+
end
|
data/meta/next.rb
ADDED
data/meta/nil.rb
ADDED
data/meta/nthref.rb
ADDED
data/meta/op_assgn.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
Mutant::Meta::Example.add do
|
4
|
+
source '@a.b += 1'
|
5
|
+
|
6
|
+
mutation '@a.b += -1'
|
7
|
+
mutation '@a.b += 2'
|
8
|
+
mutation '@a.b += 0'
|
9
|
+
mutation '@a.b += nil'
|
10
|
+
mutation 'nil.b += 1'
|
11
|
+
mutation 'nil'
|
12
|
+
# TODO: fix invalid AST
|
13
|
+
# This should not get emitted as invalid AST with valid unparsed source
|
14
|
+
mutation s(:op_asgn, s(:ivar, :@a), :+, s(:int, 1))
|
15
|
+
end
|
data/meta/or_asgn.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
Mutant::Meta::Example.add do
|
4
|
+
source 'a ||= 1'
|
5
|
+
|
6
|
+
mutation 'a__mutant__ ||= 1'
|
7
|
+
mutation 'a ||= nil'
|
8
|
+
mutation 'a ||= 0'
|
9
|
+
mutation 'a ||= -1'
|
10
|
+
mutation 'a ||= 2'
|
11
|
+
mutation 'nil'
|
12
|
+
end
|
13
|
+
|
14
|
+
Mutant::Meta::Example.add do
|
15
|
+
source '@a ||= 1'
|
16
|
+
|
17
|
+
mutation '@a ||= nil'
|
18
|
+
mutation '@a ||= 0'
|
19
|
+
mutation '@a ||= -1'
|
20
|
+
mutation '@a ||= 2'
|
21
|
+
mutation 'nil'
|
22
|
+
end
|
data/meta/range.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
Mutant::Meta::Example.add do
|
4
|
+
source '1..100'
|
5
|
+
|
6
|
+
mutation 'nil'
|
7
|
+
mutation '1...100'
|
8
|
+
mutation '(0.0 / 0.0)..100'
|
9
|
+
mutation '1..(1.0 / 0.0)'
|
10
|
+
mutation '1..(0.0 / 0.0)'
|
11
|
+
mutation '-1..100'
|
12
|
+
mutation '0..100'
|
13
|
+
mutation '2..100'
|
14
|
+
mutation 'nil..100'
|
15
|
+
mutation '1..nil'
|
16
|
+
mutation '1..0'
|
17
|
+
mutation '1..1'
|
18
|
+
mutation '1..99'
|
19
|
+
mutation '1..101'
|
20
|
+
mutation '1..-100'
|
21
|
+
end
|
22
|
+
|
23
|
+
Mutant::Meta::Example.add do
|
24
|
+
source '1...100'
|
25
|
+
|
26
|
+
mutation 'nil'
|
27
|
+
mutation '1..100'
|
28
|
+
mutation '(0.0 / 0.0)...100'
|
29
|
+
mutation '1...(1.0 / 0.0)'
|
30
|
+
mutation '1...(0.0 / 0.0)'
|
31
|
+
mutation '-1...100'
|
32
|
+
mutation '0...100'
|
33
|
+
mutation '2...100'
|
34
|
+
mutation 'nil...100'
|
35
|
+
mutation '1...nil'
|
36
|
+
mutation '1...0'
|
37
|
+
mutation '1...1'
|
38
|
+
mutation '1...99'
|
39
|
+
mutation '1...101'
|
40
|
+
mutation '1...-100'
|
41
|
+
end
|
data/meta/redo.rb
ADDED
data/meta/regex.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
Mutant::Meta::Example.add do
|
4
|
+
source '/foo/'
|
5
|
+
|
6
|
+
mutation '//' # match all
|
7
|
+
mutation '/a\A/' # match nothing
|
8
|
+
mutation 'nil'
|
9
|
+
end
|
10
|
+
|
11
|
+
Mutant::Meta::Example.add do
|
12
|
+
source '/#{foo.bar}n/'
|
13
|
+
|
14
|
+
mutation '//' # match all
|
15
|
+
mutation '/#{foo}n/'
|
16
|
+
mutation '/a\A/' # match nothing
|
17
|
+
mutation '/#{nil.bar}n/'
|
18
|
+
mutation '/#{nil}n/'
|
19
|
+
mutation 'nil'
|
20
|
+
end
|
data/meta/rescue.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
Mutant::Meta::Example.add do
|
4
|
+
source 'begin; rescue ExceptionA, ExceptionB => error; true; end'
|
5
|
+
|
6
|
+
mutation 'nil'
|
7
|
+
mutation 'begin; rescue ExceptionA, ExceptionB; true; end'
|
8
|
+
mutation 'begin; rescue ExceptionA, ExceptionB => error; false; end'
|
9
|
+
mutation 'begin; rescue ExceptionA, ExceptionB => error; nil; end'
|
10
|
+
mutation 'begin; rescue ExceptionA => error; true; end'
|
11
|
+
mutation 'begin; rescue ExceptionB => error; true; end'
|
12
|
+
end
|
13
|
+
|
14
|
+
Mutant::Meta::Example.add do
|
15
|
+
source 'begin; rescue SomeException => error; true; end'
|
16
|
+
|
17
|
+
mutation 'nil'
|
18
|
+
mutation 'begin; rescue SomeException; true; end'
|
19
|
+
mutation 'begin; rescue SomeException => error; false; end'
|
20
|
+
mutation 'begin; rescue SomeException => error; nil; end'
|
21
|
+
end
|
22
|
+
|
23
|
+
Mutant::Meta::Example.add do
|
24
|
+
source 'begin; rescue => error; true end'
|
25
|
+
|
26
|
+
mutation 'nil'
|
27
|
+
mutation 'begin; rescue => error; false; end'
|
28
|
+
mutation 'begin; rescue => error; nil; end'
|
29
|
+
mutation 'begin; rescue; true; end'
|
30
|
+
end
|
31
|
+
|
32
|
+
Mutant::Meta::Example.add do
|
33
|
+
source 'begin; rescue; true end'
|
34
|
+
|
35
|
+
mutation 'nil'
|
36
|
+
mutation 'begin; rescue; false; end'
|
37
|
+
mutation 'begin; rescue; nil; end'
|
38
|
+
end
|
data/meta/restarg.rb
ADDED
data/meta/return.rb
ADDED
data/meta/self.rb
ADDED
data/meta/send.rb
ADDED
@@ -0,0 +1,240 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
Mutant::Meta::Example.add do
|
4
|
+
source 'reverse_each'
|
5
|
+
|
6
|
+
mutation 'nil'
|
7
|
+
mutation 'each'
|
8
|
+
end
|
9
|
+
|
10
|
+
Mutant::Meta::Example.add do
|
11
|
+
source 'reverse_map'
|
12
|
+
|
13
|
+
mutation 'nil'
|
14
|
+
mutation 'map'
|
15
|
+
mutation 'each'
|
16
|
+
end
|
17
|
+
|
18
|
+
Mutant::Meta::Example.add do
|
19
|
+
source 'map'
|
20
|
+
|
21
|
+
mutation 'nil'
|
22
|
+
mutation 'each'
|
23
|
+
end
|
24
|
+
|
25
|
+
Mutant::Meta::Example.add do
|
26
|
+
source 'foo == bar'
|
27
|
+
|
28
|
+
mutation 'foo'
|
29
|
+
mutation 'bar'
|
30
|
+
mutation 'nil == bar'
|
31
|
+
mutation 'foo == nil'
|
32
|
+
mutation 'nil'
|
33
|
+
mutation 'foo.eql?(bar)'
|
34
|
+
mutation 'foo.equal?(bar)'
|
35
|
+
end
|
36
|
+
|
37
|
+
Mutant::Meta::Example.add do
|
38
|
+
source 'foo.gsub(a, b)'
|
39
|
+
|
40
|
+
mutation 'foo'
|
41
|
+
mutation 'foo.gsub(a)'
|
42
|
+
mutation 'foo.gsub(b)'
|
43
|
+
mutation 'foo.gsub'
|
44
|
+
mutation 'foo.sub(a, b)'
|
45
|
+
mutation 'foo.gsub(a, nil)'
|
46
|
+
mutation 'foo.gsub(nil, b)'
|
47
|
+
mutation 'nil.gsub(a, b)'
|
48
|
+
mutation 'nil'
|
49
|
+
end
|
50
|
+
|
51
|
+
Mutant::Meta::Example.add do
|
52
|
+
source 'foo.send(bar)'
|
53
|
+
|
54
|
+
mutation 'foo.send'
|
55
|
+
mutation 'foo.public_send(bar)'
|
56
|
+
mutation 'bar'
|
57
|
+
mutation 'foo'
|
58
|
+
mutation 'foo.send(nil)'
|
59
|
+
mutation 'nil.send(bar)'
|
60
|
+
mutation 'nil'
|
61
|
+
end
|
62
|
+
|
63
|
+
Mutant::Meta::Example.add do
|
64
|
+
source 'self.foo ||= expression'
|
65
|
+
|
66
|
+
mutation 'self.foo ||= nil'
|
67
|
+
mutation 'nil.foo ||= expression'
|
68
|
+
mutation 'nil'
|
69
|
+
end
|
70
|
+
|
71
|
+
Mutant::Meta::Example.add do
|
72
|
+
source 'self.bar=baz'
|
73
|
+
|
74
|
+
mutation 'nil'
|
75
|
+
mutation 'self.bar=nil'
|
76
|
+
mutation 'self'
|
77
|
+
mutation 'self.bar'
|
78
|
+
mutation 'baz'
|
79
|
+
# This one could probably be removed
|
80
|
+
mutation 'nil.bar=baz'
|
81
|
+
end
|
82
|
+
|
83
|
+
Mutant::Meta::Example.add do
|
84
|
+
source 'foo.bar=baz'
|
85
|
+
|
86
|
+
mutation 'foo'
|
87
|
+
mutation 'nil'
|
88
|
+
mutation 'foo.bar=nil'
|
89
|
+
mutation 'foo.bar'
|
90
|
+
mutation 'baz'
|
91
|
+
# This one could probably be removed
|
92
|
+
mutation 'nil.bar=baz'
|
93
|
+
end
|
94
|
+
|
95
|
+
Mutant::Meta::Example.add do
|
96
|
+
source 'foo[bar]=baz'
|
97
|
+
|
98
|
+
mutation 'foo'
|
99
|
+
mutation 'nil'
|
100
|
+
end
|
101
|
+
|
102
|
+
Mutant::Meta::Example.add do
|
103
|
+
source 'foo(*bar)'
|
104
|
+
|
105
|
+
mutation 'foo'
|
106
|
+
mutation 'foo(nil)'
|
107
|
+
mutation 'foo(bar)'
|
108
|
+
mutation 'foo(*nil)'
|
109
|
+
mutation 'nil'
|
110
|
+
end
|
111
|
+
|
112
|
+
Mutant::Meta::Example.add do
|
113
|
+
source 'foo(&bar)'
|
114
|
+
|
115
|
+
mutation 'foo'
|
116
|
+
mutation 'nil'
|
117
|
+
end
|
118
|
+
|
119
|
+
Mutant::Meta::Example.add do
|
120
|
+
source 'foo[*bar]'
|
121
|
+
|
122
|
+
mutation 'foo'
|
123
|
+
mutation 'nil'
|
124
|
+
end
|
125
|
+
|
126
|
+
Mutant::Meta::Example.add do
|
127
|
+
source 'foo'
|
128
|
+
|
129
|
+
mutation 'nil'
|
130
|
+
end
|
131
|
+
|
132
|
+
Mutant::Meta::Example.add do
|
133
|
+
source 'self.foo'
|
134
|
+
|
135
|
+
mutation 'foo'
|
136
|
+
mutation 'self'
|
137
|
+
mutation 'nil.foo'
|
138
|
+
mutation 'nil'
|
139
|
+
end
|
140
|
+
|
141
|
+
Unparser::Constants::KEYWORDS.each do |keyword|
|
142
|
+
Mutant::Meta::Example.add do
|
143
|
+
source "self.#{keyword}"
|
144
|
+
|
145
|
+
mutation "nil.#{keyword}"
|
146
|
+
mutation 'nil'
|
147
|
+
mutation 'self'
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
Mutant::Meta::Example.add do
|
152
|
+
source 'foo.bar'
|
153
|
+
|
154
|
+
mutation 'foo'
|
155
|
+
mutation 'nil.bar'
|
156
|
+
mutation 'nil'
|
157
|
+
end
|
158
|
+
|
159
|
+
Mutant::Meta::Example.add do
|
160
|
+
source 'self.class.foo'
|
161
|
+
|
162
|
+
mutation 'self.class'
|
163
|
+
mutation 'self.foo'
|
164
|
+
mutation 'nil.class.foo'
|
165
|
+
mutation 'nil.foo'
|
166
|
+
mutation 'nil'
|
167
|
+
end
|
168
|
+
|
169
|
+
Mutant::Meta::Example.add do
|
170
|
+
source 'foo(nil)'
|
171
|
+
|
172
|
+
mutation 'foo'
|
173
|
+
mutation 'nil'
|
174
|
+
end
|
175
|
+
|
176
|
+
Mutant::Meta::Example.add do
|
177
|
+
source 'self.foo(nil)'
|
178
|
+
|
179
|
+
mutation 'self'
|
180
|
+
mutation 'self.foo'
|
181
|
+
mutation 'foo(nil)'
|
182
|
+
mutation 'nil'
|
183
|
+
mutation 'nil.foo(nil)'
|
184
|
+
end
|
185
|
+
|
186
|
+
Unparser::Constants::KEYWORDS.each do |keyword|
|
187
|
+
Mutant::Meta::Example.add do
|
188
|
+
source "foo.#{keyword}(nil)"
|
189
|
+
|
190
|
+
mutation "foo.#{keyword}"
|
191
|
+
mutation 'foo'
|
192
|
+
mutation "nil.#{keyword}(nil)"
|
193
|
+
mutation 'nil'
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
Mutant::Meta::Example.add do
|
198
|
+
source 'foo(nil, nil)'
|
199
|
+
|
200
|
+
mutation 'foo()'
|
201
|
+
mutation 'foo(nil)'
|
202
|
+
mutation 'nil'
|
203
|
+
end
|
204
|
+
|
205
|
+
Mutant::Meta::Example.add do
|
206
|
+
source '(left - right) / foo'
|
207
|
+
|
208
|
+
mutation 'foo'
|
209
|
+
mutation '(left - right)'
|
210
|
+
mutation 'left / foo'
|
211
|
+
mutation 'right / foo'
|
212
|
+
mutation '(left - right) / nil'
|
213
|
+
mutation '(left - nil) / foo'
|
214
|
+
mutation '(nil - right) / foo'
|
215
|
+
mutation 'nil / foo'
|
216
|
+
mutation 'nil'
|
217
|
+
end
|
218
|
+
|
219
|
+
(Mutant::BINARY_METHOD_OPERATORS - [:==, :eql?]).each do |operator|
|
220
|
+
Mutant::Meta::Example.add do
|
221
|
+
source "true #{operator} false"
|
222
|
+
|
223
|
+
mutation "false #{operator} false"
|
224
|
+
mutation "nil #{operator} false"
|
225
|
+
mutation "true #{operator} true"
|
226
|
+
mutation "true #{operator} nil"
|
227
|
+
mutation 'true'
|
228
|
+
mutation 'false'
|
229
|
+
mutation 'nil'
|
230
|
+
end
|
231
|
+
|
232
|
+
Mutant::Meta::Example.add do
|
233
|
+
source "left #{operator} right"
|
234
|
+
mutation 'left'
|
235
|
+
mutation 'right'
|
236
|
+
mutation "left #{operator} nil"
|
237
|
+
mutation "nil #{operator} right"
|
238
|
+
mutation 'nil'
|
239
|
+
end
|
240
|
+
end
|