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
data/lib/mutant/mutator.rb
CHANGED
@@ -13,7 +13,6 @@ module Mutant
|
|
13
13
|
# @return [self]
|
14
14
|
#
|
15
15
|
# @api private
|
16
|
-
#
|
17
16
|
def self.each(input, parent = nil, &block)
|
18
17
|
return to_enum(__method__, input, parent) unless block_given?
|
19
18
|
REGISTRY.lookup(input).new(input, parent, block)
|
@@ -26,7 +25,6 @@ module Mutant
|
|
26
25
|
# @return [undefined]
|
27
26
|
#
|
28
27
|
# @api private
|
29
|
-
#
|
30
28
|
def self.handle(*types)
|
31
29
|
types.each do |type|
|
32
30
|
REGISTRY.register(type, self)
|
@@ -34,20 +32,18 @@ module Mutant
|
|
34
32
|
end
|
35
33
|
private_class_method :handle
|
36
34
|
|
37
|
-
#
|
35
|
+
# Mutation input
|
38
36
|
#
|
39
37
|
# @return [Object]
|
40
38
|
#
|
41
39
|
# @api private
|
42
|
-
#
|
43
40
|
attr_reader :input
|
44
41
|
|
45
|
-
#
|
42
|
+
# Parent context of input
|
46
43
|
#
|
47
44
|
# @return [Object]
|
48
45
|
#
|
49
46
|
# @api private
|
50
|
-
#
|
51
47
|
attr_reader :parent
|
52
48
|
|
53
49
|
private
|
@@ -61,7 +57,6 @@ module Mutant
|
|
61
57
|
# @return [undefined]
|
62
58
|
#
|
63
59
|
# @api private
|
64
|
-
#
|
65
60
|
def initialize(input, parent, block)
|
66
61
|
@input, @parent, @block = input, parent, block
|
67
62
|
@seen = Set.new
|
@@ -76,7 +71,6 @@ module Mutant
|
|
76
71
|
# @return [Boolean]
|
77
72
|
#
|
78
73
|
# @api private
|
79
|
-
#
|
80
74
|
def new?(object)
|
81
75
|
!@seen.include?(object)
|
82
76
|
end
|
@@ -88,7 +82,6 @@ module Mutant
|
|
88
82
|
# @return [undefined]
|
89
83
|
#
|
90
84
|
# @api private
|
91
|
-
#
|
92
85
|
def guard(object)
|
93
86
|
@seen << object
|
94
87
|
end
|
@@ -98,7 +91,6 @@ module Mutant
|
|
98
91
|
# @return [undefined]
|
99
92
|
#
|
100
93
|
# @api private
|
101
|
-
#
|
102
94
|
abstract_method :dispatch
|
103
95
|
|
104
96
|
# Emit generated mutation if object is not equivalent to input
|
@@ -108,7 +100,6 @@ module Mutant
|
|
108
100
|
# @return [undefined]
|
109
101
|
#
|
110
102
|
# @api private
|
111
|
-
#
|
112
103
|
def emit(object)
|
113
104
|
return unless new?(object)
|
114
105
|
|
@@ -124,7 +115,6 @@ module Mutant
|
|
124
115
|
# @return [self]
|
125
116
|
#
|
126
117
|
# @api private
|
127
|
-
#
|
128
118
|
def emit!(node)
|
129
119
|
@block.call(node)
|
130
120
|
self
|
@@ -135,7 +125,6 @@ module Mutant
|
|
135
125
|
# @return [undefined]
|
136
126
|
#
|
137
127
|
# @api private
|
138
|
-
#
|
139
128
|
def run(mutator)
|
140
129
|
mutator.new(input, self, method(:emit))
|
141
130
|
end
|
@@ -145,7 +134,6 @@ module Mutant
|
|
145
134
|
# @return [Object]
|
146
135
|
#
|
147
136
|
# @api private
|
148
|
-
#
|
149
137
|
def dup_input
|
150
138
|
input.dup
|
151
139
|
end
|
data/lib/mutant/mutator/node.rb
CHANGED
@@ -19,7 +19,6 @@ module Mutant
|
|
19
19
|
# @return [undefined]
|
20
20
|
#
|
21
21
|
# @api private
|
22
|
-
#
|
23
22
|
def self.define_named_child(name, index)
|
24
23
|
super
|
25
24
|
|
@@ -35,39 +34,25 @@ module Mutant
|
|
35
34
|
|
36
35
|
private
|
37
36
|
|
38
|
-
#
|
37
|
+
# Node to mutate
|
39
38
|
#
|
40
39
|
# @return [Parser::AST::Node]
|
41
40
|
#
|
42
41
|
# @api private
|
43
|
-
#
|
44
42
|
alias_method :node, :input
|
45
43
|
|
46
|
-
#
|
44
|
+
# Duplicate of original
|
47
45
|
#
|
48
46
|
# @return [Parser::AST::Node]
|
49
47
|
#
|
50
48
|
# @api private
|
51
|
-
#
|
52
49
|
alias_method :dup_node, :dup_input
|
53
50
|
|
54
|
-
#
|
55
|
-
#
|
56
|
-
# @return [AST::Meta]
|
57
|
-
#
|
58
|
-
# @api private
|
59
|
-
#
|
60
|
-
def meta
|
61
|
-
AST::Meta.for(node)
|
62
|
-
end
|
63
|
-
memoize :meta
|
64
|
-
|
65
|
-
# Return children
|
51
|
+
# Original nodes children
|
66
52
|
#
|
67
53
|
# @return [Array<Parser::AST::Node>]
|
68
54
|
#
|
69
55
|
# @api private
|
70
|
-
#
|
71
56
|
def children
|
72
57
|
node.children
|
73
58
|
end
|
@@ -79,7 +64,6 @@ module Mutant
|
|
79
64
|
# @return [undefined]
|
80
65
|
#
|
81
66
|
# @api private
|
82
|
-
#
|
83
67
|
def mutate_child(index, mutator = Mutator, &block)
|
84
68
|
block ||= TAUTOLOGY
|
85
69
|
child = children.at(index)
|
@@ -96,7 +80,6 @@ module Mutant
|
|
96
80
|
# @return [undefined]
|
97
81
|
#
|
98
82
|
# @api private
|
99
|
-
#
|
100
83
|
def delete_child(index)
|
101
84
|
dup_children = children.dup
|
102
85
|
dup_children.delete_at(index)
|
@@ -111,7 +94,6 @@ module Mutant
|
|
111
94
|
# @return [undefined]
|
112
95
|
#
|
113
96
|
# @api private
|
114
|
-
#
|
115
97
|
def emit_child_update(index, node)
|
116
98
|
new_children = children.dup
|
117
99
|
new_children[index] = node
|
@@ -125,7 +107,6 @@ module Mutant
|
|
125
107
|
# @return [undefined]
|
126
108
|
#
|
127
109
|
# @api private
|
128
|
-
#
|
129
110
|
def emit_type(*children)
|
130
111
|
emit(Parser::AST::Node.new(node.type, children))
|
131
112
|
end
|
@@ -135,7 +116,6 @@ module Mutant
|
|
135
116
|
# @return [undefined]
|
136
117
|
#
|
137
118
|
# @api private
|
138
|
-
#
|
139
119
|
def emit_singletons
|
140
120
|
emit_nil
|
141
121
|
emit_self
|
@@ -146,7 +126,6 @@ module Mutant
|
|
146
126
|
# @return [undefined]
|
147
127
|
#
|
148
128
|
# @api private
|
149
|
-
#
|
150
129
|
def emit_self
|
151
130
|
emit(N_SELF)
|
152
131
|
end
|
@@ -156,7 +135,6 @@ module Mutant
|
|
156
135
|
# @return [undefined]
|
157
136
|
#
|
158
137
|
# @api private
|
159
|
-
#
|
160
138
|
def emit_nil
|
161
139
|
emit(N_NIL) unless asgn_left?
|
162
140
|
end
|
@@ -168,14 +146,13 @@ module Mutant
|
|
168
146
|
# @return [undefined]
|
169
147
|
#
|
170
148
|
# @api private
|
171
|
-
#
|
172
149
|
def emit_values(values)
|
173
150
|
values.each do |value|
|
174
151
|
emit_type(value)
|
175
152
|
end
|
176
153
|
end
|
177
154
|
|
178
|
-
#
|
155
|
+
# Parent node
|
179
156
|
#
|
180
157
|
# @return [Parser::AST::Node] node
|
181
158
|
# if parent with node is present
|
@@ -184,12 +161,11 @@ module Mutant
|
|
184
161
|
# otherwise
|
185
162
|
#
|
186
163
|
# @api private
|
187
|
-
#
|
188
164
|
def parent_node
|
189
165
|
parent.node if parent
|
190
166
|
end
|
191
167
|
|
192
|
-
#
|
168
|
+
# Parent type
|
193
169
|
#
|
194
170
|
# @return [Symbol] type
|
195
171
|
# if parent with type is present
|
@@ -198,7 +174,6 @@ module Mutant
|
|
198
174
|
# otherwise
|
199
175
|
#
|
200
176
|
# @api private
|
201
|
-
#
|
202
177
|
def parent_type
|
203
178
|
parent_node.type if parent_node
|
204
179
|
end
|
@@ -208,19 +183,17 @@ module Mutant
|
|
208
183
|
# @return [Boolean]
|
209
184
|
#
|
210
185
|
# @api private
|
211
|
-
#
|
212
186
|
def asgn_left?
|
213
187
|
AST::Types::OP_ASSIGN.include?(parent_type) && parent.node.children.first.equal?(node)
|
214
188
|
end
|
215
189
|
|
216
|
-
#
|
190
|
+
# Children indices
|
217
191
|
#
|
218
192
|
# @param [Range] range
|
219
193
|
#
|
220
194
|
# @return [Enumerable<Fixnum>]
|
221
195
|
#
|
222
196
|
# @api private
|
223
|
-
#
|
224
197
|
def children_indices(range)
|
225
198
|
range_end = range.end
|
226
199
|
last_index = range_end >= 0 ? range_end : children.length + range_end
|
@@ -17,7 +17,6 @@ module Mutant
|
|
17
17
|
# @return [undefined]
|
18
18
|
#
|
19
19
|
# @api private
|
20
|
-
#
|
21
20
|
def dispatch
|
22
21
|
emit_name_mutation
|
23
22
|
end
|
@@ -27,7 +26,6 @@ module Mutant
|
|
27
26
|
# @return [undefined]
|
28
27
|
#
|
29
28
|
# @api private
|
30
|
-
#
|
31
29
|
def emit_name_mutation
|
32
30
|
return if skip?
|
33
31
|
Mutator::Util::Symbol.each(name, self) do |name|
|
@@ -40,7 +38,6 @@ module Mutant
|
|
40
38
|
# @return [Boolean]
|
41
39
|
#
|
42
40
|
# @api private
|
43
|
-
#
|
44
41
|
def skip?
|
45
42
|
name.to_s.start_with?(UNDERSCORE)
|
46
43
|
end
|
@@ -59,7 +56,6 @@ module Mutant
|
|
59
56
|
# @return [undefined]
|
60
57
|
#
|
61
58
|
# @api private
|
62
|
-
#
|
63
59
|
def dispatch
|
64
60
|
emit_name_mutation
|
65
61
|
emit_required_mutation
|
@@ -71,7 +67,6 @@ module Mutant
|
|
71
67
|
# @return [undefined]
|
72
68
|
#
|
73
69
|
# @api private
|
74
|
-
#
|
75
70
|
def emit_required_mutation
|
76
71
|
emit(s(:arg, name))
|
77
72
|
end
|
@@ -13,7 +13,6 @@ module Mutant
|
|
13
13
|
# @return [undefined]
|
14
14
|
#
|
15
15
|
# @api private
|
16
|
-
#
|
17
16
|
def dispatch
|
18
17
|
emit_argument_presence
|
19
18
|
emit_argument_mutations
|
@@ -25,7 +24,6 @@ module Mutant
|
|
25
24
|
# @return [undefined]
|
26
25
|
#
|
27
26
|
# @api private
|
28
|
-
#
|
29
27
|
def emit_argument_presence
|
30
28
|
emit_type
|
31
29
|
Mutator::Util::Array::Presence.each(children, self) do |children|
|
@@ -38,7 +36,6 @@ module Mutant
|
|
38
36
|
# @return [undefined]
|
39
37
|
#
|
40
38
|
# @api private
|
41
|
-
#
|
42
39
|
def emit_argument_mutations
|
43
40
|
children.each_with_index do |child, index|
|
44
41
|
Mutator.each(child) do |mutant|
|
@@ -55,7 +52,6 @@ module Mutant
|
|
55
52
|
# @return [Boolean]
|
56
53
|
#
|
57
54
|
# @api private
|
58
|
-
#
|
59
55
|
def invalid_argument_replacement?(mutant, index)
|
60
56
|
original = children.fetch(index)
|
61
57
|
|
@@ -69,7 +65,6 @@ module Mutant
|
|
69
65
|
# @return [undefined]
|
70
66
|
#
|
71
67
|
# @api private
|
72
|
-
#
|
73
68
|
def emit_mlhs_expansion
|
74
69
|
mlhs_childs_with_index.each do |child, index|
|
75
70
|
dup_children = children.dup
|
@@ -79,12 +74,11 @@ module Mutant
|
|
79
74
|
end
|
80
75
|
end
|
81
76
|
|
82
|
-
#
|
77
|
+
# Multiple left hand side childs
|
83
78
|
#
|
84
79
|
# @return [Enumerable<Parser::AST::Node, Fixnum>]
|
85
80
|
#
|
86
81
|
# @api private
|
87
|
-
#
|
88
82
|
def mlhs_childs_with_index
|
89
83
|
children.each_with_index.select do |child, _index|
|
90
84
|
n_mlhs?(child)
|
@@ -14,7 +14,6 @@ module Mutant
|
|
14
14
|
# @return [undefined]
|
15
15
|
#
|
16
16
|
# @api private
|
17
|
-
#
|
18
17
|
def dispatch
|
19
18
|
Util::Array.each(children, self, &method(:emit_child_subset))
|
20
19
|
children.each_with_index do |child, index|
|
@@ -30,7 +29,6 @@ module Mutant
|
|
30
29
|
# @return [undefined]
|
31
30
|
#
|
32
31
|
# @api private
|
33
|
-
#
|
34
32
|
def emit_child_subset(children)
|
35
33
|
return if children.length < 2
|
36
34
|
emit_type(*children)
|
@@ -20,7 +20,6 @@ module Mutant
|
|
20
20
|
# @return [undefined]
|
21
21
|
#
|
22
22
|
# @api private
|
23
|
-
#
|
24
23
|
def dispatch
|
25
24
|
emit_singletons
|
26
25
|
emit(left)
|
@@ -36,7 +35,6 @@ module Mutant
|
|
36
35
|
# @return [undefined]
|
37
36
|
#
|
38
37
|
# @api private
|
39
|
-
#
|
40
38
|
def mutate_operator
|
41
39
|
emit(s(INVERSE.fetch(node.type), left, right))
|
42
40
|
end
|
@@ -46,7 +44,6 @@ module Mutant
|
|
46
44
|
# @return [undefined]
|
47
45
|
#
|
48
46
|
# @api private
|
49
|
-
#
|
50
47
|
def mutate_operands
|
51
48
|
emit(s(node.type, n_not(left), right))
|
52
49
|
emit(n_not(node))
|
@@ -15,7 +15,6 @@ module Mutant
|
|
15
15
|
# @return [undefined]
|
16
16
|
#
|
17
17
|
# @api private
|
18
|
-
#
|
19
18
|
def dispatch
|
20
19
|
emit_singletons
|
21
20
|
emit(send)
|
@@ -30,7 +29,6 @@ module Mutant
|
|
30
29
|
# @return [undefined]
|
31
30
|
#
|
32
31
|
# @api private
|
33
|
-
#
|
34
32
|
def mutate_body
|
35
33
|
emit_body(nil)
|
36
34
|
emit_body(N_RAISE)
|
@@ -16,7 +16,6 @@ module Mutant
|
|
16
16
|
# @return [undefined]
|
17
17
|
#
|
18
18
|
# @api private
|
19
|
-
#
|
20
19
|
def dispatch
|
21
20
|
emit_singletons
|
22
21
|
emit_condition_mutations if condition
|
@@ -29,7 +28,6 @@ module Mutant
|
|
29
28
|
# @return [undefined]
|
30
29
|
#
|
31
30
|
# @api private
|
32
|
-
#
|
33
31
|
def emit_when_mutations
|
34
32
|
indices = children.each_index.drop(1).take(children.length - 2)
|
35
33
|
one = indices.one?
|
@@ -44,7 +42,6 @@ module Mutant
|
|
44
42
|
# @return [undefined]
|
45
43
|
#
|
46
44
|
# @api private
|
47
|
-
#
|
48
45
|
def emit_else_mutations
|
49
46
|
else_branch = children.last
|
50
47
|
else_index = children.length - 1
|