mutant 0.11.10 → 0.11.13
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/lib/mutant/ast/pattern/lexer.rb +171 -0
- data/lib/mutant/ast/pattern/parser.rb +194 -0
- data/lib/mutant/ast/pattern/source.rb +39 -0
- data/lib/mutant/ast/pattern/token.rb +15 -0
- data/lib/mutant/ast/pattern.rb +125 -0
- data/lib/mutant/ast/structure.rb +890 -0
- data/lib/mutant/bootstrap.rb +8 -7
- data/lib/mutant/cli/command/environment.rb +5 -3
- data/lib/mutant/cli/command/util.rb +17 -2
- data/lib/mutant/config.rb +76 -40
- data/lib/mutant/env.rb +1 -1
- data/lib/mutant/license/subscription/opensource.rb +13 -3
- data/lib/mutant/matcher/method.rb +8 -1
- data/lib/mutant/meta/example.rb +4 -1
- data/lib/mutant/mutation/config.rb +36 -0
- data/lib/mutant/mutator/node/arguments.rb +1 -1
- data/lib/mutant/mutator/node/begin.rb +2 -1
- data/lib/mutant/mutator/node/define.rb +5 -2
- data/lib/mutant/mutator/node/kwargs.rb +2 -2
- data/lib/mutant/mutator/node/literal/regex.rb +1 -1
- data/lib/mutant/mutator/node/literal/symbol.rb +2 -2
- data/lib/mutant/mutator/node/named_value/constant_assignment.rb +1 -1
- data/lib/mutant/mutator/node/named_value/variable_assignment.rb +2 -2
- data/lib/mutant/mutator/node/regexp/capture_group.rb +3 -5
- data/lib/mutant/mutator/node/resbody.rb +0 -10
- data/lib/mutant/mutator/node.rb +47 -1
- data/lib/mutant/mutator/util/array.rb +0 -17
- data/lib/mutant/mutator.rb +2 -26
- data/lib/mutant/reporter/cli/printer/config.rb +1 -1
- data/lib/mutant/subject/config.rb +5 -4
- data/lib/mutant/subject.rb +4 -1
- data/lib/mutant/transform.rb +14 -0
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/world.rb +1 -0
- data/lib/mutant.rb +9 -1
- metadata +10 -3
@@ -20,7 +20,7 @@ module Mutant
|
|
20
20
|
info 'Jobs: %s', object.jobs || 'auto'
|
21
21
|
info 'Includes: %s', object.includes
|
22
22
|
info 'Requires: %s', object.requires
|
23
|
-
info 'MutationTimeout: %0.9g', object.
|
23
|
+
info 'MutationTimeout: %0.9g', object.mutation.timeout if object.mutation.timeout
|
24
24
|
end
|
25
25
|
# rubocop:enable Metrics/AbcSize
|
26
26
|
|
@@ -3,16 +3,17 @@
|
|
3
3
|
module Mutant
|
4
4
|
class Subject
|
5
5
|
class Config
|
6
|
-
include Adamantium, Anima.new(:inline_disable)
|
6
|
+
include Adamantium, Anima.new(:inline_disable, :mutation)
|
7
7
|
|
8
|
-
DEFAULT = new(inline_disable: false)
|
8
|
+
DEFAULT = new(inline_disable: false, mutation: Mutation::Config::DEFAULT)
|
9
9
|
|
10
10
|
DISABLE_REGEXP = /(\s|^)mutant:disable(?:\s|$)/.freeze
|
11
11
|
SYNTAX_REGEXP = /\A(?:#|=begin\n)/.freeze
|
12
12
|
|
13
|
-
def self.parse(comments)
|
13
|
+
def self.parse(comments:, mutation:)
|
14
14
|
new(
|
15
|
-
inline_disable: comments.any? { |comment| DISABLE_REGEXP.match?(comment_body(comment)) }
|
15
|
+
inline_disable: comments.any? { |comment| DISABLE_REGEXP.match?(comment_body(comment)) },
|
16
|
+
mutation: mutation
|
16
17
|
)
|
17
18
|
end
|
18
19
|
|
data/lib/mutant/subject.rb
CHANGED
@@ -12,7 +12,10 @@ module Mutant
|
|
12
12
|
# @return [undefined]
|
13
13
|
def mutations
|
14
14
|
[neutral_mutation].concat(
|
15
|
-
Mutator.mutate(
|
15
|
+
Mutator::Node.mutate(
|
16
|
+
config: config.mutation,
|
17
|
+
node: node
|
18
|
+
).map do |mutant|
|
16
19
|
Mutation::Evil.new(self, wrap_node(mutant))
|
17
20
|
end
|
18
21
|
)
|
data/lib/mutant/transform.rb
CHANGED
@@ -421,6 +421,20 @@ module Mutant
|
|
421
421
|
end
|
422
422
|
end # Sequence
|
423
423
|
|
424
|
+
# Always successful transformation
|
425
|
+
class Success < self
|
426
|
+
include Concord.new(:block)
|
427
|
+
|
428
|
+
# Apply transformation to input
|
429
|
+
#
|
430
|
+
# @param [Object]
|
431
|
+
#
|
432
|
+
# @return [Either<Error, Object>]
|
433
|
+
def call(input)
|
434
|
+
success(block.call(input))
|
435
|
+
end
|
436
|
+
end # Sequence
|
437
|
+
|
424
438
|
# Generic exception transformer
|
425
439
|
class Exception < self
|
426
440
|
include Concord.new(:error_class, :block)
|
data/lib/mutant/version.rb
CHANGED
data/lib/mutant/world.rb
CHANGED
data/lib/mutant.rb
CHANGED
@@ -76,6 +76,12 @@ require 'mutant/ast/meta/const'
|
|
76
76
|
require 'mutant/ast/meta/symbol'
|
77
77
|
require 'mutant/ast/meta/optarg'
|
78
78
|
require 'mutant/ast/meta/resbody'
|
79
|
+
require 'mutant/ast/pattern'
|
80
|
+
require 'mutant/ast/pattern/lexer'
|
81
|
+
require 'mutant/ast/pattern/parser'
|
82
|
+
require 'mutant/ast/pattern/source'
|
83
|
+
require 'mutant/ast/pattern/token'
|
84
|
+
require 'mutant/ast/structure'
|
79
85
|
require 'mutant/parser'
|
80
86
|
require 'mutant/isolation'
|
81
87
|
require 'mutant/isolation/exception'
|
@@ -87,6 +93,7 @@ require 'mutant/parallel/source'
|
|
87
93
|
require 'mutant/parallel/worker'
|
88
94
|
require 'mutant/require_highjack'
|
89
95
|
require 'mutant/mutation'
|
96
|
+
require 'mutant/mutation/config'
|
90
97
|
require 'mutant/mutator'
|
91
98
|
require 'mutant/mutator/util'
|
92
99
|
require 'mutant/mutator/util/array'
|
@@ -256,6 +263,7 @@ module Mutant
|
|
256
263
|
open3: Open3,
|
257
264
|
pathname: Pathname,
|
258
265
|
process: Process,
|
266
|
+
random: Random,
|
259
267
|
stderr: $stderr,
|
260
268
|
stdout: $stdout,
|
261
269
|
thread: Thread,
|
@@ -281,7 +289,7 @@ module Mutant
|
|
281
289
|
isolation: Mutant::Isolation::Fork.new(WORLD),
|
282
290
|
jobs: nil,
|
283
291
|
matcher: Matcher::Config::DEFAULT,
|
284
|
-
|
292
|
+
mutation: Mutation::Config::DEFAULT,
|
285
293
|
reporter: Reporter::CLI.build(WORLD.stdout),
|
286
294
|
requires: EMPTY_ARRAY,
|
287
295
|
zombie: false
|
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.11.
|
4
|
+
version: 0.11.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diff-lcs
|
@@ -179,6 +179,11 @@ files:
|
|
179
179
|
- lib/mutant/ast/named_children.rb
|
180
180
|
- lib/mutant/ast/node_predicates.rb
|
181
181
|
- lib/mutant/ast/nodes.rb
|
182
|
+
- lib/mutant/ast/pattern.rb
|
183
|
+
- lib/mutant/ast/pattern/lexer.rb
|
184
|
+
- lib/mutant/ast/pattern/parser.rb
|
185
|
+
- lib/mutant/ast/pattern/source.rb
|
186
|
+
- lib/mutant/ast/pattern/token.rb
|
182
187
|
- lib/mutant/ast/regexp.rb
|
183
188
|
- lib/mutant/ast/regexp/transformer.rb
|
184
189
|
- lib/mutant/ast/regexp/transformer/direct.rb
|
@@ -189,6 +194,7 @@ files:
|
|
189
194
|
- lib/mutant/ast/regexp/transformer/root.rb
|
190
195
|
- lib/mutant/ast/regexp/transformer/text.rb
|
191
196
|
- lib/mutant/ast/sexp.rb
|
197
|
+
- lib/mutant/ast/structure.rb
|
192
198
|
- lib/mutant/ast/types.rb
|
193
199
|
- lib/mutant/bootstrap.rb
|
194
200
|
- lib/mutant/cli.rb
|
@@ -243,6 +249,7 @@ files:
|
|
243
249
|
- lib/mutant/meta/example/dsl.rb
|
244
250
|
- lib/mutant/meta/example/verification.rb
|
245
251
|
- lib/mutant/mutation.rb
|
252
|
+
- lib/mutant/mutation/config.rb
|
246
253
|
- lib/mutant/mutator.rb
|
247
254
|
- lib/mutant/mutator/node.rb
|
248
255
|
- lib/mutant/mutator/node/and_asgn.rb
|
@@ -386,7 +393,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
386
393
|
- !ruby/object:Gem::Version
|
387
394
|
version: '0'
|
388
395
|
requirements: []
|
389
|
-
rubygems_version: 3.
|
396
|
+
rubygems_version: 3.3.7
|
390
397
|
signing_key:
|
391
398
|
specification_version: 4
|
392
399
|
summary: ''
|