mutant 0.12.1 → 0.12.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mutant/ast/named_children.rb +2 -2
- data/lib/mutant/ast/pattern/lexer.rb +6 -6
- data/lib/mutant/ast/pattern/parser.rb +9 -9
- data/lib/mutant/ast/structure.rb +1 -1
- data/lib/mutant/ast.rb +1 -1
- data/lib/mutant/bootstrap.rb +12 -12
- data/lib/mutant/cli/command/environment/test.rb +2 -2
- data/lib/mutant/cli/command/environment.rb +8 -8
- data/lib/mutant/cli/command/util.rb +2 -2
- data/lib/mutant/cli/command.rb +8 -8
- data/lib/mutant/cli.rb +1 -1
- data/lib/mutant/config.rb +6 -7
- data/lib/mutant/env.rb +10 -10
- data/lib/mutant/expression/descendants.rb +1 -1
- data/lib/mutant/expression/method.rb +2 -2
- data/lib/mutant/expression/methods.rb +2 -2
- data/lib/mutant/expression/parser.rb +4 -5
- data/lib/mutant/expression/source.rb +3 -3
- data/lib/mutant/integration.rb +2 -2
- data/lib/mutant/isolation/fork.rb +4 -4
- data/lib/mutant/isolation/none.rb +2 -2
- data/lib/mutant/matcher/descendants.rb +1 -1
- data/lib/mutant/matcher/method/instance.rb +3 -3
- data/lib/mutant/matcher/method/metaclass.rb +2 -2
- data/lib/mutant/matcher/method/singleton.rb +1 -1
- data/lib/mutant/matcher/method.rb +5 -19
- data/lib/mutant/matcher/methods.rb +2 -2
- data/lib/mutant/matcher/namespace.rb +1 -1
- data/lib/mutant/matcher/scope.rb +1 -1
- data/lib/mutant/matcher.rb +1 -1
- data/lib/mutant/meta/example/verification.rb +1 -1
- data/lib/mutant/meta/example.rb +4 -4
- data/lib/mutant/meta.rb +1 -1
- data/lib/mutant/mutation/runner/sink.rb +3 -3
- data/lib/mutant/mutation/runner.rb +1 -1
- data/lib/mutant/mutation.rb +2 -2
- data/lib/mutant/mutator/node/block.rb +1 -1
- data/lib/mutant/mutator/node/break.rb +1 -1
- data/lib/mutant/mutator/node/index.rb +1 -1
- data/lib/mutant/mutator/node/kwbegin.rb +1 -1
- data/lib/mutant/mutator/node/named_value/access.rb +1 -1
- data/lib/mutant/mutator/node/next.rb +1 -1
- data/lib/mutant/mutator/node/send/conditional.rb +1 -1
- data/lib/mutant/mutator/node/send.rb +1 -1
- data/lib/mutant/mutator/node/super.rb +0 -1
- data/lib/mutant/mutator/node/yield.rb +1 -1
- data/lib/mutant/mutator/node/zsuper.rb +0 -1
- data/lib/mutant/mutator/node.rb +5 -5
- data/lib/mutant/mutator/regexp.rb +2 -2
- data/lib/mutant/parallel/connection.rb +2 -2
- data/lib/mutant/parallel/pipe.rb +2 -2
- data/lib/mutant/parallel/worker.rb +10 -10
- data/lib/mutant/parallel.rb +3 -3
- data/lib/mutant/parser.rb +1 -1
- data/lib/mutant/registry.rb +1 -1
- data/lib/mutant/reporter/cli/format.rb +1 -1
- data/lib/mutant/reporter/cli/printer/isolation_result.rb +2 -2
- data/lib/mutant/reporter/cli/printer/status_progressive.rb +1 -1
- data/lib/mutant/reporter/cli/printer/test.rb +1 -1
- data/lib/mutant/reporter/cli/printer.rb +1 -1
- data/lib/mutant/reporter/cli.rb +3 -3
- data/lib/mutant/repository/diff.rb +6 -5
- data/lib/mutant/segment/recorder.rb +8 -8
- data/lib/mutant/subject/config.rb +1 -1
- data/lib/mutant/subject/method/instance.rb +1 -1
- data/lib/mutant/subject.rb +1 -1
- data/lib/mutant/test/runner/sink.rb +1 -1
- data/lib/mutant/test/runner.rb +1 -1
- data/lib/mutant/timer.rb +2 -2
- data/lib/mutant/transform.rb +20 -20
- data/lib/mutant/variable.rb +2 -2
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/world.rb +7 -7
- data/lib/mutant.rb +8 -8
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0c3d3cd37cf5828adc4b80c8ba1d0b51c4d0ae372745841c58d5945934938fa
|
4
|
+
data.tar.gz: 2c2f98e60fa4676123916cca4829557c91fe3233bfdaf264b3f4b3165930bd28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 946e48362be2a8a9c619280143ff09ae8b3c1a00cca7e6e5bbc6e436b1325f6c9d55cd3c1834b800e813a0a6ff4e9bd62456ce9504402bd99ab9802d15b809f5
|
7
|
+
data.tar.gz: a425a10f6af02f315e3e11e88c3595577f9c599511ed54b9bb454f42604dff0697769cdd41bdab01a446f4cc99d279f1ea60e72e4e80be0c1242d2fd0dd50486
|
@@ -43,7 +43,7 @@ module Mutant
|
|
43
43
|
@line_index = 0
|
44
44
|
@line_start = 0
|
45
45
|
@next_position = 0
|
46
|
-
@source = Source.new(string:
|
46
|
+
@source = Source.new(string:)
|
47
47
|
@string = string
|
48
48
|
@tokens = []
|
49
49
|
end
|
@@ -77,13 +77,13 @@ module Mutant
|
|
77
77
|
|
78
78
|
advance_position
|
79
79
|
|
80
|
-
@tokens << token(type
|
80
|
+
@tokens << token(type:, start_position:)
|
81
81
|
end
|
82
82
|
|
83
83
|
def token(type:, start_position:, value: nil)
|
84
84
|
Token.new(
|
85
|
-
type
|
86
|
-
value
|
85
|
+
type:,
|
86
|
+
value:,
|
87
87
|
location: Source::Location.new(
|
88
88
|
source: @source,
|
89
89
|
line_index: @line_index,
|
@@ -101,7 +101,7 @@ module Mutant
|
|
101
101
|
if valid_string?(token.value)
|
102
102
|
@tokens << token
|
103
103
|
else
|
104
|
-
@error = Error::InvalidToken.new(token:
|
104
|
+
@error = Error::InvalidToken.new(token:)
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
@@ -123,7 +123,7 @@ module Mutant
|
|
123
123
|
token(
|
124
124
|
type: :string,
|
125
125
|
value: string,
|
126
|
-
start_position:
|
126
|
+
start_position:
|
127
127
|
)
|
128
128
|
end
|
129
129
|
|
@@ -28,7 +28,7 @@ module Mutant
|
|
28
28
|
token = peek
|
29
29
|
error(
|
30
30
|
message: "Unexpected token: #{token.type}",
|
31
|
-
token:
|
31
|
+
token:
|
32
32
|
)
|
33
33
|
end
|
34
34
|
end
|
@@ -74,15 +74,15 @@ module Mutant
|
|
74
74
|
end
|
75
75
|
|
76
76
|
Node.new(
|
77
|
-
attribute
|
78
|
-
descendant
|
77
|
+
attribute:,
|
78
|
+
descendant:,
|
79
79
|
type: structure.type
|
80
80
|
)
|
81
81
|
end
|
82
82
|
|
83
83
|
def parse_attribute(name)
|
84
84
|
Node::Attribute.new(
|
85
|
-
name
|
85
|
+
name:,
|
86
86
|
value: parse_alternative(
|
87
87
|
group_start: method(:parse_attribute_group),
|
88
88
|
string: method(:parse_attribute_value)
|
@@ -96,14 +96,14 @@ module Mutant
|
|
96
96
|
alternatives.fetch(token.type) do
|
97
97
|
error(
|
98
98
|
message: "Expected one of: #{alternatives.keys.join(',')} but got: #{token.type}",
|
99
|
-
token:
|
99
|
+
token:
|
100
100
|
)
|
101
101
|
end.call
|
102
102
|
end
|
103
103
|
|
104
104
|
def parse_descendant(name)
|
105
105
|
Node::Descendant.new(
|
106
|
-
name
|
106
|
+
name:,
|
107
107
|
pattern: parse_node
|
108
108
|
)
|
109
109
|
end
|
@@ -120,7 +120,7 @@ module Mutant
|
|
120
120
|
|
121
121
|
expect(:group_end)
|
122
122
|
|
123
|
-
Node::Attribute::Value::Group.new(values:
|
123
|
+
Node::Attribute::Value::Group.new(values:)
|
124
124
|
end
|
125
125
|
|
126
126
|
def parse_attribute_value
|
@@ -153,7 +153,7 @@ module Mutant
|
|
153
153
|
type = token.value.to_sym
|
154
154
|
|
155
155
|
Structure::ALL.fetch(type) do
|
156
|
-
error(token
|
156
|
+
error(token:, message: "Expected valid node type got: #{type}")
|
157
157
|
end
|
158
158
|
end
|
159
159
|
|
@@ -169,7 +169,7 @@ module Mutant
|
|
169
169
|
token
|
170
170
|
else
|
171
171
|
error(
|
172
|
-
token
|
172
|
+
token:,
|
173
173
|
message: "Expected token type: #{type} but got: #{token.type}"
|
174
174
|
)
|
175
175
|
end
|
data/lib/mutant/ast/structure.rb
CHANGED
data/lib/mutant/ast.rb
CHANGED
data/lib/mutant/bootstrap.rb
CHANGED
@@ -38,7 +38,7 @@ module Mutant
|
|
38
38
|
.with(matchable_scopes: matchable_scopes(env))
|
39
39
|
|
40
40
|
matched_subjects = env.record(:subject_match) do
|
41
|
-
Matcher.expand(env:
|
41
|
+
Matcher.expand(env:).call(env)
|
42
42
|
end
|
43
43
|
|
44
44
|
selected_subjects = subject_select(env, matched_subjects)
|
@@ -48,9 +48,9 @@ module Mutant
|
|
48
48
|
end
|
49
49
|
|
50
50
|
setup_integration(
|
51
|
-
env
|
52
|
-
mutations
|
53
|
-
selected_subjects:
|
51
|
+
env:,
|
52
|
+
mutations:,
|
53
|
+
selected_subjects:
|
54
54
|
)
|
55
55
|
end
|
56
56
|
end
|
@@ -79,9 +79,9 @@ module Mutant
|
|
79
79
|
hooks.run(:setup_integration_pre)
|
80
80
|
Integration.setup(env).fmap do |integration|
|
81
81
|
env.with(
|
82
|
-
integration
|
83
|
-
mutations
|
84
|
-
selector: Selector::Expression.new(integration:
|
82
|
+
integration:,
|
83
|
+
mutations:,
|
84
|
+
selector: Selector::Expression.new(integration:),
|
85
85
|
subjects: selected_subjects
|
86
86
|
)
|
87
87
|
end.tap { hooks.run(:setup_integration_post) }
|
@@ -120,7 +120,7 @@ module Mutant
|
|
120
120
|
config, hooks, world = env.config, env.hooks, env.world
|
121
121
|
|
122
122
|
env.record(:hooks_env_infection_pre) do
|
123
|
-
hooks.run(:env_infection_pre, env:
|
123
|
+
hooks.run(:env_infection_pre, env:)
|
124
124
|
end
|
125
125
|
|
126
126
|
env.record(:require_target) do
|
@@ -133,7 +133,7 @@ module Mutant
|
|
133
133
|
end
|
134
134
|
|
135
135
|
env.record(:hooks_env_infection_post) do
|
136
|
-
hooks.run(:env_infection_post, env:
|
136
|
+
hooks.run(:env_infection_post, env:)
|
137
137
|
end
|
138
138
|
end
|
139
139
|
end
|
@@ -147,7 +147,7 @@ module Mutant
|
|
147
147
|
|
148
148
|
scopes = env.world.object_space.each_object(Module).with_object([]) do |raw_scope, aggregate|
|
149
149
|
expression = expression(config.reporter, config.expression_parser, raw_scope) || next
|
150
|
-
aggregate << Scope.new(raw: raw_scope, expression:
|
150
|
+
aggregate << Scope.new(raw: raw_scope, expression:)
|
151
151
|
end
|
152
152
|
|
153
153
|
scopes.sort_by { |scope| scope.expression.syntax }
|
@@ -177,9 +177,9 @@ module Mutant
|
|
177
177
|
semantics_warning(
|
178
178
|
reporter,
|
179
179
|
CLASS_NAME_TYPE_MISMATCH_FORMAT,
|
180
|
-
name
|
180
|
+
name:,
|
181
181
|
scope_class: raw_scope.class,
|
182
|
-
raw_scope:
|
182
|
+
raw_scope:
|
183
183
|
)
|
184
184
|
return
|
185
185
|
end
|
@@ -19,8 +19,8 @@ module Mutant
|
|
19
19
|
env = Env.empty(world, @config)
|
20
20
|
|
21
21
|
env
|
22
|
-
.record(:config) { Config.load(cli_config: @config, world:
|
23
|
-
.bind { |config| Bootstrap.call_test(env.with(config:
|
22
|
+
.record(:config) { Config.load(cli_config: @config, world:) }
|
23
|
+
.bind { |config| Bootstrap.call_test(env.with(config:)) }
|
24
24
|
end
|
25
25
|
|
26
26
|
class List < self
|
@@ -20,8 +20,8 @@ module Mutant
|
|
20
20
|
|
21
21
|
private
|
22
22
|
|
23
|
-
def initialize(
|
24
|
-
super
|
23
|
+
def initialize(_attributes)
|
24
|
+
super
|
25
25
|
@config = Config::DEFAULT.with(
|
26
26
|
coverage_criteria: Config::CoverageCriteria::EMPTY
|
27
27
|
)
|
@@ -31,8 +31,8 @@ module Mutant
|
|
31
31
|
env = Env.empty(world, @config)
|
32
32
|
|
33
33
|
env
|
34
|
-
.record(:config) { Config.load(cli_config: @config, world:
|
35
|
-
.bind { |config| Bootstrap.call(env.with(config:
|
34
|
+
.record(:config) { Config.load(cli_config: @config, world:) }
|
35
|
+
.bind { |config| Bootstrap.call(env.with(config:)) }
|
36
36
|
end
|
37
37
|
|
38
38
|
def parse_remaining_arguments(arguments)
|
@@ -60,7 +60,7 @@ module Mutant
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def effective_options
|
63
|
-
instance_of?(Environment) ? EMPTY_ARRAY : super
|
63
|
+
instance_of?(Environment) ? EMPTY_ARRAY : super
|
64
64
|
end
|
65
65
|
|
66
66
|
# rubocop:disable Metrics/MethodLength
|
@@ -99,7 +99,7 @@ module Mutant
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def assign_integration_name(name)
|
102
|
-
set(integration: @config.integration.with(name:
|
102
|
+
set(integration: @config.integration.with(name:))
|
103
103
|
end
|
104
104
|
|
105
105
|
def add_matcher_options(parser)
|
@@ -112,7 +112,7 @@ module Mutant
|
|
112
112
|
add_matcher(:start_expressions, @config.expression_parser.call(pattern).from_right)
|
113
113
|
end
|
114
114
|
parser.on('--since REVISION', 'Only select subjects touched since REVISION') do |revision|
|
115
|
-
add_matcher(:diffs, Repository::Diff.new(to: revision, world:
|
115
|
+
add_matcher(:diffs, Repository::Diff.new(to: revision, world:))
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
@@ -149,7 +149,7 @@ module Mutant
|
|
149
149
|
'--usage USAGE_TYPE',
|
150
150
|
Usage,
|
151
151
|
'License usage: opensource|commercial'
|
152
|
-
) { |usage| set(usage:
|
152
|
+
) { |usage| set(usage:) }
|
153
153
|
end
|
154
154
|
end # Run
|
155
155
|
# rubocop:enable Metrics/ClassLength
|
@@ -62,7 +62,7 @@ module Mutant
|
|
62
62
|
|
63
63
|
def add_target_options(parser)
|
64
64
|
parser.on('-e', '--evaluate SOURCE') do |source|
|
65
|
-
@targets << Target::Source.new(source:
|
65
|
+
@targets << Target::Source.new(source:)
|
66
66
|
end
|
67
67
|
|
68
68
|
parser.on('-i', '--ignore-pattern AST_PATTERN') do |pattern|
|
@@ -97,7 +97,7 @@ module Mutant
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def read_file(pathname)
|
100
|
-
Either::Right.new(Target::File.new(pathname
|
100
|
+
Either::Right.new(Target::File.new(pathname:, source: pathname.read))
|
101
101
|
rescue StandardError => exception
|
102
102
|
Either::Left.new("Cannot read file: #{exception}")
|
103
103
|
end
|
data/lib/mutant/cli/command.rb
CHANGED
@@ -30,10 +30,10 @@ module Mutant
|
|
30
30
|
def self.parse(arguments:, parent_names: nil, print_profile: false, world:, zombie: false)
|
31
31
|
new(
|
32
32
|
main: nil,
|
33
|
-
parent_names
|
34
|
-
print_profile
|
35
|
-
world
|
36
|
-
zombie:
|
33
|
+
parent_names:,
|
34
|
+
print_profile:,
|
35
|
+
world:,
|
36
|
+
zombie:
|
37
37
|
).__send__(:parse, arguments)
|
38
38
|
end
|
39
39
|
# rubocop:enable Metrics/ParameterLists
|
@@ -184,11 +184,11 @@ module Mutant
|
|
184
184
|
else
|
185
185
|
find_command(command_name).bind do |command|
|
186
186
|
command.parse(
|
187
|
-
arguments
|
187
|
+
arguments:,
|
188
188
|
parent_names: [*parent_names, self.class::NAME],
|
189
|
-
print_profile
|
190
|
-
world
|
191
|
-
zombie:
|
189
|
+
print_profile:,
|
190
|
+
world:,
|
191
|
+
zombie:
|
192
192
|
)
|
193
193
|
end
|
194
194
|
end
|
data/lib/mutant/cli.rb
CHANGED
data/lib/mutant/config.rb
CHANGED
@@ -97,7 +97,7 @@ module Mutant
|
|
97
97
|
|
98
98
|
# Load the configuration
|
99
99
|
def self.load(cli_config:, world:)
|
100
|
-
load_config_file(reporter: cli_config.reporter, world:
|
100
|
+
load_config_file(reporter: cli_config.reporter, world:).fmap do |file_config|
|
101
101
|
DEFAULT.with(
|
102
102
|
jobs: Etc.nprocessors,
|
103
103
|
mutation: Mutation::Config::DEFAULT
|
@@ -111,14 +111,13 @@ module Mutant
|
|
111
111
|
#
|
112
112
|
# @return [Either<String,Config>]
|
113
113
|
def self.load_config_file(reporter:, world:)
|
114
|
-
files = CANDIDATES
|
115
|
-
.map(&world.pathname.public_method(:new))
|
116
|
-
.select(&:readable?)
|
114
|
+
files = CANDIDATES.map(&world.pathname.public_method(:new)).select(&:readable?)
|
117
115
|
|
118
|
-
|
119
|
-
|
120
|
-
elsif files.empty?
|
116
|
+
case files
|
117
|
+
in []
|
121
118
|
Either::Right.new(DEFAULT)
|
119
|
+
in [file]
|
120
|
+
load_contents(reporter:, path: file).fmap(&DEFAULT.public_method(:with))
|
122
121
|
else
|
123
122
|
Either::Left.new(MORE_THAN_ONE_CONFIG_FILE % files.join(', '))
|
124
123
|
end
|
data/lib/mutant/env.rb
CHANGED
@@ -30,19 +30,19 @@ module Mutant
|
|
30
30
|
# rubocop:disable Metrics/MethodLength
|
31
31
|
def self.empty(world, config)
|
32
32
|
new(
|
33
|
-
config
|
33
|
+
config:,
|
34
34
|
hooks: Hooks.empty,
|
35
35
|
integration: Integration::Null.new(
|
36
36
|
arguments: EMPTY_ARRAY,
|
37
37
|
expression_parser: config.expression_parser,
|
38
|
-
world:
|
38
|
+
world:
|
39
39
|
),
|
40
40
|
matchable_scopes: EMPTY_ARRAY,
|
41
41
|
mutations: EMPTY_ARRAY,
|
42
42
|
parser: Parser.new,
|
43
43
|
selector: Selector::Null.new,
|
44
44
|
subjects: EMPTY_ARRAY,
|
45
|
-
world:
|
45
|
+
world:
|
46
46
|
)
|
47
47
|
end
|
48
48
|
# rubocop:enable Metrics/MethodLength
|
@@ -61,7 +61,7 @@ module Mutant
|
|
61
61
|
|
62
62
|
Result::MutationIndex.new(
|
63
63
|
isolation_result: run_mutation_tests(mutation, tests),
|
64
|
-
mutation_index
|
64
|
+
mutation_index:,
|
65
65
|
runtime: timer.now - start
|
66
66
|
)
|
67
67
|
end
|
@@ -71,11 +71,11 @@ module Mutant
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def emit_mutation_worker_process_start(index:)
|
74
|
-
hooks.run(:mutation_worker_process_start, index:
|
74
|
+
hooks.run(:mutation_worker_process_start, index:)
|
75
75
|
end
|
76
76
|
|
77
77
|
def emit_test_worker_process_start(index:)
|
78
|
-
hooks.run(:test_worker_process_start, index:
|
78
|
+
hooks.run(:test_worker_process_start, index:)
|
79
79
|
end
|
80
80
|
|
81
81
|
# The test selections
|
@@ -161,17 +161,17 @@ module Mutant
|
|
161
161
|
# @param [Symbol] name
|
162
162
|
#
|
163
163
|
# @return [self]
|
164
|
-
def record(name, &
|
165
|
-
world.record(name, &
|
164
|
+
def record(name, &)
|
165
|
+
world.record(name, &)
|
166
166
|
end
|
167
167
|
|
168
168
|
private
|
169
169
|
|
170
170
|
def run_mutation_tests(mutation, tests)
|
171
171
|
config.isolation.call(config.mutation.timeout) do
|
172
|
-
hooks.run(:mutation_insert_pre, mutation:
|
172
|
+
hooks.run(:mutation_insert_pre, mutation:)
|
173
173
|
result = mutation.insert(world.kernel)
|
174
|
-
hooks.run(:mutation_insert_post, mutation:
|
174
|
+
hooks.run(:mutation_insert_post, mutation:)
|
175
175
|
|
176
176
|
result.either(
|
177
177
|
->(_) { Result::Test::VoidValue.instance },
|
@@ -43,7 +43,7 @@ module Mutant
|
|
43
43
|
# rubocop:disable Lint/UnusedMethodArgument
|
44
44
|
def matcher(env:)
|
45
45
|
matcher_candidates = MATCHERS.fetch(scope_symbol)
|
46
|
-
.map { |submatcher| submatcher.new(scope:
|
46
|
+
.map { |submatcher| submatcher.new(scope:) }
|
47
47
|
|
48
48
|
methods_matcher = Matcher::Chain.new(matchers: matcher_candidates)
|
49
49
|
|
@@ -82,7 +82,7 @@ module Mutant
|
|
82
82
|
def scope
|
83
83
|
Scope.new(
|
84
84
|
raw: Object.const_get(scope_name),
|
85
|
-
expression: Namespace::Exact.new(scope_name:
|
85
|
+
expression: Namespace::Exact.new(scope_name:)
|
86
86
|
)
|
87
87
|
end
|
88
88
|
|
@@ -38,7 +38,7 @@ module Mutant
|
|
38
38
|
# rubocop:disable Lint/UnusedMethodArgument
|
39
39
|
def matcher(env:)
|
40
40
|
matcher_candidates = MATCHERS.fetch(scope_symbol)
|
41
|
-
.map { |submatcher| submatcher.new(scope:
|
41
|
+
.map { |submatcher| submatcher.new(scope:) }
|
42
42
|
|
43
43
|
Matcher::Chain.new(matchers: matcher_candidates)
|
44
44
|
end
|
@@ -60,7 +60,7 @@ module Mutant
|
|
60
60
|
|
61
61
|
def scope
|
62
62
|
Scope.new(
|
63
|
-
expression: Namespace::Exact.new(scope_name:
|
63
|
+
expression: Namespace::Exact.new(scope_name:),
|
64
64
|
raw: Object.const_get(scope_name)
|
65
65
|
)
|
66
66
|
end
|
@@ -15,12 +15,11 @@ module Mutant
|
|
15
15
|
# @return [nil]
|
16
16
|
# otherwise
|
17
17
|
def call(input)
|
18
|
-
|
19
|
-
|
20
|
-
when 0
|
18
|
+
case expressions(input)
|
19
|
+
in []
|
21
20
|
Either::Left.new("Expression: #{input.inspect} is invalid")
|
22
|
-
|
23
|
-
Either::Right.new(
|
21
|
+
in [expression]
|
22
|
+
Either::Right.new(expression)
|
24
23
|
else
|
25
24
|
Either::Left.new("Expression: #{input.inspect} is ambiguous")
|
26
25
|
end
|
@@ -12,14 +12,14 @@ module Mutant
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def matcher(env:)
|
15
|
-
Matcher::Chain.new(matchers: find_matchers(env:
|
15
|
+
Matcher::Chain.new(matchers: find_matchers(env:))
|
16
16
|
end
|
17
17
|
|
18
18
|
private
|
19
19
|
|
20
20
|
def find_matchers(env:)
|
21
|
-
scope_names(env:
|
22
|
-
Namespace::Recursive.new(scope_name:
|
21
|
+
scope_names(env:).uniq.map do |scope_name|
|
22
|
+
Namespace::Recursive.new(scope_name:).matcher(env: nil)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
data/lib/mutant/integration.rb
CHANGED
@@ -86,7 +86,7 @@ module Mutant
|
|
86
86
|
end.lmap do |exception|
|
87
87
|
LOAD_MESSAGE % {
|
88
88
|
exception: exception.inspect,
|
89
|
-
integration_name:
|
89
|
+
integration_name:
|
90
90
|
}
|
91
91
|
end
|
92
92
|
end
|
@@ -101,7 +101,7 @@ module Mutant
|
|
101
101
|
CONST_MESSAGE % {
|
102
102
|
constant_name: "#{self}::#{constant_name}",
|
103
103
|
exception: exception.inspect,
|
104
|
-
integration_name:
|
104
|
+
integration_name:
|
105
105
|
}
|
106
106
|
end
|
107
107
|
end
|
@@ -43,7 +43,7 @@ module Mutant
|
|
43
43
|
# @return [undefined]
|
44
44
|
def self.with(io)
|
45
45
|
io.pipe(binmode: true) do |(reader, writer)|
|
46
|
-
yield new(reader
|
46
|
+
yield new(reader:, writer:)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -236,11 +236,11 @@ module Mutant
|
|
236
236
|
Pipe.with(io) do |result|
|
237
237
|
Pipe.with(io) do |log|
|
238
238
|
Parent.call(
|
239
|
-
block
|
240
|
-
deadline
|
239
|
+
block:,
|
240
|
+
deadline:,
|
241
241
|
log_pipe: log,
|
242
242
|
result_pipe: result,
|
243
|
-
world:
|
243
|
+
world:
|
244
244
|
)
|
245
245
|
end
|
246
246
|
end
|
@@ -10,7 +10,7 @@ module Mutant
|
|
10
10
|
const = env.world.try_const_get(const_name) or return EMPTY_ARRAY
|
11
11
|
|
12
12
|
Chain.new(
|
13
|
-
matchers: matched_scopes(env, const).map { |scope| Scope.new(scope:
|
13
|
+
matchers: matched_scopes(env, const).map { |scope| Scope.new(scope:) }
|
14
14
|
).call(env)
|
15
15
|
end
|
16
16
|
|
@@ -13,7 +13,7 @@ module Mutant
|
|
13
13
|
#
|
14
14
|
# @return [Matcher::Method::Singleton]
|
15
15
|
def self.new(scope:, target_method:)
|
16
|
-
super(scope
|
16
|
+
super(scope:, target_method:, evaluator: Evaluator)
|
17
17
|
end
|
18
18
|
|
19
19
|
# Metaclass method evaluator
|
@@ -40,7 +40,7 @@ module Mutant
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def metaclass_containing(node)
|
43
|
-
AST::FindMetaclassContaining.call(ast
|
43
|
+
AST::FindMetaclassContaining.call(ast:, target: node)
|
44
44
|
end
|
45
45
|
|
46
46
|
def name?(node)
|
@@ -10,7 +10,7 @@ module Mutant
|
|
10
10
|
#
|
11
11
|
# @return [Matcher::Method::Singleton]
|
12
12
|
def self.new(scope:, target_method:)
|
13
|
-
super(scope
|
13
|
+
super(scope:, target_method:, evaluator: Evaluator)
|
14
14
|
end
|
15
15
|
|
16
16
|
# Singleton method evaluator
|