mutant 0.11.18 → 0.11.19
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/find_metaclass_containing.rb +1 -1
- data/lib/mutant/ast/meta/const.rb +1 -1
- data/lib/mutant/ast/meta/optarg.rb +1 -1
- data/lib/mutant/ast/meta/resbody.rb +1 -1
- data/lib/mutant/ast/meta/send.rb +3 -3
- data/lib/mutant/ast/meta/symbol.rb +1 -1
- data/lib/mutant/ast/types.rb +2 -1311
- data/lib/mutant/bootstrap.rb +2 -2
- data/lib/mutant/cli/command/environment/run.rb +1 -1
- data/lib/mutant/cli/command/environment.rb +1 -3
- data/lib/mutant/cli/command/util.rb +6 -6
- data/lib/mutant/config/coverage_criteria.rb +13 -4
- data/lib/mutant/config.rb +51 -24
- data/lib/mutant/context.rb +1 -6
- data/lib/mutant/env.rb +1 -1
- data/lib/mutant/expression/method.rb +6 -3
- data/lib/mutant/expression/methods.rb +2 -2
- data/lib/mutant/expression/namespace.rb +2 -2
- data/lib/mutant/expression/parser.rb +1 -1
- data/lib/mutant/hooks.rb +4 -4
- data/lib/mutant/isolation/fork.rb +1 -1
- data/lib/mutant/license/subscription/commercial.rb +3 -3
- data/lib/mutant/license/subscription/opensource.rb +5 -9
- data/lib/mutant/license/subscription.rb +1 -1
- data/lib/mutant/matcher/chain.rb +1 -1
- data/lib/mutant/matcher/config.rb +10 -4
- data/lib/mutant/matcher/descendants.rb +1 -1
- data/lib/mutant/matcher/filter.rb +1 -1
- data/lib/mutant/matcher/method/instance.rb +9 -4
- data/lib/mutant/matcher/method/metaclass.rb +4 -17
- data/lib/mutant/matcher/method/singleton.rb +3 -13
- data/lib/mutant/matcher/method.rb +4 -4
- data/lib/mutant/matcher/methods.rb +4 -2
- data/lib/mutant/matcher/namespace.rb +2 -2
- data/lib/mutant/matcher/scope.rb +3 -3
- data/lib/mutant/matcher/static.rb +1 -1
- data/lib/mutant/matcher.rb +2 -2
- data/lib/mutant/meta/example/verification.rb +2 -2
- data/lib/mutant/meta/example.rb +4 -4
- data/lib/mutant/mutation/config.rb +10 -4
- data/lib/mutant/mutation/runner/sink.rb +80 -0
- data/lib/mutant/mutation/runner.rb +61 -0
- data/lib/mutant/mutation.rb +1 -1
- data/lib/mutant/mutator/node/block.rb +2 -2
- data/lib/mutant/mutator/node/define.rb +1 -1
- data/lib/mutant/mutator/node/if.rb +9 -0
- data/lib/mutant/mutator/node/rescue.rb +1 -1
- data/lib/mutant/mutator/node/send.rb +4 -4
- data/lib/mutant/mutator/regexp.rb +2 -2
- data/lib/mutant/parallel/source.rb +1 -1
- data/lib/mutant/pipe.rb +3 -3
- data/lib/mutant/registry.rb +2 -2
- data/lib/mutant/reporter/cli/format.rb +3 -3
- data/lib/mutant/reporter/cli/printer.rb +2 -2
- data/lib/mutant/reporter/cli.rb +4 -4
- data/lib/mutant/reporter/sequence.rb +1 -1
- data/lib/mutant/repository.rb +1 -1
- data/lib/mutant/result.rb +1 -1
- data/lib/mutant/scope.rb +1 -1
- data/lib/mutant/selector/expression.rb +1 -1
- data/lib/mutant/subject.rb +2 -2
- data/lib/mutant/timer.rb +3 -3
- data/lib/mutant/transform.rb +14 -14
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant.rb +13 -11
- metadata +9 -9
- data/lib/mutant/runner/sink.rb +0 -78
- data/lib/mutant/runner.rb +0 -60
data/lib/mutant/transform.rb
CHANGED
@@ -56,13 +56,13 @@ module Mutant
|
|
56
56
|
|
57
57
|
# Wrapper adding a name to a transformation
|
58
58
|
class Named < self
|
59
|
-
include
|
59
|
+
include Anima.new(:name, :transform)
|
60
60
|
|
61
61
|
# Apply transformation to input
|
62
62
|
#
|
63
63
|
# @return [Either<Error, Object>]
|
64
64
|
def call(input)
|
65
|
-
|
65
|
+
transform.call(input).lmap(&method(:wrap_error))
|
66
66
|
end
|
67
67
|
|
68
68
|
# Named slug
|
@@ -166,7 +166,7 @@ module Mutant
|
|
166
166
|
|
167
167
|
# Transform guarding a specific primitive
|
168
168
|
class Primitive < self
|
169
|
-
include
|
169
|
+
include Anima.new(:primitive)
|
170
170
|
|
171
171
|
MESSAGE = 'Expected: %<expected>s but got: %<actual>s'
|
172
172
|
|
@@ -228,10 +228,10 @@ module Mutant
|
|
228
228
|
|
229
229
|
# Transform an array via mapping it over transform
|
230
230
|
class Array < self
|
231
|
-
include
|
231
|
+
include Anima.new(:transform)
|
232
232
|
|
233
233
|
MESSAGE = 'Failed to coerce array at index: %<index>d'
|
234
|
-
PRIMITIVE = Primitive.new(::Array)
|
234
|
+
PRIMITIVE = Primitive.new(primitive: ::Array)
|
235
235
|
|
236
236
|
private_constant(*constants(false))
|
237
237
|
|
@@ -275,7 +275,7 @@ module Mutant
|
|
275
275
|
include Anima.new(:optional, :required)
|
276
276
|
|
277
277
|
KEY_MESSAGE = 'Missing keys: %<missing>s, Unexpected keys: %<unexpected>s'
|
278
|
-
PRIMITIVE = Primitive.new(::Hash)
|
278
|
+
PRIMITIVE = Primitive.new(primitive: ::Hash)
|
279
279
|
|
280
280
|
private_constant(*constants(false))
|
281
281
|
|
@@ -293,7 +293,7 @@ module Mutant
|
|
293
293
|
|
294
294
|
# Key specific transformation
|
295
295
|
class Key < Transform
|
296
|
-
include
|
296
|
+
include Anima.new(:value, :transform)
|
297
297
|
|
298
298
|
# Rendering slug
|
299
299
|
#
|
@@ -401,7 +401,7 @@ module Mutant
|
|
401
401
|
|
402
402
|
# Sequence of transformations
|
403
403
|
class Sequence < self
|
404
|
-
include
|
404
|
+
include Anima.new(:steps)
|
405
405
|
|
406
406
|
# Apply transformation to input
|
407
407
|
#
|
@@ -423,7 +423,7 @@ module Mutant
|
|
423
423
|
|
424
424
|
# Always successful transformation
|
425
425
|
class Success < self
|
426
|
-
include
|
426
|
+
include Anima.new(:block)
|
427
427
|
|
428
428
|
# Apply transformation to input
|
429
429
|
#
|
@@ -437,7 +437,7 @@ module Mutant
|
|
437
437
|
|
438
438
|
# Generic exception transformer
|
439
439
|
class Exception < self
|
440
|
-
include
|
440
|
+
include Anima.new(:error_class, :block)
|
441
441
|
|
442
442
|
# Apply transformation to input
|
443
443
|
#
|
@@ -452,9 +452,9 @@ module Mutant
|
|
452
452
|
end # Exception
|
453
453
|
|
454
454
|
BOOLEAN = Transform::Boolean.new
|
455
|
-
FLOAT = Transform::Primitive.new(Float)
|
456
|
-
INTEGER = Transform::Primitive.new(Integer)
|
457
|
-
STRING = Transform::Primitive.new(String)
|
458
|
-
STRING_ARRAY = Transform::Array.new(STRING)
|
455
|
+
FLOAT = Transform::Primitive.new(primitive: Float)
|
456
|
+
INTEGER = Transform::Primitive.new(primitive: Integer)
|
457
|
+
STRING = Transform::Primitive.new(primitive: String)
|
458
|
+
STRING_ARRAY = Transform::Array.new(transform: STRING)
|
459
459
|
end # Transform
|
460
460
|
end # Mutant
|
data/lib/mutant/version.rb
CHANGED
data/lib/mutant.rb
CHANGED
@@ -224,8 +224,8 @@ module Mutant
|
|
224
224
|
require 'mutant/cli/command/environment/test'
|
225
225
|
require 'mutant/cli/command/util'
|
226
226
|
require 'mutant/cli/command/root'
|
227
|
-
require 'mutant/runner'
|
228
|
-
require 'mutant/runner/sink'
|
227
|
+
require 'mutant/mutation/runner'
|
228
|
+
require 'mutant/mutation/runner/sink'
|
229
229
|
require 'mutant/result'
|
230
230
|
require 'mutant/reporter'
|
231
231
|
require 'mutant/reporter/null'
|
@@ -295,7 +295,7 @@ module Mutant
|
|
295
295
|
)
|
296
296
|
end
|
297
297
|
|
298
|
-
timer = Timer.new(Process)
|
298
|
+
timer = Timer.new(process: Process)
|
299
299
|
|
300
300
|
recorder = Segment::Recorder.new(
|
301
301
|
gen_id: gen_id,
|
@@ -333,19 +333,21 @@ module Mutant
|
|
333
333
|
class Config
|
334
334
|
DEFAULT = new(
|
335
335
|
coverage_criteria: Config::CoverageCriteria::DEFAULT,
|
336
|
-
expression_parser: Expression::Parser.new(
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
336
|
+
expression_parser: Expression::Parser.new(
|
337
|
+
types: [
|
338
|
+
Expression::Descendants,
|
339
|
+
Expression::Method,
|
340
|
+
Expression::Methods,
|
341
|
+
Expression::Namespace::Exact,
|
342
|
+
Expression::Namespace::Recursive
|
343
|
+
]
|
344
|
+
),
|
343
345
|
environment_variables: EMPTY_HASH,
|
344
346
|
fail_fast: false,
|
345
347
|
hooks: EMPTY_ARRAY,
|
346
348
|
includes: EMPTY_ARRAY,
|
347
349
|
integration: nil,
|
348
|
-
isolation: Mutant::Isolation::Fork.new(WORLD),
|
350
|
+
isolation: Mutant::Isolation::Fork.new(world: WORLD),
|
349
351
|
jobs: nil,
|
350
352
|
matcher: Matcher::Config::DEFAULT,
|
351
353
|
mutation: Mutation::Config::DEFAULT,
|
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.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diff-lcs
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.2.
|
33
|
+
version: 3.2.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.2.
|
40
|
+
version: 3.2.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: regexp_parser
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.6.
|
75
|
+
version: 0.6.7
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.6.
|
82
|
+
version: 0.6.7
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: parallel
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -235,6 +235,8 @@ files:
|
|
235
235
|
- lib/mutant/meta/example/verification.rb
|
236
236
|
- lib/mutant/mutation.rb
|
237
237
|
- lib/mutant/mutation/config.rb
|
238
|
+
- lib/mutant/mutation/runner.rb
|
239
|
+
- lib/mutant/mutation/runner/sink.rb
|
238
240
|
- lib/mutant/mutator.rb
|
239
241
|
- lib/mutant/mutator/node.rb
|
240
242
|
- lib/mutant/mutator/node/and_asgn.rb
|
@@ -330,8 +332,6 @@ files:
|
|
330
332
|
- lib/mutant/repository/diff/ranges.rb
|
331
333
|
- lib/mutant/require_highjack.rb
|
332
334
|
- lib/mutant/result.rb
|
333
|
-
- lib/mutant/runner.rb
|
334
|
-
- lib/mutant/runner/sink.rb
|
335
335
|
- lib/mutant/scope.rb
|
336
336
|
- lib/mutant/segment.rb
|
337
337
|
- lib/mutant/segment/recorder.rb
|
@@ -372,7 +372,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
372
372
|
- !ruby/object:Gem::Version
|
373
373
|
version: '0'
|
374
374
|
requirements: []
|
375
|
-
rubygems_version: 3.
|
375
|
+
rubygems_version: 3.4.10
|
376
376
|
signing_key:
|
377
377
|
specification_version: 4
|
378
378
|
summary: ''
|
data/lib/mutant/runner/sink.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Mutant
|
4
|
-
module Runner
|
5
|
-
class Sink
|
6
|
-
include Concord.new(:env)
|
7
|
-
|
8
|
-
# Initialize object
|
9
|
-
#
|
10
|
-
# @return [undefined]
|
11
|
-
def initialize(*)
|
12
|
-
super
|
13
|
-
@start = env.world.timer.now
|
14
|
-
@subject_results = {}
|
15
|
-
end
|
16
|
-
|
17
|
-
# Runner status
|
18
|
-
#
|
19
|
-
# @return [Result::Env]
|
20
|
-
def status
|
21
|
-
Result::Env.new(
|
22
|
-
env: env,
|
23
|
-
runtime: env.world.timer.now - @start,
|
24
|
-
subject_results: @subject_results.values
|
25
|
-
)
|
26
|
-
end
|
27
|
-
|
28
|
-
# Test if scheduling stopped
|
29
|
-
#
|
30
|
-
# @return [Boolean]
|
31
|
-
def stop?
|
32
|
-
status.stop?
|
33
|
-
end
|
34
|
-
|
35
|
-
# Handle mutation finish
|
36
|
-
#
|
37
|
-
# @param [Result::MutationIndex] mutation_index_result
|
38
|
-
#
|
39
|
-
# @return [self]
|
40
|
-
def result(mutation_index_result)
|
41
|
-
mutation_result = mutation_result(mutation_index_result)
|
42
|
-
|
43
|
-
subject = mutation_result.mutation.subject
|
44
|
-
|
45
|
-
@subject_results[subject] = Result::Subject.new(
|
46
|
-
subject: subject,
|
47
|
-
coverage_results: previous_coverage_results(subject).dup << coverage_result(mutation_result),
|
48
|
-
tests: env.selections.fetch(subject)
|
49
|
-
)
|
50
|
-
|
51
|
-
self
|
52
|
-
end
|
53
|
-
|
54
|
-
private
|
55
|
-
|
56
|
-
def coverage_result(mutation_result)
|
57
|
-
Result::Coverage.new(
|
58
|
-
mutation_result: mutation_result,
|
59
|
-
criteria_result: mutation_result.criteria_result(env.config.coverage_criteria)
|
60
|
-
)
|
61
|
-
end
|
62
|
-
|
63
|
-
def mutation_result(mutation_index_result)
|
64
|
-
Result::Mutation.new(
|
65
|
-
isolation_result: mutation_index_result.isolation_result,
|
66
|
-
mutation: env.mutations.fetch(mutation_index_result.mutation_index),
|
67
|
-
runtime: mutation_index_result.runtime
|
68
|
-
)
|
69
|
-
end
|
70
|
-
|
71
|
-
def previous_coverage_results(subject)
|
72
|
-
subject_result = @subject_results.fetch(subject) { return EMPTY_ARRAY }
|
73
|
-
subject_result.coverage_results
|
74
|
-
end
|
75
|
-
|
76
|
-
end # Sink
|
77
|
-
end # Runner
|
78
|
-
end # Mutant
|
data/lib/mutant/runner.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Mutant
|
4
|
-
# Runner
|
5
|
-
module Runner
|
6
|
-
# Run against env
|
7
|
-
#
|
8
|
-
# @return [Either<String, Result>]
|
9
|
-
def self.call(env)
|
10
|
-
reporter(env).start(env)
|
11
|
-
|
12
|
-
Either::Right.new(run_mutation_analysis(env))
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.run_mutation_analysis(env)
|
16
|
-
reporter = reporter(env)
|
17
|
-
|
18
|
-
env
|
19
|
-
.record(:analysis) { run_driver(reporter, async_driver(env)) }
|
20
|
-
.tap { |result| env.record(:report) { reporter.report(result) } }
|
21
|
-
end
|
22
|
-
private_class_method :run_mutation_analysis
|
23
|
-
|
24
|
-
def self.async_driver(env)
|
25
|
-
Parallel.async(env.world, mutation_test_config(env))
|
26
|
-
end
|
27
|
-
private_class_method :async_driver
|
28
|
-
|
29
|
-
def self.run_driver(reporter, driver)
|
30
|
-
Signal.trap('INT') do
|
31
|
-
driver.stop
|
32
|
-
end
|
33
|
-
|
34
|
-
loop do
|
35
|
-
status = driver.wait_timeout(reporter.delay)
|
36
|
-
break status.payload if status.done?
|
37
|
-
reporter.progress(status)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
private_class_method :run_driver
|
41
|
-
|
42
|
-
def self.mutation_test_config(env)
|
43
|
-
Parallel::Config.new(
|
44
|
-
block: env.method(:cover_index),
|
45
|
-
jobs: env.config.jobs,
|
46
|
-
process_name: 'mutant-worker-process',
|
47
|
-
sink: Sink.new(env),
|
48
|
-
source: Parallel::Source::Array.new(env.mutations.each_index.to_a),
|
49
|
-
thread_name: 'mutant-worker-thread'
|
50
|
-
)
|
51
|
-
end
|
52
|
-
private_class_method :mutation_test_config
|
53
|
-
|
54
|
-
def self.reporter(env)
|
55
|
-
env.config.reporter
|
56
|
-
end
|
57
|
-
private_class_method :reporter
|
58
|
-
|
59
|
-
end # Runner
|
60
|
-
end # Mutant
|