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
@@ -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
|
mutate_condition
|
@@ -28,7 +27,6 @@ module Mutant
|
|
28
27
|
# @return [undefined]
|
29
28
|
#
|
30
29
|
# @api private
|
31
|
-
#
|
32
30
|
def mutate_condition
|
33
31
|
emit_condition_mutations do |node|
|
34
32
|
!n_self?(node)
|
@@ -43,7 +41,6 @@ module Mutant
|
|
43
41
|
# @return [undefined]
|
44
42
|
#
|
45
43
|
# @api private
|
46
|
-
#
|
47
44
|
def mutate_if_branch
|
48
45
|
emit_type(condition, else_branch, nil) if else_branch
|
49
46
|
return unless if_branch
|
@@ -57,7 +54,6 @@ module Mutant
|
|
57
54
|
# @return [undefined]
|
58
55
|
#
|
59
56
|
# @api private
|
60
|
-
#
|
61
57
|
def mutate_else_branch
|
62
58
|
return unless else_branch
|
63
59
|
emit(else_branch)
|
@@ -14,7 +14,6 @@ module Mutant
|
|
14
14
|
# @return [undefined]
|
15
15
|
#
|
16
16
|
# @api private
|
17
|
-
#
|
18
17
|
def dispatch
|
19
18
|
emit_singletons
|
20
19
|
emit_type
|
@@ -28,7 +27,6 @@ module Mutant
|
|
28
27
|
# @return [undefined]
|
29
28
|
#
|
30
29
|
# @api private
|
31
|
-
#
|
32
30
|
def mutate_body
|
33
31
|
children.each_index do |index|
|
34
32
|
dup_children = children.dup
|
@@ -14,28 +14,25 @@ module Mutant
|
|
14
14
|
# @return [undefined]
|
15
15
|
#
|
16
16
|
# @api private
|
17
|
-
#
|
18
17
|
def dispatch
|
19
18
|
emit_singletons
|
20
19
|
emit_values(values)
|
21
20
|
end
|
22
21
|
|
23
|
-
#
|
22
|
+
# Values to mutate to
|
24
23
|
#
|
25
24
|
# @return [Array]
|
26
25
|
#
|
27
26
|
# @api private
|
28
|
-
#
|
29
27
|
def values
|
30
28
|
[0, 1, -value, value + 1, value - 1]
|
31
29
|
end
|
32
30
|
|
33
|
-
#
|
31
|
+
# Literal original value
|
34
32
|
#
|
35
33
|
# @return [Object]
|
36
34
|
#
|
37
35
|
# @api private
|
38
|
-
#
|
39
36
|
def value
|
40
37
|
children.first
|
41
38
|
end
|
@@ -14,7 +14,6 @@ module Mutant
|
|
14
14
|
# @return [undefined]
|
15
15
|
#
|
16
16
|
# @api private
|
17
|
-
#
|
18
17
|
def dispatch
|
19
18
|
emit_singletons
|
20
19
|
emit_values(values)
|
@@ -32,17 +31,15 @@ module Mutant
|
|
32
31
|
# @return [undefined]
|
33
32
|
#
|
34
33
|
# @api private
|
35
|
-
#
|
36
34
|
def emit_special_cases
|
37
35
|
SPECIAL.each(&method(:emit))
|
38
36
|
end
|
39
37
|
|
40
|
-
#
|
38
|
+
# Values to mutate to
|
41
39
|
#
|
42
40
|
# @return [Array]
|
43
41
|
#
|
44
42
|
# @api private
|
45
|
-
#
|
46
43
|
def values
|
47
44
|
original = children.first
|
48
45
|
# Work around a bug in RBX/MRI or JRUBY:
|
@@ -14,7 +14,6 @@ module Mutant
|
|
14
14
|
# @return [undefined]
|
15
15
|
#
|
16
16
|
# @api private
|
17
|
-
#
|
18
17
|
def dispatch
|
19
18
|
emit_singletons
|
20
19
|
emit_type
|
@@ -26,7 +25,6 @@ module Mutant
|
|
26
25
|
# @return [undefined]
|
27
26
|
#
|
28
27
|
# @api private
|
29
|
-
#
|
30
28
|
def mutate_body
|
31
29
|
children.each_index do |index|
|
32
30
|
mutate_child(index)
|
@@ -50,7 +48,6 @@ module Mutant
|
|
50
48
|
# @return [undefined]
|
51
49
|
#
|
52
50
|
# @api private
|
53
|
-
#
|
54
51
|
def dispatch
|
55
52
|
emit_key_mutations
|
56
53
|
emit_value_mutations
|
@@ -22,7 +22,6 @@ module Mutant
|
|
22
22
|
# @return [undefined]
|
23
23
|
#
|
24
24
|
# @api private
|
25
|
-
#
|
26
25
|
def dispatch
|
27
26
|
emit_singletons
|
28
27
|
emit_inverse
|
@@ -30,12 +29,11 @@ module Mutant
|
|
30
29
|
emit_upper_bound_mutations
|
31
30
|
end
|
32
31
|
|
33
|
-
#
|
32
|
+
# Inverse node
|
34
33
|
#
|
35
34
|
# @return [Parser::AST::Node]
|
36
35
|
#
|
37
36
|
# @api private
|
38
|
-
#
|
39
37
|
def emit_inverse
|
40
38
|
emit(s(MAP.fetch(node.type), *children))
|
41
39
|
end
|
@@ -45,7 +43,6 @@ module Mutant
|
|
45
43
|
# @return [undefined]
|
46
44
|
#
|
47
45
|
# @api private
|
48
|
-
#
|
49
46
|
def emit_upper_bound_mutations
|
50
47
|
emit__end_mutations
|
51
48
|
emit_type(N_NAN, _end)
|
@@ -56,7 +53,6 @@ module Mutant
|
|
56
53
|
# @return [undefined]
|
57
54
|
#
|
58
55
|
# @api private
|
59
|
-
#
|
60
56
|
def emit_lower_bound_mutations
|
61
57
|
emit_start_mutations
|
62
58
|
emit_type(start, N_INFINITY)
|
@@ -12,12 +12,11 @@ module Mutant
|
|
12
12
|
|
13
13
|
private
|
14
14
|
|
15
|
-
#
|
15
|
+
# Original regexp options
|
16
16
|
#
|
17
17
|
# @return [Parser::AST::Node]
|
18
18
|
#
|
19
19
|
# @api private
|
20
|
-
#
|
21
20
|
def options
|
22
21
|
children.last
|
23
22
|
end
|
@@ -27,7 +26,6 @@ module Mutant
|
|
27
26
|
# @return [undefined]
|
28
27
|
#
|
29
28
|
# @api private
|
30
|
-
#
|
31
29
|
def dispatch
|
32
30
|
emit_singletons unless parent_node && n_match_current_line?(parent_node)
|
33
31
|
children.each_with_index do |child, index|
|
@@ -17,7 +17,6 @@ module Mutant
|
|
17
17
|
# @return [undefined]
|
18
18
|
#
|
19
19
|
# @api private
|
20
|
-
#
|
21
20
|
def dispatch
|
22
21
|
mutate_name
|
23
22
|
emit_value_mutations if value
|
@@ -28,7 +27,6 @@ module Mutant
|
|
28
27
|
# @return [undefined]
|
29
28
|
#
|
30
29
|
# @api private
|
31
|
-
#
|
32
30
|
def mutate_name
|
33
31
|
Mutator::Util::Symbol.each(name, self) do |name|
|
34
32
|
emit_name(name.upcase)
|
@@ -28,7 +28,6 @@ module Mutant
|
|
28
28
|
# @return [undefined]
|
29
29
|
#
|
30
30
|
# @api private
|
31
|
-
#
|
32
31
|
def dispatch
|
33
32
|
emit_singletons
|
34
33
|
mutate_name
|
@@ -40,7 +39,6 @@ module Mutant
|
|
40
39
|
# @return [undefined]
|
41
40
|
#
|
42
41
|
# @api private
|
43
|
-
#
|
44
42
|
def mutate_name
|
45
43
|
prefix, regexp = MAP.fetch(node.type)
|
46
44
|
stripped = name.to_s.sub(regexp, EMPTY_STRING)
|
@@ -16,13 +16,12 @@ module Mutant
|
|
16
16
|
# @return [undefined]
|
17
17
|
#
|
18
18
|
# @api private
|
19
|
-
#
|
20
19
|
def dispatch
|
21
20
|
emit_singletons
|
22
21
|
emit_right_mutations
|
23
22
|
return if n_ivasgn?(left)
|
24
23
|
emit_left_mutations do |node|
|
25
|
-
AST::
|
24
|
+
AST::Types::ASSIGNABLE_VARIABLES.include?(node.type)
|
26
25
|
end
|
27
26
|
end
|
28
27
|
|
@@ -15,7 +15,6 @@ module Mutant
|
|
15
15
|
# @return [undefined]
|
16
16
|
#
|
17
17
|
# @api private
|
18
|
-
#
|
19
18
|
def dispatch
|
20
19
|
emit_assignment(nil)
|
21
20
|
emit_body_mutations if body
|
@@ -27,7 +26,6 @@ module Mutant
|
|
27
26
|
# @return [undefined]
|
28
27
|
#
|
29
28
|
# @api private
|
30
|
-
#
|
31
29
|
def mutate_captures
|
32
30
|
return unless captures
|
33
31
|
Util::Array::Element.each(captures.children, self) do |matchers|
|
@@ -17,7 +17,6 @@ module Mutant
|
|
17
17
|
# @return [undefined]
|
18
18
|
#
|
19
19
|
# @api private
|
20
|
-
#
|
21
20
|
def dispatch
|
22
21
|
mutate_body
|
23
22
|
mutate_rescue_bodies
|
@@ -31,13 +30,12 @@ module Mutant
|
|
31
30
|
# @return [undefined]
|
32
31
|
#
|
33
32
|
# @api private
|
34
|
-
#
|
35
33
|
def mutate_rescue_bodies
|
36
34
|
children_indices(RESCUE_INDICES).each do |index|
|
37
35
|
rescue_body = children.at(index)
|
38
36
|
next unless rescue_body
|
39
37
|
mutate_child(index)
|
40
|
-
resbody_body = AST::Meta.
|
38
|
+
resbody_body = AST::Meta::Resbody.new(rescue_body).body
|
41
39
|
emit_concat(resbody_body) if resbody_body
|
42
40
|
end
|
43
41
|
end
|
@@ -49,7 +47,6 @@ module Mutant
|
|
49
47
|
# @return [undefined]
|
50
48
|
#
|
51
49
|
# @api private
|
52
|
-
#
|
53
50
|
def emit_concat(child)
|
54
51
|
if body
|
55
52
|
emit(s(:begin, body, child))
|
@@ -63,7 +60,6 @@ module Mutant
|
|
63
60
|
# @return [undefined]
|
64
61
|
#
|
65
62
|
# @api private
|
66
|
-
#
|
67
63
|
def mutate_body
|
68
64
|
return unless body
|
69
65
|
emit_body_mutations
|
@@ -75,7 +71,6 @@ module Mutant
|
|
75
71
|
# @return [undefined]
|
76
72
|
#
|
77
73
|
# @api private
|
78
|
-
#
|
79
74
|
def mutate_else_body
|
80
75
|
return unless else_body
|
81
76
|
emit_else_body_mutations
|