mutant 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- 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/runner.rb
CHANGED
@@ -8,7 +8,6 @@ module Mutant
|
|
8
8
|
# @return [undefined]
|
9
9
|
#
|
10
10
|
# @api private
|
11
|
-
#
|
12
11
|
def initialize(*)
|
13
12
|
super
|
14
13
|
|
@@ -17,25 +16,21 @@ module Mutant
|
|
17
16
|
run_mutation_analysis
|
18
17
|
end
|
19
18
|
|
20
|
-
#
|
19
|
+
# Final result
|
21
20
|
#
|
22
21
|
# @return [Result::Env]
|
23
22
|
#
|
24
23
|
# @api private
|
25
|
-
#
|
26
24
|
attr_reader :result
|
27
25
|
|
28
26
|
private
|
29
27
|
|
30
28
|
# Run mutation analysis
|
31
29
|
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
# @api private
|
30
|
+
# @return [undefined]
|
35
31
|
#
|
32
|
+
# @api private
|
36
33
|
def run_mutation_analysis
|
37
|
-
config.integration.setup
|
38
|
-
|
39
34
|
@result = run_driver(Parallel.async(mutation_test_config))
|
40
35
|
reporter.report(@result)
|
41
36
|
end
|
@@ -48,7 +43,6 @@ module Mutant
|
|
48
43
|
# the last returned status payload
|
49
44
|
#
|
50
45
|
# @api private
|
51
|
-
#
|
52
46
|
def run_driver(driver)
|
53
47
|
status = nil
|
54
48
|
|
@@ -64,12 +58,11 @@ module Mutant
|
|
64
58
|
status.payload
|
65
59
|
end
|
66
60
|
|
67
|
-
#
|
61
|
+
# Confiugation for paralell execution engine
|
68
62
|
#
|
69
|
-
# @return [
|
63
|
+
# @return [Parallel::Config]
|
70
64
|
#
|
71
65
|
# @api private
|
72
|
-
#
|
73
66
|
def mutation_test_config
|
74
67
|
Parallel::Config.new(
|
75
68
|
env: env.actor_env,
|
@@ -80,22 +73,20 @@ module Mutant
|
|
80
73
|
)
|
81
74
|
end
|
82
75
|
|
83
|
-
#
|
76
|
+
# Reporter to use
|
84
77
|
#
|
85
78
|
# @return [Reporter]
|
86
79
|
#
|
87
80
|
# @api private
|
88
|
-
#
|
89
81
|
def reporter
|
90
82
|
env.config.reporter
|
91
83
|
end
|
92
84
|
|
93
|
-
#
|
85
|
+
# Config for this mutant execution
|
94
86
|
#
|
95
87
|
# @return [Config]
|
96
88
|
#
|
97
89
|
# @api private
|
98
|
-
#
|
99
90
|
def config
|
100
91
|
env.config
|
101
92
|
end
|
data/lib/mutant/runner/sink.rb
CHANGED
@@ -4,12 +4,11 @@ module Mutant
|
|
4
4
|
class Sink
|
5
5
|
include AbstractType
|
6
6
|
|
7
|
-
#
|
7
|
+
# sink status
|
8
8
|
#
|
9
9
|
# @return [Object]
|
10
10
|
#
|
11
11
|
# @api private
|
12
|
-
#
|
13
12
|
abstract_method :status
|
14
13
|
|
15
14
|
# Test if computation should be stopped
|
@@ -17,7 +16,6 @@ module Mutant
|
|
17
16
|
# @return [Boolean]
|
18
17
|
#
|
19
18
|
# @api private
|
20
|
-
#
|
21
19
|
abstract_method :stop?
|
22
20
|
|
23
21
|
# Consume result
|
@@ -27,7 +25,6 @@ module Mutant
|
|
27
25
|
# @return [self]
|
28
26
|
#
|
29
27
|
# @api private
|
30
|
-
#
|
31
28
|
abstract_method :result
|
32
29
|
|
33
30
|
# Mutation result sink
|
@@ -39,7 +36,6 @@ module Mutant
|
|
39
36
|
# @return [undefined]
|
40
37
|
#
|
41
38
|
# @api private
|
42
|
-
#
|
43
39
|
def initialize(*)
|
44
40
|
super
|
45
41
|
@start = Time.now
|
@@ -52,12 +48,11 @@ module Mutant
|
|
52
48
|
end
|
53
49
|
end
|
54
50
|
|
55
|
-
#
|
51
|
+
# Runner status
|
56
52
|
#
|
57
53
|
# @return [Status]
|
58
54
|
#
|
59
55
|
# @api private
|
60
|
-
#
|
61
56
|
def status
|
62
57
|
env_result
|
63
58
|
end
|
@@ -67,7 +62,6 @@ module Mutant
|
|
67
62
|
# @return [Boolean]
|
68
63
|
#
|
69
64
|
# @api private
|
70
|
-
#
|
71
65
|
def stop?
|
72
66
|
env.config.fail_fast && !env_result.subject_results.all?(&:success?)
|
73
67
|
end
|
@@ -79,7 +73,6 @@ module Mutant
|
|
79
73
|
# @return [self]
|
80
74
|
#
|
81
75
|
# @api private
|
82
|
-
#
|
83
76
|
def result(mutation_result)
|
84
77
|
mutation = mutation_result.mutation
|
85
78
|
|
@@ -95,12 +88,11 @@ module Mutant
|
|
95
88
|
|
96
89
|
private
|
97
90
|
|
98
|
-
#
|
91
|
+
# Current result
|
99
92
|
#
|
100
93
|
# @return [Result::Env]
|
101
94
|
#
|
102
95
|
# @api private
|
103
|
-
#
|
104
96
|
def env_result
|
105
97
|
Result::Env.new(
|
106
98
|
env: env,
|
data/lib/mutant/selector.rb
CHANGED
@@ -3,14 +3,13 @@ module Mutant
|
|
3
3
|
class Selector
|
4
4
|
include AbstractType, Adamantium::Flat
|
5
5
|
|
6
|
-
#
|
6
|
+
# Tests for subject
|
7
7
|
#
|
8
8
|
# @param [Subject] subjecto
|
9
9
|
#
|
10
10
|
# @return [Enumerable<Test>]
|
11
11
|
#
|
12
12
|
# @api private
|
13
|
-
#
|
14
13
|
abstract_method :call
|
15
14
|
|
16
15
|
end # Selector
|
@@ -4,14 +4,13 @@ module Mutant
|
|
4
4
|
class Expression < self
|
5
5
|
include Concord.new(:integration)
|
6
6
|
|
7
|
-
#
|
7
|
+
# Tests for subject
|
8
8
|
#
|
9
9
|
# @param [Subject] subject
|
10
10
|
#
|
11
11
|
# @return [Enumerable<Test>]
|
12
12
|
#
|
13
13
|
# @api private
|
14
|
-
#
|
15
14
|
def call(subject)
|
16
15
|
subject.match_expressions.each do |match_expression|
|
17
16
|
subject_tests = integration.all_tests.select do |test|
|
data/lib/mutant/subject.rb
CHANGED
@@ -4,13 +4,12 @@ module Mutant
|
|
4
4
|
include AbstractType, Adamantium::Flat, Enumerable
|
5
5
|
include Concord::Public.new(:context, :node)
|
6
6
|
|
7
|
-
#
|
7
|
+
# Mutations for this subject
|
8
8
|
#
|
9
9
|
# @return [Enumerable<Mutation>]
|
10
10
|
# @return [undefined]
|
11
11
|
#
|
12
12
|
# @api private
|
13
|
-
#
|
14
13
|
def mutations
|
15
14
|
mutations = [neutral_mutation]
|
16
15
|
Mutator.each(node) do |mutant|
|
@@ -20,94 +19,85 @@ module Mutant
|
|
20
19
|
end
|
21
20
|
memoize :mutations
|
22
21
|
|
23
|
-
#
|
22
|
+
# Source path
|
24
23
|
#
|
25
24
|
# @return [String]
|
26
25
|
#
|
27
26
|
# @api private
|
28
|
-
#
|
29
27
|
def source_path
|
30
28
|
context.source_path
|
31
29
|
end
|
32
30
|
|
33
|
-
# Prepare
|
31
|
+
# Prepare subject for insertion of mutation
|
34
32
|
#
|
35
33
|
# @return [self]
|
36
34
|
#
|
37
35
|
# @api private
|
38
|
-
#
|
39
36
|
def prepare
|
40
37
|
self
|
41
38
|
end
|
42
39
|
|
43
|
-
#
|
40
|
+
# Source line range
|
44
41
|
#
|
45
42
|
# @return [Range<Fixnum>]
|
46
43
|
#
|
47
44
|
# @api private
|
48
|
-
#
|
49
45
|
def source_lines
|
50
46
|
expression = node.location.expression
|
51
47
|
expression.line..expression.source_buffer.decompose_position(expression.end_pos).first
|
52
48
|
end
|
53
49
|
memoize :source_lines
|
54
50
|
|
55
|
-
#
|
51
|
+
# First source line
|
56
52
|
#
|
57
53
|
# @return [Fixnum]
|
58
54
|
#
|
59
55
|
# @api private
|
60
|
-
#
|
61
56
|
def source_line
|
62
57
|
source_lines.begin
|
63
58
|
end
|
64
59
|
|
65
|
-
#
|
60
|
+
# Identification string
|
66
61
|
#
|
67
62
|
# @return [String]
|
68
63
|
#
|
69
64
|
# @api private
|
70
|
-
#
|
71
65
|
def identification
|
72
66
|
"#{expression.syntax}:#{source_path}:#{source_line}"
|
73
67
|
end
|
74
68
|
memoize :identification
|
75
69
|
|
76
|
-
#
|
70
|
+
# Source representation of AST
|
77
71
|
#
|
78
72
|
# @return [String]
|
79
73
|
#
|
80
74
|
# @api private
|
81
|
-
#
|
82
75
|
def source
|
83
76
|
Unparser.unparse(wrap_node(node))
|
84
77
|
end
|
85
78
|
memoize :source
|
86
79
|
|
87
|
-
#
|
80
|
+
# Match expression
|
88
81
|
#
|
89
82
|
# @return [Expression]
|
90
83
|
#
|
91
84
|
# @api private
|
92
|
-
#
|
93
85
|
abstract_method :expression
|
94
86
|
|
95
|
-
#
|
87
|
+
# Match expressions
|
96
88
|
#
|
97
89
|
# @return [Enumerable<Expression>]
|
98
90
|
#
|
99
91
|
# @api private
|
100
|
-
#
|
101
92
|
abstract_method :match_expressions
|
102
93
|
|
103
94
|
private
|
104
95
|
|
105
|
-
#
|
96
|
+
# Neutral mutation
|
106
97
|
#
|
107
98
|
# @return [Mutation::Neutral]
|
108
99
|
#
|
109
100
|
# @api private
|
110
|
-
#
|
111
101
|
def neutral_mutation
|
112
102
|
Mutation::Neutral.new(self, wrap_node(node))
|
113
103
|
end
|
@@ -119,7 +109,6 @@ module Mutant
|
|
119
109
|
# @return [Parser::AST::Node]
|
120
110
|
#
|
121
111
|
# @api private
|
122
|
-
#
|
123
112
|
def wrap_node(node)
|
124
113
|
node
|
125
114
|
end
|
@@ -8,36 +8,36 @@ module Mutant
|
|
8
8
|
# @return [Boolean]
|
9
9
|
#
|
10
10
|
# @api private
|
11
|
-
#
|
12
11
|
abstract_method :public?
|
13
12
|
|
14
|
-
#
|
13
|
+
# Method name
|
15
14
|
#
|
16
|
-
# @return [
|
15
|
+
# @return [Expression]
|
17
16
|
#
|
18
17
|
# @api private
|
19
|
-
#
|
20
18
|
def name
|
21
|
-
node.children
|
19
|
+
node.children.fetch(self.class::NAME_INDEX)
|
22
20
|
end
|
23
21
|
|
24
|
-
#
|
22
|
+
# Match expression
|
25
23
|
#
|
26
24
|
# @return [String]
|
27
25
|
#
|
28
26
|
# @api private
|
29
|
-
#
|
30
27
|
def expression
|
31
|
-
Expression.
|
28
|
+
Expression::Method.new(
|
29
|
+
scope_symbol: self.class::SYMBOL,
|
30
|
+
scope_name: scope.name,
|
31
|
+
method_name: name.to_s
|
32
|
+
)
|
32
33
|
end
|
33
34
|
memoize :expression
|
34
35
|
|
35
|
-
#
|
36
|
+
# Match expressions
|
36
37
|
#
|
37
38
|
# @return [Array<Expression>]
|
38
39
|
#
|
39
40
|
# @api private
|
40
|
-
#
|
41
41
|
def match_expressions
|
42
42
|
[expression].concat(context.match_expressions)
|
43
43
|
end
|
@@ -45,12 +45,11 @@ module Mutant
|
|
45
45
|
|
46
46
|
private
|
47
47
|
|
48
|
-
#
|
48
|
+
# The scope
|
49
49
|
#
|
50
50
|
# @return [Class, Module]
|
51
51
|
#
|
52
52
|
# @api private
|
53
|
-
#
|
54
53
|
def scope
|
55
54
|
context.scope
|
56
55
|
end
|
@@ -12,7 +12,6 @@ module Mutant
|
|
12
12
|
# @return [Boolean]
|
13
13
|
#
|
14
14
|
# @api private
|
15
|
-
#
|
16
15
|
def public?
|
17
16
|
scope.public_method_defined?(name)
|
18
17
|
end
|
@@ -23,7 +22,6 @@ module Mutant
|
|
23
22
|
# @return [self]
|
24
23
|
#
|
25
24
|
# @api private
|
26
|
-
#
|
27
25
|
def prepare
|
28
26
|
scope.__send__(:undef_method, name)
|
29
27
|
self
|
@@ -38,7 +36,6 @@ module Mutant
|
|
38
36
|
# @return [self]
|
39
37
|
#
|
40
38
|
# @api private
|
41
|
-
#
|
42
39
|
def prepare
|
43
40
|
scope.__send__(:memoized_methods).instance_variable_get(:@memory).delete(name)
|
44
41
|
super
|
@@ -47,14 +44,13 @@ module Mutant
|
|
47
44
|
|
48
45
|
private
|
49
46
|
|
50
|
-
#
|
47
|
+
# Memoizer node for mutant
|
51
48
|
#
|
52
49
|
# @param [Parser::AST::Node] mutant
|
53
50
|
#
|
54
51
|
# @return [Parser::AST::Node]
|
55
52
|
#
|
56
53
|
# @api private
|
57
|
-
#
|
58
54
|
def wrap_node(mutant)
|
59
55
|
s(:begin, mutant, s(:send, nil, :memoize, s(:args, s(:sym, name))))
|
60
56
|
end
|
@@ -5,14 +5,13 @@ module Mutant
|
|
5
5
|
class Singleton < self
|
6
6
|
|
7
7
|
NAME_INDEX = 1
|
8
|
-
SYMBOL
|
8
|
+
SYMBOL = '.'.freeze
|
9
9
|
|
10
10
|
# Test if method is public
|
11
11
|
#
|
12
12
|
# @return [Boolean]
|
13
13
|
#
|
14
14
|
# @api private
|
15
|
-
#
|
16
15
|
def public?
|
17
16
|
scope.singleton_class.public_method_defined?(name)
|
18
17
|
end
|
@@ -23,7 +22,6 @@ module Mutant
|
|
23
22
|
# @return [self]
|
24
23
|
#
|
25
24
|
# @api private
|
26
|
-
#
|
27
25
|
def prepare
|
28
26
|
scope.singleton_class.__send__(:undef_method, name)
|
29
27
|
self
|
data/lib/mutant/test.rb
CHANGED