mutant 0.8.8 → 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +9 -0
- data/README.md +1 -1
- data/Rakefile +12 -8
- data/bin/mutant +5 -1
- data/config/flay.yml +1 -1
- data/lib/mutant.rb +18 -17
- data/lib/mutant/actor.rb +1 -7
- data/lib/mutant/actor/env.rb +0 -4
- data/lib/mutant/actor/mailbox.rb +0 -4
- data/lib/mutant/actor/receiver.rb +0 -4
- data/lib/mutant/actor/sender.rb +0 -2
- data/lib/mutant/ast.rb +1 -5
- data/lib/mutant/ast/meta/const.rb +0 -2
- data/lib/mutant/ast/meta/optarg.rb +0 -2
- data/lib/mutant/ast/meta/send.rb +0 -12
- data/lib/mutant/ast/named_children.rb +0 -10
- data/lib/mutant/ast/sexp.rb +1 -5
- data/lib/mutant/cli.rb +19 -38
- data/lib/mutant/color.rb +1 -7
- data/lib/mutant/config.rb +11 -7
- data/lib/mutant/context.rb +0 -4
- data/lib/mutant/context/scope.rb +0 -18
- data/lib/mutant/delegator.rb +0 -6
- data/lib/mutant/diff.rb +0 -18
- data/lib/mutant/env.rb +8 -24
- data/lib/mutant/env/bootstrap.rb +18 -41
- data/lib/mutant/expression.rb +0 -8
- data/lib/mutant/expression/method.rb +6 -7
- data/lib/mutant/expression/methods.rb +5 -9
- data/lib/mutant/expression/namespace.rb +0 -13
- data/lib/mutant/expression/parser.rb +0 -6
- data/lib/mutant/integration.rb +2 -20
- data/lib/mutant/isolation.rb +0 -4
- data/lib/mutant/loader.rb +20 -35
- data/lib/mutant/matcher.rb +1 -1
- data/lib/mutant/matcher/chain.rb +1 -3
- data/lib/mutant/matcher/compiler.rb +0 -8
- data/lib/mutant/matcher/config.rb +2 -10
- data/lib/mutant/matcher/filter.rb +1 -3
- data/lib/mutant/matcher/method.rb +4 -26
- data/lib/mutant/matcher/method/instance.rb +1 -7
- data/lib/mutant/matcher/method/singleton.rb +0 -12
- data/lib/mutant/matcher/methods.rb +1 -19
- data/lib/mutant/matcher/namespace.rb +1 -7
- data/lib/mutant/matcher/null.rb +1 -3
- data/lib/mutant/matcher/scope.rb +1 -5
- data/lib/mutant/matcher/static.rb +0 -2
- data/lib/mutant/meta.rb +0 -2
- data/lib/mutant/meta/example.rb +0 -28
- data/lib/mutant/meta/example/dsl.rb +2 -16
- data/lib/mutant/mutation.rb +9 -18
- data/lib/mutant/mutator.rb +0 -24
- data/lib/mutant/mutator/node.rb +1 -33
- data/lib/mutant/mutator/node/and_asgn.rb +0 -2
- data/lib/mutant/mutator/node/argument.rb +0 -10
- data/lib/mutant/mutator/node/arguments.rb +0 -12
- data/lib/mutant/mutator/node/begin.rb +0 -4
- data/lib/mutant/mutator/node/binary.rb +2 -11
- data/lib/mutant/mutator/node/block.rb +0 -6
- data/lib/mutant/mutator/node/break.rb +0 -2
- data/lib/mutant/mutator/node/case.rb +0 -6
- data/lib/mutant/mutator/node/conditional_loop.rb +0 -2
- data/lib/mutant/mutator/node/const.rb +1 -3
- data/lib/mutant/mutator/node/define.rb +4 -11
- data/lib/mutant/mutator/node/defined.rb +0 -2
- data/lib/mutant/mutator/node/dstr.rb +0 -2
- data/lib/mutant/mutator/node/dsym.rb +0 -2
- data/lib/mutant/mutator/node/generic.rb +1 -3
- data/lib/mutant/mutator/node/if.rb +0 -8
- data/lib/mutant/mutator/node/kwbegin.rb +0 -2
- data/lib/mutant/mutator/node/literal/array.rb +0 -4
- data/lib/mutant/mutator/node/literal/boolean.rb +0 -2
- data/lib/mutant/mutator/node/literal/fixnum.rb +0 -6
- data/lib/mutant/mutator/node/literal/float.rb +0 -6
- data/lib/mutant/mutator/node/literal/hash.rb +0 -6
- data/lib/mutant/mutator/node/literal/nil.rb +0 -2
- data/lib/mutant/mutator/node/literal/range.rb +0 -8
- data/lib/mutant/mutator/node/literal/regex.rb +0 -4
- data/lib/mutant/mutator/node/literal/string.rb +0 -2
- data/lib/mutant/mutator/node/literal/symbol.rb +0 -2
- data/lib/mutant/mutator/node/masgn.rb +0 -2
- data/lib/mutant/mutator/node/match_current_line.rb +0 -2
- data/lib/mutant/mutator/node/mlhs.rb +0 -2
- data/lib/mutant/mutator/node/named_value/access.rb +0 -8
- data/lib/mutant/mutator/node/named_value/constant_assignment.rb +1 -7
- data/lib/mutant/mutator/node/named_value/variable_assignment.rb +0 -4
- data/lib/mutant/mutator/node/next.rb +0 -2
- data/lib/mutant/mutator/node/noop.rb +0 -2
- data/lib/mutant/mutator/node/nthref.rb +0 -2
- data/lib/mutant/mutator/node/op_asgn.rb +0 -2
- data/lib/mutant/mutator/node/or_asgn.rb +0 -2
- data/lib/mutant/mutator/node/resbody.rb +0 -4
- data/lib/mutant/mutator/node/rescue.rb +0 -10
- data/lib/mutant/mutator/node/return.rb +0 -2
- data/lib/mutant/mutator/node/send.rb +4 -32
- data/lib/mutant/mutator/node/send/attribute_assignment.rb +0 -6
- data/lib/mutant/mutator/node/send/binary.rb +0 -6
- data/lib/mutant/mutator/node/send/index.rb +0 -6
- data/lib/mutant/mutator/node/splat.rb +0 -2
- data/lib/mutant/mutator/node/super.rb +0 -2
- data/lib/mutant/mutator/node/when.rb +0 -10
- data/lib/mutant/mutator/node/yield.rb +0 -2
- data/lib/mutant/mutator/node/zsuper.rb +0 -2
- data/lib/mutant/mutator/registry.rb +0 -6
- data/lib/mutant/mutator/util.rb +0 -4
- data/lib/mutant/mutator/util/array.rb +0 -6
- data/lib/mutant/mutator/util/symbol.rb +0 -2
- data/lib/mutant/parallel.rb +21 -17
- data/lib/mutant/parallel/master.rb +0 -28
- data/lib/mutant/parallel/source.rb +0 -10
- data/lib/mutant/parallel/worker.rb +15 -10
- data/lib/mutant/parser.rb +23 -0
- data/lib/mutant/reporter.rb +5 -8
- data/lib/mutant/reporter/cli.rb +1 -15
- data/lib/mutant/reporter/cli/format.rb +3 -25
- data/lib/mutant/reporter/cli/printer.rb +0 -18
- data/lib/mutant/reporter/cli/printer/config.rb +0 -2
- data/lib/mutant/reporter/cli/printer/env_progress.rb +0 -2
- data/lib/mutant/reporter/cli/printer/env_result.rb +0 -2
- data/lib/mutant/reporter/cli/printer/mutation_progress_result.rb +0 -4
- data/lib/mutant/reporter/cli/printer/mutation_result.rb +0 -16
- data/lib/mutant/reporter/cli/printer/status.rb +0 -6
- data/lib/mutant/reporter/cli/printer/status_progressive.rb +0 -4
- data/lib/mutant/reporter/cli/printer/subject_progress.rb +0 -8
- data/lib/mutant/reporter/cli/printer/subject_result.rb +0 -2
- data/lib/mutant/reporter/cli/printer/test_result.rb +0 -2
- data/lib/mutant/reporter/cli/tput.rb +0 -4
- data/lib/mutant/repository.rb +4 -22
- data/lib/mutant/require_highjack.rb +0 -2
- data/lib/mutant/result.rb +23 -43
- data/lib/mutant/runner.rb +7 -20
- data/lib/mutant/runner/sink.rb +43 -86
- data/lib/mutant/selector.rb +0 -2
- data/lib/mutant/selector/expression.rb +0 -2
- data/lib/mutant/subject.rb +0 -22
- data/lib/mutant/subject/method.rb +2 -10
- data/lib/mutant/subject/method/instance.rb +0 -6
- data/lib/mutant/subject/method/singleton.rb +0 -2
- data/lib/mutant/test.rb +4 -3
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/warning_filter.rb +0 -10
- data/lib/mutant/zombifier.rb +5 -20
- data/meta/or_asgn.rb +6 -0
- data/meta/send.rb +29 -0
- data/mutant-rspec.gemspec +1 -1
- data/spec/integration/mutant/rspec_spec.rb +1 -1
- data/spec/integrations.yml +2 -3
- data/spec/shared/method_matcher_behavior.rb +7 -7
- data/spec/spec_helper.rb +2 -9
- data/spec/support/corpus.rb +37 -30
- data/spec/support/rb_bug.rb +1 -2
- data/spec/support/ruby_vm.rb +6 -3
- data/spec/support/shared_context.rb +19 -20
- data/spec/unit/mutant/actor/binding_spec.rb +6 -6
- data/spec/unit/mutant/actor/env_spec.rb +2 -2
- data/spec/unit/mutant/actor/mailbox_spec.rb +6 -6
- data/spec/unit/mutant/actor/message_spec.rb +2 -2
- data/spec/unit/mutant/actor/receiver_spec.rb +4 -4
- data/spec/unit/mutant/actor/sender_spec.rb +6 -6
- data/spec/unit/mutant/ast_spec.rb +9 -0
- data/spec/unit/mutant/cli_spec.rb +16 -10
- data/spec/unit/mutant/context/scope/root_spec.rb +1 -1
- data/spec/unit/mutant/context/scope/unqualified_name_spec.rb +1 -1
- data/spec/unit/mutant/context/scope_spec.rb +3 -3
- data/spec/unit/mutant/context_spec.rb +0 -22
- data/spec/unit/mutant/env/boostrap_spec.rb +34 -41
- data/spec/unit/mutant/env_spec.rb +74 -32
- data/spec/unit/mutant/integration/rspec_spec.rb +23 -17
- data/spec/unit/mutant/integration_spec.rb +4 -4
- data/spec/unit/mutant/isolation_spec.rb +4 -4
- data/spec/unit/mutant/loader_spec.rb +42 -0
- data/spec/unit/mutant/matcher/compiler_spec.rb +3 -3
- data/spec/unit/mutant/matcher/config_spec.rb +1 -1
- data/spec/unit/mutant/matcher/method/instance_spec.rb +8 -1
- data/spec/unit/mutant/matcher/method/singleton_spec.rb +8 -1
- data/spec/unit/mutant/matcher/namespace_spec.rb +7 -8
- data/spec/unit/mutant/matcher/null_spec.rb +3 -2
- data/spec/unit/mutant/mutation_spec.rb +11 -5
- data/spec/unit/mutant/mutator/registry_spec.rb +1 -1
- data/spec/unit/mutant/parallel/master_spec.rb +9 -9
- data/spec/unit/mutant/parallel/source/array_spec.rb +3 -3
- data/spec/unit/mutant/parallel/worker_spec.rb +5 -5
- data/spec/unit/mutant/parallel_spec.rb +4 -4
- data/spec/unit/mutant/parser_spec.rb +24 -0
- data/spec/unit/mutant/reporter/cli/printer_spec.rb +3 -3
- data/spec/unit/mutant/reporter/cli/tput_spec.rb +2 -2
- data/spec/unit/mutant/reporter/cli_spec.rb +7 -7
- data/spec/unit/mutant/reporter/null_spec.rb +5 -4
- data/spec/unit/mutant/repository/diff_spec.rb +30 -18
- data/spec/unit/mutant/repository/subject_filter_spec.rb +5 -5
- data/spec/unit/mutant/require_highjack_spec.rb +1 -1
- data/spec/unit/mutant/result/env_spec.rb +9 -9
- data/spec/unit/mutant/result/subject_spec.rb +5 -5
- data/spec/unit/mutant/runner/driver_spec.rb +4 -4
- data/spec/unit/mutant/runner/{sink/mutation_spec.rb → sink_spec.rb} +16 -4
- data/spec/unit/mutant/runner_spec.rb +31 -31
- data/spec/unit/mutant/selector/expression_spec.rb +8 -8
- data/spec/unit/mutant/subject/method/instance_spec.rb +9 -3
- data/spec/unit/mutant/subject/method/singleton_spec.rb +1 -1
- data/spec/unit/mutant/subject_spec.rb +1 -5
- data/spec/unit/mutant_spec.rb +3 -3
- metadata +9 -15
- data/config/mutant.yml +0 -14
- data/lib/mutant/cache.rb +0 -29
- data/lib/mutant/reporter/trace.rb +0 -36
- data/spec/support/rspec.rb +0 -21
- data/spec/unit/mutant/cache_spec.rb +0 -22
- data/spec/unit/mutant/loader/eval_spec.rb +0 -44
- data/spec/unit/mutant/reporter/trace_spec.rb +0 -21
- data/test_app/Gemfile.rspec3.2 +0 -7
data/lib/mutant/expression.rb
CHANGED
@@ -13,8 +13,6 @@ module Mutant
|
|
13
13
|
# Syntax of expression
|
14
14
|
#
|
15
15
|
# @return [String]
|
16
|
-
#
|
17
|
-
# @api private
|
18
16
|
abstract_method :syntax
|
19
17
|
|
20
18
|
# Match length with other expression
|
@@ -22,8 +20,6 @@ module Mutant
|
|
22
20
|
# @param [Expression] other
|
23
21
|
#
|
24
22
|
# @return [Fixnum]
|
25
|
-
#
|
26
|
-
# @api private
|
27
23
|
def match_length(other)
|
28
24
|
if eql?(other)
|
29
25
|
syntax.length
|
@@ -37,8 +33,6 @@ module Mutant
|
|
37
33
|
# @param [Expression] other
|
38
34
|
#
|
39
35
|
# @return [Boolean]
|
40
|
-
#
|
41
|
-
# @api private
|
42
36
|
def prefix?(other)
|
43
37
|
!match_length(other).zero?
|
44
38
|
end
|
@@ -52,8 +46,6 @@ module Mutant
|
|
52
46
|
#
|
53
47
|
# @return [nil]
|
54
48
|
# otherwise
|
55
|
-
#
|
56
|
-
# @api private
|
57
49
|
def self.try_parse(input)
|
58
50
|
match = self::REGEXP.match(input)
|
59
51
|
return unless match
|
@@ -3,7 +3,12 @@ module Mutant
|
|
3
3
|
|
4
4
|
# Explicit method expression
|
5
5
|
class Method < self
|
6
|
-
include Anima.new(
|
6
|
+
include Anima.new(
|
7
|
+
:method_name,
|
8
|
+
:scope_name,
|
9
|
+
:scope_symbol
|
10
|
+
)
|
11
|
+
|
7
12
|
private(*anima.attribute_names)
|
8
13
|
|
9
14
|
MATCHERS = IceNine.deep_freeze(
|
@@ -23,8 +28,6 @@ module Mutant
|
|
23
28
|
# Syntax of expression
|
24
29
|
#
|
25
30
|
# @return [String]
|
26
|
-
#
|
27
|
-
# @api private
|
28
31
|
def syntax
|
29
32
|
[scope_name, scope_symbol, method_name].join
|
30
33
|
end
|
@@ -33,8 +36,6 @@ module Mutant
|
|
33
36
|
# Matcher for expression
|
34
37
|
#
|
35
38
|
# @return [Matcher]
|
36
|
-
#
|
37
|
-
# @api private
|
38
39
|
def matcher
|
39
40
|
methods_matcher = MATCHERS.fetch(scope_symbol).new(scope)
|
40
41
|
|
@@ -46,8 +47,6 @@ module Mutant
|
|
46
47
|
# Scope object
|
47
48
|
#
|
48
49
|
# @return [Class, Method]
|
49
|
-
#
|
50
|
-
# @api private
|
51
50
|
def scope
|
52
51
|
Object.const_get(scope_name)
|
53
52
|
end
|
@@ -3,7 +3,11 @@ module Mutant
|
|
3
3
|
|
4
4
|
# Abstract base class for methods expression
|
5
5
|
class Methods < self
|
6
|
-
include Anima.new(
|
6
|
+
include Anima.new(
|
7
|
+
:scope_name,
|
8
|
+
:scope_symbol
|
9
|
+
)
|
10
|
+
|
7
11
|
private(*anima.attribute_names)
|
8
12
|
|
9
13
|
MATCHERS = IceNine.deep_freeze(
|
@@ -17,8 +21,6 @@ module Mutant
|
|
17
21
|
# Syntax of expression
|
18
22
|
#
|
19
23
|
# @return [String]
|
20
|
-
#
|
21
|
-
# @api private
|
22
24
|
def syntax
|
23
25
|
[scope_name, scope_symbol].join
|
24
26
|
end
|
@@ -27,8 +29,6 @@ module Mutant
|
|
27
29
|
# Matcher on expression
|
28
30
|
#
|
29
31
|
# @return [Matcher::Method]
|
30
|
-
#
|
31
|
-
# @api private
|
32
32
|
def matcher
|
33
33
|
MATCHERS.fetch(scope_symbol).new(scope)
|
34
34
|
end
|
@@ -38,8 +38,6 @@ module Mutant
|
|
38
38
|
# @param [Expression] expression
|
39
39
|
#
|
40
40
|
# @return [Fixnum]
|
41
|
-
#
|
42
|
-
# @api private
|
43
41
|
def match_length(expression)
|
44
42
|
if expression.syntax.start_with?(syntax)
|
45
43
|
syntax.length
|
@@ -53,8 +51,6 @@ module Mutant
|
|
53
51
|
# Scope object
|
54
52
|
#
|
55
53
|
# @return [Class, Method]
|
56
|
-
#
|
57
|
-
# @api private
|
58
54
|
def scope
|
59
55
|
Object.const_get(scope_name)
|
60
56
|
end
|
@@ -12,8 +12,6 @@ module Mutant
|
|
12
12
|
# Initialize object
|
13
13
|
#
|
14
14
|
# @return [undefined]
|
15
|
-
#
|
16
|
-
# @api private
|
17
15
|
def initialize(*)
|
18
16
|
super
|
19
17
|
@recursion_pattern = Regexp.union(
|
@@ -26,8 +24,6 @@ module Mutant
|
|
26
24
|
# Syntax for expression
|
27
25
|
#
|
28
26
|
# @return [String]
|
29
|
-
#
|
30
|
-
# @api private
|
31
27
|
def syntax
|
32
28
|
"#{scope_name}*"
|
33
29
|
end
|
@@ -36,8 +32,6 @@ module Mutant
|
|
36
32
|
# Matcher for expression
|
37
33
|
#
|
38
34
|
# @return [Matcher]
|
39
|
-
#
|
40
|
-
# @api private
|
41
35
|
def matcher
|
42
36
|
Matcher::Namespace.new(self)
|
43
37
|
end
|
@@ -47,8 +41,6 @@ module Mutant
|
|
47
41
|
# @param [Expression] expression
|
48
42
|
#
|
49
43
|
# @return [Fixnum]
|
50
|
-
#
|
51
|
-
# @api private
|
52
44
|
def match_length(expression)
|
53
45
|
if @recursion_pattern =~ expression.syntax
|
54
46
|
scope_name.length
|
@@ -70,8 +62,6 @@ module Mutant
|
|
70
62
|
# Matcher matcher on expression
|
71
63
|
#
|
72
64
|
# @return [Matcher]
|
73
|
-
#
|
74
|
-
# @api private
|
75
65
|
def matcher
|
76
66
|
Matcher::Scope.new(Object.const_get(scope_name))
|
77
67
|
end
|
@@ -79,9 +69,6 @@ module Mutant
|
|
79
69
|
# Syntax for expression
|
80
70
|
#
|
81
71
|
# @return [String]
|
82
|
-
#
|
83
|
-
# @api private
|
84
|
-
#
|
85
72
|
alias_method :syntax, :scope_name
|
86
73
|
public :syntax
|
87
74
|
|
@@ -22,8 +22,6 @@ module Mutant
|
|
22
22
|
#
|
23
23
|
# @raise [ParserError]
|
24
24
|
# otherwise
|
25
|
-
#
|
26
|
-
# @api private
|
27
25
|
def call(input)
|
28
26
|
try_parse(input) or fail InvalidExpressionError, "Expression: #{input.inspect} is not valid"
|
29
27
|
end
|
@@ -37,8 +35,6 @@ module Mutant
|
|
37
35
|
#
|
38
36
|
# @return [nil]
|
39
37
|
# otherwise
|
40
|
-
#
|
41
|
-
# @api private
|
42
38
|
def try_parse(input)
|
43
39
|
expressions = expressions(input)
|
44
40
|
case expressions.length
|
@@ -57,8 +53,6 @@ module Mutant
|
|
57
53
|
#
|
58
54
|
# @return [Array<Expression>]
|
59
55
|
# if expressions can be parsed from input
|
60
|
-
#
|
61
|
-
# @api private
|
62
56
|
def expressions(input)
|
63
57
|
types.each_with_object([]) do |type, aggregate|
|
64
58
|
expression = type.try_parse(input)
|
data/lib/mutant/integration.rb
CHANGED
@@ -11,8 +11,6 @@ module Mutant
|
|
11
11
|
# @param [String] name
|
12
12
|
#
|
13
13
|
# @return [Integration]
|
14
|
-
#
|
15
|
-
# @api private
|
16
14
|
def self.setup(name)
|
17
15
|
require "mutant/integration/#{name}"
|
18
16
|
lookup(name)
|
@@ -24,8 +22,6 @@ module Mutant
|
|
24
22
|
#
|
25
23
|
# @return [Integration]
|
26
24
|
# if found
|
27
|
-
#
|
28
|
-
# @api private
|
29
25
|
def self.lookup(name)
|
30
26
|
REGISTRY.fetch(name)
|
31
27
|
end
|
@@ -35,8 +31,6 @@ module Mutant
|
|
35
31
|
# @param [String] name
|
36
32
|
#
|
37
33
|
# @return [undefined]
|
38
|
-
#
|
39
|
-
# @api private
|
40
34
|
def self.register(name)
|
41
35
|
REGISTRY[name] = self
|
42
36
|
end
|
@@ -45,8 +39,6 @@ module Mutant
|
|
45
39
|
# Perform integration setup
|
46
40
|
#
|
47
41
|
# @return [self]
|
48
|
-
#
|
49
|
-
# @api private
|
50
42
|
def setup
|
51
43
|
self
|
52
44
|
end
|
@@ -56,15 +48,11 @@ module Mutant
|
|
56
48
|
# @param [Enumerable<Test>] tests
|
57
49
|
#
|
58
50
|
# @return [Result::Test]
|
59
|
-
#
|
60
|
-
# @api private
|
61
51
|
abstract_method :call
|
62
52
|
|
63
53
|
# Available tests for integration
|
64
54
|
#
|
65
55
|
# @return [Enumerable<Test>]
|
66
|
-
#
|
67
|
-
# @api private
|
68
56
|
abstract_method :all_tests
|
69
57
|
|
70
58
|
private
|
@@ -72,8 +60,6 @@ module Mutant
|
|
72
60
|
# Expression parser
|
73
61
|
#
|
74
62
|
# @return [Expression::Parser]
|
75
|
-
#
|
76
|
-
# @api private
|
77
63
|
def expression_parser
|
78
64
|
config.expression_parser
|
79
65
|
end
|
@@ -86,8 +72,6 @@ module Mutant
|
|
86
72
|
# Available tests for integration
|
87
73
|
#
|
88
74
|
# @return [Enumerable<Test>]
|
89
|
-
#
|
90
|
-
# @api private
|
91
75
|
def all_tests
|
92
76
|
EMPTY_ARRAY
|
93
77
|
end
|
@@ -97,14 +81,12 @@ module Mutant
|
|
97
81
|
# @param [Enumerable<Mutant::Test>] tests
|
98
82
|
#
|
99
83
|
# @return [Result::Test]
|
100
|
-
#
|
101
|
-
# @api private
|
102
84
|
def call(tests)
|
103
85
|
Result::Test.new(
|
104
|
-
tests: tests,
|
105
86
|
output: '',
|
87
|
+
passed: true,
|
106
88
|
runtime: 0.0,
|
107
|
-
|
89
|
+
tests: tests
|
108
90
|
)
|
109
91
|
end
|
110
92
|
|
data/lib/mutant/isolation.rb
CHANGED
@@ -11,8 +11,6 @@ module Mutant
|
|
11
11
|
#
|
12
12
|
# @raise [Error]
|
13
13
|
# if block terminates abnormal
|
14
|
-
#
|
15
|
-
# @api private
|
16
14
|
def self.call(&block)
|
17
15
|
block.call
|
18
16
|
rescue => exception
|
@@ -35,8 +33,6 @@ module Mutant
|
|
35
33
|
# if block terminates abnormal
|
36
34
|
#
|
37
35
|
# rubocop:disable MethodLength
|
38
|
-
#
|
39
|
-
# @api private
|
40
36
|
def self.call(&block)
|
41
37
|
IO.pipe(binmode: true) do |reader, writer|
|
42
38
|
writer.binmode
|
data/lib/mutant/loader.rb
CHANGED
@@ -1,42 +1,27 @@
|
|
1
1
|
module Mutant
|
2
2
|
# Base class for code loaders
|
3
3
|
class Loader
|
4
|
-
include
|
4
|
+
include Anima.new(:binding, :kernel, :node, :subject)
|
5
5
|
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
#
|
13
|
-
# One off the very few valid uses of eval
|
14
|
-
#
|
15
|
-
# rubocop:disable Lint/Eval
|
16
|
-
#
|
17
|
-
# @api private
|
18
|
-
def call
|
19
|
-
eval(
|
20
|
-
source,
|
21
|
-
TOPLEVEL_BINDING,
|
22
|
-
subject.source_path.to_s,
|
23
|
-
subject.source_line
|
24
|
-
)
|
25
|
-
self
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
# Source generated from AST
|
31
|
-
#
|
32
|
-
# @return [String]
|
33
|
-
#
|
34
|
-
# @api private
|
35
|
-
def source
|
36
|
-
Unparser.unparse(root)
|
37
|
-
end
|
38
|
-
|
39
|
-
end # Eval
|
6
|
+
# Call loader
|
7
|
+
#
|
8
|
+
# @return [self]
|
9
|
+
def self.call(*arguments)
|
10
|
+
new(*arguments).call
|
11
|
+
end
|
40
12
|
|
13
|
+
# Call loader
|
14
|
+
#
|
15
|
+
# One off the very few valid uses of eval
|
16
|
+
#
|
17
|
+
# @return [undefined]
|
18
|
+
def call
|
19
|
+
kernel.eval(
|
20
|
+
Unparser.unparse(node),
|
21
|
+
binding,
|
22
|
+
subject.source_path.to_s,
|
23
|
+
subject.source_line
|
24
|
+
)
|
25
|
+
end
|
41
26
|
end # Loader
|
42
27
|
end # Mutant
|
data/lib/mutant/matcher.rb
CHANGED
data/lib/mutant/matcher/chain.rb
CHANGED
@@ -8,8 +8,6 @@ module Mutant
|
|
8
8
|
# Generated matcher
|
9
9
|
#
|
10
10
|
# @return [Matcher]
|
11
|
-
#
|
12
|
-
# @api private
|
13
11
|
def result
|
14
12
|
Filter.new(
|
15
13
|
Chain.new(config.match_expressions.map(&:matcher)),
|
@@ -29,8 +27,6 @@ module Mutant
|
|
29
27
|
# Test if subject expression is matched by prefix
|
30
28
|
#
|
31
29
|
# @return [Boolean]
|
32
|
-
#
|
33
|
-
# @api private
|
34
30
|
def call(subject)
|
35
31
|
expression.prefix?(subject.expression)
|
36
32
|
end
|
@@ -42,8 +38,6 @@ module Mutant
|
|
42
38
|
# Predicate returning false on expression ignored subject
|
43
39
|
#
|
44
40
|
# @return [#call]
|
45
|
-
#
|
46
|
-
# @api private
|
47
41
|
def ignored_subjects
|
48
42
|
Morpher::Evaluator::Predicate::Boolean::Negation.new(
|
49
43
|
Morpher::Evaluator::Predicate::Boolean::Or.new(
|
@@ -55,8 +49,6 @@ module Mutant
|
|
55
49
|
# Predicate returning false on filtered subject
|
56
50
|
#
|
57
51
|
# @return [#call]
|
58
|
-
#
|
59
|
-
# @api private
|
60
52
|
def filtered_subjects
|
61
53
|
Morpher::Evaluator::Predicate::Boolean::And.new(config.subject_filters)
|
62
54
|
end
|
@@ -3,8 +3,8 @@ module Mutant
|
|
3
3
|
# Subject matcher configuration
|
4
4
|
class Config
|
5
5
|
include Adamantium, Anima.new(
|
6
|
-
:match_expressions,
|
7
6
|
:ignore_expressions,
|
7
|
+
:match_expressions,
|
8
8
|
:subject_filters
|
9
9
|
)
|
10
10
|
|
@@ -14,8 +14,8 @@ module Mutant
|
|
14
14
|
ENUM_DELIMITER = ','.freeze
|
15
15
|
EMPTY_ATTRIBUTES = 'empty'.freeze
|
16
16
|
PRESENTATIONS = IceNine.deep_freeze(
|
17
|
-
match_expressions: :syntax,
|
18
17
|
ignore_expressions: :syntax,
|
18
|
+
match_expressions: :syntax,
|
19
19
|
subject_filters: :inspect
|
20
20
|
)
|
21
21
|
private_constant(*constants(false))
|
@@ -25,8 +25,6 @@ module Mutant
|
|
25
25
|
# Inspection string
|
26
26
|
#
|
27
27
|
# @return [String]
|
28
|
-
#
|
29
|
-
# @api private
|
30
28
|
def inspect
|
31
29
|
INSPECT_FORMAT % inspect_attributes
|
32
30
|
end
|
@@ -38,8 +36,6 @@ module Mutant
|
|
38
36
|
# @param [Object] value
|
39
37
|
#
|
40
38
|
# @return [Config]
|
41
|
-
#
|
42
|
-
# @api private
|
43
39
|
def add(attribute, value)
|
44
40
|
with(attribute => public_send(attribute) + [value])
|
45
41
|
end
|
@@ -49,8 +45,6 @@ module Mutant
|
|
49
45
|
# Present attributes
|
50
46
|
#
|
51
47
|
# @return [Array<Symbol>]
|
52
|
-
#
|
53
|
-
# @api private
|
54
48
|
def present_attributes
|
55
49
|
to_h.reject { |_key, value| value.empty? }.keys
|
56
50
|
end
|
@@ -58,8 +52,6 @@ module Mutant
|
|
58
52
|
# Formatted attributes
|
59
53
|
#
|
60
54
|
# @return [String]
|
61
|
-
#
|
62
|
-
# @api private
|
63
55
|
def inspect_attributes
|
64
56
|
attributes = present_attributes
|
65
57
|
.map(&method(:format_attribute))
|