mutant 0.10.26 → 0.10.31
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/bin/mutant +1 -1
- data/lib/mutant.rb +5 -1
- data/lib/mutant/ast/regexp/transformer.rb +3 -1
- data/lib/mutant/ast/regexp/transformer/direct.rb +1 -0
- data/lib/mutant/ast/types.rb +1 -0
- data/lib/mutant/bootstrap.rb +13 -5
- data/lib/mutant/config.rb +17 -5
- data/lib/mutant/env.rb +4 -0
- data/lib/mutant/expression.rb +1 -1
- data/lib/mutant/hooks.rb +77 -0
- data/lib/mutant/isolation/exception.rb +22 -0
- data/lib/mutant/isolation/fork.rb +5 -1
- data/lib/mutant/matcher/config.rb +1 -1
- data/lib/mutant/matcher/method.rb +4 -4
- data/lib/mutant/matcher/methods.rb +1 -1
- data/lib/mutant/meta/example/dsl.rb +0 -1
- data/lib/mutant/mutator.rb +1 -1
- data/lib/mutant/mutator/node.rb +0 -5
- data/lib/mutant/mutator/node/index.rb +1 -0
- data/lib/mutant/mutator/node/literal/float.rb +1 -3
- data/lib/mutant/mutator/node/literal/integer.rb +3 -6
- data/lib/mutant/mutator/node/literal/range.rb +1 -1
- data/lib/mutant/mutator/node/module.rb +19 -0
- data/lib/mutant/mutator/node/send.rb +23 -1
- data/lib/mutant/parallel/worker.rb +3 -0
- data/lib/mutant/pipe.rb +12 -0
- data/lib/mutant/registry.rb +4 -4
- data/lib/mutant/reporter/cli/printer/isolation_result.rb +3 -1
- data/lib/mutant/repository/diff.rb +1 -1
- data/lib/mutant/transform.rb +1 -1
- data/lib/mutant/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ef901ceb41d6239377dac9b9c7c8cc908775e76f12dee66998087f3f6ef70a0
|
4
|
+
data.tar.gz: fc6b949b0bb8c8353cdab6186307daf67e5274faded923aaa8941dd0f5219de3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c05c611a7cc443e82d278fcaac02f1b43413b30dff81c602d468aea5256cb3389850c414f5415fbd6d7fa67aac035669c325edf3ffccaa915fa70cb03b8dbdc0
|
7
|
+
data.tar.gz: e171127271fc59b0d66a9050e9cb9398e5f0caecf13df14289e9acf1f7940cefa9b9760c051655c41090a5cb2235e18465b7dde72b4ed27ac21b80a745850cc0
|
data/bin/mutant
CHANGED
data/lib/mutant.rb
CHANGED
@@ -71,8 +71,9 @@ require 'mutant/ast/meta/optarg'
|
|
71
71
|
require 'mutant/ast/meta/resbody'
|
72
72
|
require 'mutant/parser'
|
73
73
|
require 'mutant/isolation'
|
74
|
-
require 'mutant/isolation/
|
74
|
+
require 'mutant/isolation/exception'
|
75
75
|
require 'mutant/isolation/fork'
|
76
|
+
require 'mutant/isolation/none'
|
76
77
|
require 'mutant/parallel'
|
77
78
|
require 'mutant/parallel/driver'
|
78
79
|
require 'mutant/parallel/source'
|
@@ -137,6 +138,7 @@ require 'mutant/mutator/node/define'
|
|
137
138
|
require 'mutant/mutator/node/mlhs'
|
138
139
|
require 'mutant/mutator/node/nthref'
|
139
140
|
require 'mutant/mutator/node/masgn'
|
141
|
+
require 'mutant/mutator/node/module'
|
140
142
|
require 'mutant/mutator/node/return'
|
141
143
|
require 'mutant/mutator/node/block'
|
142
144
|
require 'mutant/mutator/node/block_pass'
|
@@ -184,6 +186,7 @@ require 'mutant/selector'
|
|
184
186
|
require 'mutant/selector/expression'
|
185
187
|
require 'mutant/selector/null'
|
186
188
|
require 'mutant/world'
|
189
|
+
require 'mutant/hooks'
|
187
190
|
require 'mutant/config'
|
188
191
|
require 'mutant/config/coverage_criteria'
|
189
192
|
require 'mutant/cli'
|
@@ -255,6 +258,7 @@ module Mutant
|
|
255
258
|
Expression::Namespace::Recursive
|
256
259
|
]),
|
257
260
|
fail_fast: false,
|
261
|
+
hooks: EMPTY_ARRAY,
|
258
262
|
includes: EMPTY_ARRAY,
|
259
263
|
integration: nil,
|
260
264
|
isolation: Mutant::Isolation::Fork.new(WORLD),
|
@@ -11,7 +11,9 @@ module Mutant
|
|
11
11
|
class Transformer
|
12
12
|
include AbstractType
|
13
13
|
|
14
|
-
REGISTRY = Registry.new
|
14
|
+
REGISTRY = Registry.new(
|
15
|
+
->(type) { fail "No regexp transformer registered for: #{type}" }
|
16
|
+
)
|
15
17
|
|
16
18
|
# Lookup transformer class for regular expression node type
|
17
19
|
#
|
@@ -74,6 +74,7 @@ module Mutant
|
|
74
74
|
[:regexp_katakana_property, [:property, :katakana, '\p{Katakana}'], ::Regexp::Expression::UnicodeProperty::Script],
|
75
75
|
[:regexp_letter_property, [:property, :letter, '\p{L}'], ::Regexp::Expression::UnicodeProperty::Letter::Any],
|
76
76
|
[:regexp_linebreak_type, [:type, :linebreak, '\R'], ::Regexp::Expression::CharacterType::Linebreak],
|
77
|
+
[:regexp_latin_property, [:property, :latin, '\p{Latin}'], ::Regexp::Expression::UnicodeProperty::Script],
|
77
78
|
[:regexp_lower_posixclass, [:posixclass, :lower, '[:lower:]'], ::Regexp::Expression::PosixClass],
|
78
79
|
[:regexp_mark_keep, [:keep, :mark, '\K'], ::Regexp::Expression::Keep::Mark],
|
79
80
|
[:regexp_match_start_anchor, [:anchor, :match_start, '\\G'], ::Regexp::Expression::Anchor::MatchStart],
|
data/lib/mutant/ast/types.rb
CHANGED
data/lib/mutant/bootstrap.rb
CHANGED
@@ -31,8 +31,7 @@ module Mutant
|
|
31
31
|
#
|
32
32
|
# rubocop:disable Metrics/MethodLength
|
33
33
|
def self.call(world, config)
|
34
|
-
env = Env
|
35
|
-
.empty(world, config)
|
34
|
+
env = load_hooks(Env.empty(world, config))
|
36
35
|
.tap(&method(:infect))
|
37
36
|
.with(matchable_scopes: matchable_scopes(world, config))
|
38
37
|
|
@@ -49,6 +48,11 @@ module Mutant
|
|
49
48
|
end
|
50
49
|
# rubocop:enable Metrics/MethodLength
|
51
50
|
|
51
|
+
def self.load_hooks(env)
|
52
|
+
env.with(hooks: Hooks.load_config(env.config))
|
53
|
+
end
|
54
|
+
private_class_method :load_hooks
|
55
|
+
|
52
56
|
def self.start_subject(env, subjects)
|
53
57
|
start_expressions = env.config.matcher.start_expressions
|
54
58
|
|
@@ -63,10 +67,14 @@ module Mutant
|
|
63
67
|
private_class_method :start_subject
|
64
68
|
|
65
69
|
def self.infect(env)
|
66
|
-
config, world = env.config, env.world
|
70
|
+
config, hooks, world = env.config, env.hooks, env.world
|
71
|
+
|
72
|
+
hooks.run(:env_infection_pre, env)
|
73
|
+
|
74
|
+
config.includes.each(&world.load_path.public_method(:<<))
|
75
|
+
config.requires.each(&world.kernel.public_method(:require))
|
67
76
|
|
68
|
-
|
69
|
-
config.requires.each(&world.kernel.method(:require))
|
77
|
+
hooks.run(:env_infection_post, env)
|
70
78
|
end
|
71
79
|
private_class_method :infect
|
72
80
|
|
data/lib/mutant/config.rb
CHANGED
@@ -10,6 +10,7 @@ module Mutant
|
|
10
10
|
:coverage_criteria,
|
11
11
|
:expression_parser,
|
12
12
|
:fail_fast,
|
13
|
+
:hooks,
|
13
14
|
:includes,
|
14
15
|
:integration,
|
15
16
|
:isolation,
|
@@ -49,11 +50,12 @@ module Mutant
|
|
49
50
|
other.with(
|
50
51
|
coverage_criteria: coverage_criteria.merge(other.coverage_criteria),
|
51
52
|
fail_fast: fail_fast || other.fail_fast,
|
53
|
+
hooks: hooks + other.hooks,
|
52
54
|
includes: includes + other.includes,
|
53
|
-
jobs: other.jobs || jobs,
|
54
55
|
integration: other.integration || integration,
|
55
|
-
|
56
|
+
jobs: other.jobs || jobs,
|
56
57
|
matcher: matcher.merge(other.matcher),
|
58
|
+
mutation_timeout: other.mutation_timeout || mutation_timeout,
|
57
59
|
requires: requires + other.requires,
|
58
60
|
zombie: zombie || other.zombie
|
59
61
|
)
|
@@ -106,20 +108,30 @@ module Mutant
|
|
106
108
|
DEFAULT.with(jobs: Etc.nprocessors)
|
107
109
|
end
|
108
110
|
|
111
|
+
PATHNAME_ARRAY = Transform::Array.new(
|
112
|
+
Transform::Sequence.new(
|
113
|
+
[
|
114
|
+
Transform::STRING,
|
115
|
+
Transform::Exception.new(ArgumentError, Pathname.public_method(:new))
|
116
|
+
]
|
117
|
+
)
|
118
|
+
)
|
119
|
+
|
109
120
|
TRANSFORM = Transform::Sequence.new(
|
110
121
|
[
|
111
122
|
Transform::Exception.new(SystemCallError, :read.to_proc),
|
112
|
-
Transform::Exception.new(YAML::SyntaxError, YAML.
|
123
|
+
Transform::Exception.new(YAML::SyntaxError, YAML.public_method(:safe_load)),
|
113
124
|
Transform::Hash.new(
|
114
125
|
optional: [
|
115
126
|
Transform::Hash::Key.new('coverage_criteria', ->(value) { CoverageCriteria::TRANSFORM.call(value) }),
|
116
127
|
Transform::Hash::Key.new('fail_fast', Transform::BOOLEAN),
|
128
|
+
Transform::Hash::Key.new('hooks', PATHNAME_ARRAY),
|
117
129
|
Transform::Hash::Key.new('includes', Transform::STRING_ARRAY),
|
118
130
|
Transform::Hash::Key.new('integration', Transform::STRING),
|
119
131
|
Transform::Hash::Key.new('jobs', Transform::INTEGER),
|
132
|
+
Transform::Hash::Key.new('matcher', Matcher::Config::LOADER),
|
120
133
|
Transform::Hash::Key.new('mutation_timeout', Transform::FLOAT),
|
121
|
-
Transform::Hash::Key.new('requires', Transform::STRING_ARRAY)
|
122
|
-
Transform::Hash::Key.new('matcher', Matcher::Config::LOADER)
|
134
|
+
Transform::Hash::Key.new('requires', Transform::STRING_ARRAY)
|
123
135
|
],
|
124
136
|
required: []
|
125
137
|
),
|
data/lib/mutant/env.rb
CHANGED
@@ -5,6 +5,7 @@ module Mutant
|
|
5
5
|
class Env
|
6
6
|
include Adamantium, Anima.new(
|
7
7
|
:config,
|
8
|
+
:hooks,
|
8
9
|
:integration,
|
9
10
|
:matchable_scopes,
|
10
11
|
:mutations,
|
@@ -29,6 +30,7 @@ module Mutant
|
|
29
30
|
def self.empty(world, config)
|
30
31
|
new(
|
31
32
|
config: config,
|
33
|
+
hooks: Hooks.empty,
|
32
34
|
integration: Integration::Null.new(
|
33
35
|
expression_parser: config.expression_parser,
|
34
36
|
world: world
|
@@ -136,7 +138,9 @@ module Mutant
|
|
136
138
|
|
137
139
|
def run_mutation_tests(mutation, tests)
|
138
140
|
config.isolation.call(config.mutation_timeout) do
|
141
|
+
hooks.run(:mutation_insert_pre, mutation)
|
139
142
|
result = mutation.insert(world.kernel)
|
143
|
+
hooks.run(:mutation_insert_post, mutation)
|
140
144
|
|
141
145
|
if result.equal?(Loader::Result::VoidValue.instance)
|
142
146
|
Result::Test::VoidValue.instance
|
data/lib/mutant/expression.rb
CHANGED
data/lib/mutant/hooks.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mutant
|
4
|
+
class Hooks
|
5
|
+
include Adamantium, Concord::Public.new(:map)
|
6
|
+
|
7
|
+
DEFAULTS = %i[
|
8
|
+
env_infection_pre
|
9
|
+
env_infection_post
|
10
|
+
mutation_insert_post
|
11
|
+
mutation_insert_pre
|
12
|
+
].product([EMPTY_ARRAY]).to_h.transform_values(&:freeze).freeze
|
13
|
+
|
14
|
+
MESSAGE = 'Unknown hook %s'
|
15
|
+
|
16
|
+
private_constant(*constants(false))
|
17
|
+
|
18
|
+
class UnknownHook < RuntimeError; end
|
19
|
+
|
20
|
+
def self.assert_name(name)
|
21
|
+
fail UnknownHook, MESSAGE % name.inspect unless DEFAULTS.key?(name)
|
22
|
+
self
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.empty
|
26
|
+
new(DEFAULTS)
|
27
|
+
end
|
28
|
+
|
29
|
+
def merge(other)
|
30
|
+
self.class.new(
|
31
|
+
other.map.merge(map) { |_key, new, old| (old + new).freeze }.freeze
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
def run(name, payload)
|
36
|
+
Hooks.assert_name(name)
|
37
|
+
|
38
|
+
map.fetch(name).each { |block| block.call(payload) }
|
39
|
+
|
40
|
+
self
|
41
|
+
end
|
42
|
+
|
43
|
+
class Builder
|
44
|
+
def initialize
|
45
|
+
@map = DEFAULTS.transform_values(&:dup)
|
46
|
+
end
|
47
|
+
|
48
|
+
def register(name, &block)
|
49
|
+
Hooks.assert_name(name)
|
50
|
+
|
51
|
+
@map.fetch(name) << block
|
52
|
+
|
53
|
+
self
|
54
|
+
end
|
55
|
+
|
56
|
+
def to_hooks
|
57
|
+
Hooks.new(@map.transform_values(&:freeze).freeze)
|
58
|
+
end
|
59
|
+
end # Builder
|
60
|
+
|
61
|
+
# rubocop:disable Security/Eval
|
62
|
+
def self.load_pathname(pathname)
|
63
|
+
hooks = Builder.new
|
64
|
+
|
65
|
+
binding.eval(pathname.read, pathname.to_s)
|
66
|
+
|
67
|
+
hooks.to_hooks
|
68
|
+
end
|
69
|
+
# rubocop:enable Security/Eval
|
70
|
+
|
71
|
+
def self.load_config(config)
|
72
|
+
config.hooks.reduce(empty) do |current, path|
|
73
|
+
current.merge(load_pathname(path))
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end # Hooks
|
77
|
+
end # Mutant
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mutant
|
4
|
+
# Module providing isolation
|
5
|
+
class Isolation
|
6
|
+
# Generic serializable exception data.
|
7
|
+
#
|
8
|
+
# This is required as our honored guests the Rails* ecosystem
|
9
|
+
# makes Marshal.dump on exceptions impossible.
|
10
|
+
#
|
11
|
+
# @see https://twitter.com/_m_b_j_/status/1356433184850907137
|
12
|
+
#
|
13
|
+
# for the full story and eventual reactions.
|
14
|
+
class Exception
|
15
|
+
include Anima.new(
|
16
|
+
:backtrace,
|
17
|
+
:message,
|
18
|
+
:original_class
|
19
|
+
)
|
20
|
+
end # Exception
|
21
|
+
end # Isolation
|
22
|
+
end # Mutant
|
@@ -133,7 +133,11 @@ module Mutant
|
|
133
133
|
def load_result(result_fragments)
|
134
134
|
@value = world.marshal.load(result_fragments.join)
|
135
135
|
rescue ArgumentError => exception
|
136
|
-
@exception =
|
136
|
+
@exception = Exception.new(
|
137
|
+
backtrace: exception.backtrace,
|
138
|
+
message: exception.message,
|
139
|
+
original_class: exception.class
|
140
|
+
)
|
137
141
|
end
|
138
142
|
|
139
143
|
# rubocop:disable Metrics/MethodLength
|
@@ -25,7 +25,7 @@ module Mutant
|
|
25
25
|
|
26
26
|
private_constant(*constants(false))
|
27
27
|
|
28
|
-
DEFAULT = new(
|
28
|
+
DEFAULT = new(anima.attribute_names.map { |name| [name, []] }.to_h)
|
29
29
|
|
30
30
|
expression = Transform::Block.capture(:expression) do |input|
|
31
31
|
Mutant::Config::DEFAULT.expression_parser.call(input)
|
@@ -8,9 +8,6 @@ module Mutant
|
|
8
8
|
Adamantium,
|
9
9
|
Concord::Public.new(:scope, :target_method, :evaluator)
|
10
10
|
|
11
|
-
# Source locations we cannot acces
|
12
|
-
BLACKLIST = %w[(eval) <internal:prelude>].to_set.freeze
|
13
|
-
|
14
11
|
SOURCE_LOCATION_WARNING_FORMAT =
|
15
12
|
'%s does not have a valid source location, unable to emit subject'
|
16
13
|
|
@@ -53,7 +50,10 @@ module Mutant
|
|
53
50
|
|
54
51
|
def skip?
|
55
52
|
location = source_location
|
56
|
-
|
53
|
+
|
54
|
+
file = location&.first
|
55
|
+
|
56
|
+
if location.nil? || !file.end_with?('.rb')
|
57
57
|
env.warn(SOURCE_LOCATION_WARNING_FORMAT % target_method)
|
58
58
|
elsif matched_node_path.any?(&method(:n_block?))
|
59
59
|
env.warn(CLOSURE_WARNING_FORMAT % target_method)
|
data/lib/mutant/mutator.rb
CHANGED
data/lib/mutant/mutator/node.rb
CHANGED
@@ -9,6 +9,8 @@ module Mutant
|
|
9
9
|
|
10
10
|
handle(:int)
|
11
11
|
|
12
|
+
children :value
|
13
|
+
|
12
14
|
private
|
13
15
|
|
14
16
|
def dispatch
|
@@ -17,12 +19,7 @@ module Mutant
|
|
17
19
|
end
|
18
20
|
|
19
21
|
def values
|
20
|
-
[0, 1,
|
21
|
-
end
|
22
|
-
|
23
|
-
def value
|
24
|
-
value, = children
|
25
|
-
value
|
22
|
+
[0, 1, value + 1, value - 1]
|
26
23
|
end
|
27
24
|
|
28
25
|
end # Integer
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mutant
|
4
|
+
class Mutator
|
5
|
+
class Node
|
6
|
+
class Module < self
|
7
|
+
handle :module
|
8
|
+
|
9
|
+
children :klass, :body
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def dispatch
|
14
|
+
emit_body_mutations if body
|
15
|
+
end
|
16
|
+
end # Module
|
17
|
+
end # Node
|
18
|
+
end # Mutator
|
19
|
+
end # Mutant
|
@@ -25,7 +25,6 @@ module Mutant
|
|
25
25
|
all?: %i[any?],
|
26
26
|
any?: %i[all?],
|
27
27
|
at: %i[fetch key?],
|
28
|
-
eql?: %i[equal?],
|
29
28
|
fetch: %i[key?],
|
30
29
|
flat_map: %i[map],
|
31
30
|
gsub: %i[sub],
|
@@ -88,6 +87,7 @@ module Mutant
|
|
88
87
|
end
|
89
88
|
|
90
89
|
def emit_selector_specific_mutations
|
90
|
+
emit_reduce_to_sum_mutation
|
91
91
|
emit_start_end_with_mutations
|
92
92
|
emit_predicate_mutations
|
93
93
|
emit_array_mutation
|
@@ -99,6 +99,21 @@ module Mutant
|
|
99
99
|
emit_lambda_mutation
|
100
100
|
end
|
101
101
|
|
102
|
+
def emit_reduce_to_sum_mutation
|
103
|
+
return unless selector.equal?(:reduce)
|
104
|
+
|
105
|
+
reducer = arguments.last
|
106
|
+
|
107
|
+
return unless reducer.eql?(s(:sym, :+)) || reducer.eql?(s(:block_pass, s(:sym, :+)))
|
108
|
+
|
109
|
+
if arguments.length > 1
|
110
|
+
initial_value = arguments.first
|
111
|
+
emit_type(receiver, :sum, initial_value)
|
112
|
+
else
|
113
|
+
emit_type(receiver, :sum)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
102
117
|
def emit_start_end_with_mutations # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength
|
103
118
|
return unless REGEXP_MATCH_METHODS.include?(selector) && arguments.one?
|
104
119
|
|
@@ -232,11 +247,18 @@ module Mutant
|
|
232
247
|
def mutate_receiver
|
233
248
|
return unless receiver
|
234
249
|
emit_implicit_self
|
250
|
+
emit_explicit_self
|
235
251
|
emit_receiver_mutations do |node|
|
236
252
|
!n_nil?(node)
|
237
253
|
end
|
238
254
|
end
|
239
255
|
|
256
|
+
def emit_explicit_self
|
257
|
+
return if UNARY_METHOD_OPERATORS.include?(selector)
|
258
|
+
|
259
|
+
emit_receiver(N_SELF) unless n_nil?(receiver)
|
260
|
+
end
|
261
|
+
|
240
262
|
def emit_implicit_self
|
241
263
|
emit_receiver(nil) if n_self?(receiver) && !(
|
242
264
|
KEYWORDS.include?(selector) ||
|
data/lib/mutant/pipe.rb
CHANGED
@@ -35,6 +35,18 @@ module Mutant
|
|
35
35
|
reader
|
36
36
|
end
|
37
37
|
|
38
|
+
# Set binmode (again)
|
39
|
+
#
|
40
|
+
# Ruby has a bug where the binmode setting may be lost duringa fork.
|
41
|
+
# This API allows to set the binmode again.
|
42
|
+
#
|
43
|
+
# @return [self]
|
44
|
+
def reset_binmode
|
45
|
+
reader.binmode
|
46
|
+
writer.binmode
|
47
|
+
self
|
48
|
+
end
|
49
|
+
|
38
50
|
class Connection
|
39
51
|
include Anima.new(:marshal, :reader, :writer)
|
40
52
|
|
data/lib/mutant/registry.rb
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
module Mutant
|
4
4
|
# Registry for mapping AST types to classes
|
5
5
|
class Registry
|
6
|
-
include Concord.new(:contents)
|
6
|
+
include Concord.new(:contents, :default)
|
7
7
|
|
8
8
|
# Initialize object
|
9
9
|
#
|
10
10
|
# @return [undefined]
|
11
|
-
def initialize
|
12
|
-
super({})
|
11
|
+
def initialize(default)
|
12
|
+
super({}, default)
|
13
13
|
end
|
14
14
|
|
15
15
|
# Raised when the type is an invalid type
|
@@ -34,7 +34,7 @@ module Mutant
|
|
34
34
|
#
|
35
35
|
# @return [Class<Mutator>]
|
36
36
|
def lookup(type)
|
37
|
-
contents.fetch(type,
|
37
|
+
contents.fetch(type, &default)
|
38
38
|
end
|
39
39
|
|
40
40
|
end # Registry
|
@@ -28,6 +28,7 @@ module Mutant
|
|
28
28
|
```
|
29
29
|
%s
|
30
30
|
%s
|
31
|
+
%s
|
31
32
|
```
|
32
33
|
MESSAGE
|
33
34
|
|
@@ -81,7 +82,8 @@ module Mutant
|
|
81
82
|
|
82
83
|
puts(
|
83
84
|
EXCEPTION_ERROR_MESSAGE % [
|
84
|
-
exception.
|
85
|
+
exception.original_class,
|
86
|
+
exception.message,
|
85
87
|
exception.backtrace.join("\n")
|
86
88
|
]
|
87
89
|
)
|
data/lib/mutant/transform.rb
CHANGED
data/lib/mutant/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mutant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diff-lcs
|
@@ -195,9 +195,11 @@ files:
|
|
195
195
|
- lib/mutant/expression/methods.rb
|
196
196
|
- lib/mutant/expression/namespace.rb
|
197
197
|
- lib/mutant/expression/parser.rb
|
198
|
+
- lib/mutant/hooks.rb
|
198
199
|
- lib/mutant/integration.rb
|
199
200
|
- lib/mutant/integration/null.rb
|
200
201
|
- lib/mutant/isolation.rb
|
202
|
+
- lib/mutant/isolation/exception.rb
|
201
203
|
- lib/mutant/isolation/fork.rb
|
202
204
|
- lib/mutant/isolation/none.rb
|
203
205
|
- lib/mutant/license.rb
|
@@ -259,6 +261,7 @@ files:
|
|
259
261
|
- lib/mutant/mutator/node/masgn.rb
|
260
262
|
- lib/mutant/mutator/node/match_current_line.rb
|
261
263
|
- lib/mutant/mutator/node/mlhs.rb
|
264
|
+
- lib/mutant/mutator/node/module.rb
|
262
265
|
- lib/mutant/mutator/node/named_value/access.rb
|
263
266
|
- lib/mutant/mutator/node/named_value/constant_assignment.rb
|
264
267
|
- lib/mutant/mutator/node/named_value/variable_assignment.rb
|
@@ -361,7 +364,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
361
364
|
- !ruby/object:Gem::Version
|
362
365
|
version: '0'
|
363
366
|
requirements: []
|
364
|
-
rubygems_version: 3.
|
367
|
+
rubygems_version: 3.2.15
|
365
368
|
signing_key:
|
366
369
|
specification_version: 4
|
367
370
|
summary: ''
|