mutant 0.8.24 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +3 -3
- data/Changelog.md +14 -654
- data/Gemfile +13 -0
- data/Gemfile.lock +59 -64
- data/LICENSE +271 -20
- data/README.md +73 -140
- data/Rakefile +0 -21
- data/bin/mutant +7 -2
- data/config/reek.yml +2 -1
- data/config/rubocop.yml +5 -9
- data/docs/incremental.md +76 -0
- data/docs/known-problems.md +0 -14
- data/docs/mutant-minitest.md +1 -1
- data/docs/mutant-rspec.md +2 -24
- data/lib/mutant.rb +45 -53
- data/lib/mutant/ast/nodes.rb +0 -2
- data/lib/mutant/ast/types.rb +1 -117
- data/lib/mutant/base.rb +192 -0
- data/lib/mutant/bootstrap.rb +145 -0
- data/lib/mutant/cli.rb +68 -54
- data/lib/mutant/config.rb +119 -6
- data/lib/mutant/env.rb +94 -8
- data/lib/mutant/expression.rb +6 -1
- data/lib/mutant/expression/parser.rb +9 -31
- data/lib/mutant/integration.rb +64 -36
- data/lib/mutant/isolation.rb +16 -1
- data/lib/mutant/isolation/fork.rb +105 -40
- data/lib/mutant/license.rb +34 -0
- data/lib/mutant/license/subscription.rb +47 -0
- data/lib/mutant/license/subscription/commercial.rb +57 -0
- data/lib/mutant/license/subscription/opensource.rb +77 -0
- data/lib/mutant/loader.rb +27 -4
- data/lib/mutant/matcher.rb +48 -1
- data/lib/mutant/matcher/chain.rb +1 -1
- data/lib/mutant/matcher/config.rb +0 -2
- data/lib/mutant/matcher/filter.rb +1 -1
- data/lib/mutant/matcher/method.rb +11 -7
- data/lib/mutant/matcher/methods.rb +1 -1
- data/lib/mutant/matcher/namespace.rb +1 -1
- data/lib/mutant/matcher/null.rb +1 -1
- data/lib/mutant/matcher/scope.rb +1 -1
- data/lib/mutant/meta/example/dsl.rb +0 -8
- data/lib/mutant/mutation.rb +1 -2
- data/lib/mutant/mutator/node.rb +2 -9
- data/lib/mutant/mutator/node/arguments.rb +1 -1
- data/lib/mutant/mutator/node/class.rb +0 -8
- data/lib/mutant/mutator/node/define.rb +0 -12
- data/lib/mutant/mutator/node/generic.rb +30 -44
- data/lib/mutant/mutator/node/index.rb +4 -4
- data/lib/mutant/mutator/node/literal/regex.rb +0 -39
- data/lib/mutant/mutator/node/send.rb +13 -12
- data/lib/mutant/parallel.rb +61 -40
- data/lib/mutant/parallel/driver.rb +59 -0
- data/lib/mutant/parallel/source.rb +6 -2
- data/lib/mutant/parallel/worker.rb +63 -45
- data/lib/mutant/range.rb +15 -0
- data/lib/mutant/reporter/cli.rb +5 -11
- data/lib/mutant/reporter/cli/format.rb +3 -46
- data/lib/mutant/reporter/cli/printer/config.rb +5 -6
- data/lib/mutant/reporter/cli/printer/env.rb +40 -0
- data/lib/mutant/reporter/cli/printer/env_progress.rb +13 -17
- data/lib/mutant/reporter/cli/printer/isolation_result.rb +17 -3
- data/lib/mutant/reporter/cli/printer/mutation_result.rb +2 -3
- data/lib/mutant/reporter/cli/printer/status_progressive.rb +19 -10
- data/lib/mutant/repository.rb +0 -65
- data/lib/mutant/repository/diff.rb +104 -0
- data/lib/mutant/repository/diff/ranges.rb +52 -0
- data/lib/mutant/result.rb +16 -7
- data/lib/mutant/runner.rb +38 -47
- data/lib/mutant/runner/sink.rb +1 -1
- data/lib/mutant/selector/null.rb +19 -0
- data/lib/mutant/subject.rb +3 -1
- data/lib/mutant/subject/method/instance.rb +3 -1
- data/lib/mutant/transform.rb +511 -0
- data/lib/mutant/variable.rb +282 -0
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/warnings.rb +113 -0
- data/meta/case.rb +1 -0
- data/meta/class.rb +0 -9
- data/meta/def.rb +1 -26
- data/meta/regexp.rb +10 -20
- data/meta/send.rb +14 -46
- data/mutant-minitest.gemspec +1 -1
- data/mutant-rspec.gemspec +2 -2
- data/mutant.gemspec +15 -16
- data/mutant.yml +6 -0
- data/spec/integration/mutant/isolation/fork_spec.rb +22 -5
- data/spec/integration/mutant/minitest_spec.rb +3 -2
- data/spec/integration/mutant/rspec_spec.rb +4 -3
- data/spec/integrations.yml +16 -13
- data/spec/shared/base_behavior.rb +45 -0
- data/spec/shared/framework_integration_behavior.rb +43 -14
- data/spec/spec_helper.rb +21 -17
- data/spec/support/corpus.rb +56 -95
- data/spec/support/shared_context.rb +37 -14
- data/spec/support/xspec.rb +7 -3
- data/spec/unit/mutant/bootstrap_spec.rb +216 -0
- data/spec/unit/mutant/cli_spec.rb +173 -117
- data/spec/unit/mutant/config_spec.rb +126 -0
- data/spec/unit/mutant/either_spec.rb +247 -0
- data/spec/unit/mutant/env_spec.rb +162 -40
- data/spec/unit/mutant/expression/method_spec.rb +16 -0
- data/spec/unit/mutant/expression/parser_spec.rb +29 -33
- data/spec/unit/mutant/expression_spec.rb +5 -7
- data/spec/unit/mutant/integration_spec.rb +100 -9
- data/spec/unit/mutant/isolation/fork_spec.rb +125 -67
- data/spec/unit/mutant/isolation/result_spec.rb +33 -1
- data/spec/unit/mutant/license_spec.rb +257 -0
- data/spec/unit/mutant/loader_spec.rb +50 -11
- data/spec/unit/mutant/matcher/compiler_spec.rb +0 -78
- data/spec/unit/mutant/matcher/method/instance_spec.rb +55 -11
- data/spec/unit/mutant/matcher/method/singleton_spec.rb +12 -2
- data/spec/unit/mutant/matcher_spec.rb +102 -0
- data/spec/unit/mutant/maybe_spec.rb +60 -0
- data/spec/unit/mutant/meta/example/dsl_spec.rb +1 -17
- data/spec/unit/mutant/mutation_spec.rb +13 -6
- data/spec/unit/mutant/parallel/driver_spec.rb +112 -14
- data/spec/unit/mutant/parallel/source/array_spec.rb +25 -17
- data/spec/unit/mutant/parallel/worker_spec.rb +182 -44
- data/spec/unit/mutant/parallel_spec.rb +105 -8
- data/spec/unit/mutant/range_spec.rb +141 -0
- data/spec/unit/mutant/reporter/cli/printer/config_spec.rb +7 -21
- data/spec/unit/mutant/reporter/cli/printer/env_progress_spec.rb +15 -6
- data/spec/unit/mutant/reporter/cli/printer/env_result_spec.rb +10 -2
- data/spec/unit/mutant/reporter/cli/printer/isolation_result_spec.rb +12 -4
- data/spec/unit/mutant/reporter/cli/printer/mutation_result_spec.rb +31 -2
- data/spec/unit/mutant/reporter/cli/printer/status_progressive_spec.rb +4 -4
- data/spec/unit/mutant/reporter/cli/printer/subject_result_spec.rb +5 -0
- data/spec/unit/mutant/reporter/cli_spec.rb +46 -123
- data/spec/unit/mutant/repository/diff/ranges_spec.rb +180 -0
- data/spec/unit/mutant/repository/diff_spec.rb +84 -71
- data/spec/unit/mutant/require_highjack_spec.rb +1 -1
- data/spec/unit/mutant/result/env_spec.rb +39 -9
- data/spec/unit/mutant/result/test_spec.rb +14 -0
- data/spec/unit/mutant/runner_spec.rb +88 -41
- data/spec/unit/mutant/selector/expression_spec.rb +11 -10
- data/spec/unit/mutant/selector/null_spec.rb +17 -0
- data/spec/unit/mutant/subject/method/instance_spec.rb +44 -5
- data/spec/unit/mutant/subject/method/singleton_spec.rb +9 -2
- data/spec/unit/mutant/subject_spec.rb +9 -1
- data/spec/unit/mutant/transform/array_spec.rb +92 -0
- data/spec/unit/mutant/transform/bool_spec.rb +63 -0
- data/spec/unit/mutant/transform/error_spec.rb +132 -0
- data/spec/unit/mutant/transform/exception_spec.rb +44 -0
- data/spec/unit/mutant/transform/hash_spec.rb +236 -0
- data/spec/unit/mutant/transform/index_spec.rb +92 -0
- data/spec/unit/mutant/transform/named_spec.rb +49 -0
- data/spec/unit/mutant/transform/primitive_spec.rb +56 -0
- data/spec/unit/mutant/transform/sequence_spec.rb +98 -0
- data/spec/unit/mutant/variable_spec.rb +618 -0
- data/spec/unit/mutant/warnings_spec.rb +89 -0
- data/spec/unit/mutant/world_spec.rb +63 -0
- data/test_app/Gemfile.minitest +0 -2
- metadata +79 -113
- data/.gitattributes +0 -1
- data/.ruby-gemset +0 -1
- data/config/triage.yml +0 -2
- data/lib/mutant/actor.rb +0 -57
- data/lib/mutant/actor/env.rb +0 -31
- data/lib/mutant/actor/mailbox.rb +0 -34
- data/lib/mutant/actor/receiver.rb +0 -42
- data/lib/mutant/actor/sender.rb +0 -26
- data/lib/mutant/ast/meta/restarg.rb +0 -19
- data/lib/mutant/ast/regexp.rb +0 -42
- data/lib/mutant/ast/regexp/transformer.rb +0 -187
- data/lib/mutant/ast/regexp/transformer/direct.rb +0 -123
- data/lib/mutant/ast/regexp/transformer/named_group.rb +0 -59
- data/lib/mutant/ast/regexp/transformer/options_group.rb +0 -83
- data/lib/mutant/ast/regexp/transformer/quantifier.rb +0 -114
- data/lib/mutant/ast/regexp/transformer/recursive.rb +0 -58
- data/lib/mutant/ast/regexp/transformer/root.rb +0 -31
- data/lib/mutant/ast/regexp/transformer/text.rb +0 -60
- data/lib/mutant/env/bootstrap.rb +0 -160
- data/lib/mutant/matcher/compiler.rb +0 -60
- data/lib/mutant/mutator/node/regexp.rb +0 -35
- data/lib/mutant/mutator/node/regexp/alternation_meta.rb +0 -23
- data/lib/mutant/mutator/node/regexp/capture_group.rb +0 -28
- data/lib/mutant/mutator/node/regexp/character_type.rb +0 -32
- data/lib/mutant/mutator/node/regexp/end_of_line_anchor.rb +0 -23
- data/lib/mutant/mutator/node/regexp/end_of_string_or_before_end_of_line_anchor.rb +0 -23
- data/lib/mutant/mutator/node/regexp/greedy_zero_or_more.rb +0 -27
- data/lib/mutant/parallel/master.rb +0 -181
- data/lib/mutant/reporter/cli/printer/status.rb +0 -53
- data/lib/mutant/reporter/cli/tput.rb +0 -46
- data/lib/mutant/warning_filter.rb +0 -61
- data/meta/regexp/character_types.rb +0 -23
- data/meta/regexp/regexp_alternation_meta.rb +0 -13
- data/meta/regexp/regexp_bol_anchor.rb +0 -10
- data/meta/regexp/regexp_bos_anchor.rb +0 -18
- data/meta/regexp/regexp_capture_group.rb +0 -19
- data/meta/regexp/regexp_eol_anchor.rb +0 -10
- data/meta/regexp/regexp_eos_anchor.rb +0 -8
- data/meta/regexp/regexp_eos_ob_eol_anchor.rb +0 -10
- data/meta/regexp/regexp_greedy_zero_or_more.rb +0 -12
- data/meta/regexp/regexp_root_expression.rb +0 -10
- data/meta/restarg.rb +0 -10
- data/spec/support/fake_actor.rb +0 -111
- data/spec/support/warning.rb +0 -66
- data/spec/unit/mutant/actor/binding_spec.rb +0 -34
- data/spec/unit/mutant/actor/env_spec.rb +0 -31
- data/spec/unit/mutant/actor/mailbox_spec.rb +0 -28
- data/spec/unit/mutant/actor/message_spec.rb +0 -25
- data/spec/unit/mutant/actor/receiver_spec.rb +0 -58
- data/spec/unit/mutant/actor/sender_spec.rb +0 -24
- data/spec/unit/mutant/ast/regexp/parse_spec.rb +0 -19
- data/spec/unit/mutant/ast/regexp/transformer/lookup_table/table_spec.rb +0 -21
- data/spec/unit/mutant/ast/regexp/transformer/lookup_table_spec.rb +0 -35
- data/spec/unit/mutant/ast/regexp/transformer_spec.rb +0 -21
- data/spec/unit/mutant/ast/regexp_spec.rb +0 -704
- data/spec/unit/mutant/env/bootstrap_spec.rb +0 -188
- data/spec/unit/mutant/matcher/compiler/subject_prefix_spec.rb +0 -26
- data/spec/unit/mutant/parallel/master_spec.rb +0 -338
- data/spec/unit/mutant/reporter/cli/printer/status_spec.rb +0 -121
- data/spec/unit/mutant/reporter/cli/tput_spec.rb +0 -50
- data/spec/unit/mutant/warning_filter_spec.rb +0 -106
- data/spec/unit/mutant_spec.rb +0 -17
- data/test_app/Gemfile.rspec3.7 +0 -7
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mutant
|
4
|
+
module Parallel
|
5
|
+
# Driver for parallelized execution
|
6
|
+
class Driver
|
7
|
+
include Adamantium::Flat, Anima.new(
|
8
|
+
:threads,
|
9
|
+
:var_active_jobs,
|
10
|
+
:var_final,
|
11
|
+
:var_sink
|
12
|
+
)
|
13
|
+
|
14
|
+
private(*anima.attribute_names)
|
15
|
+
|
16
|
+
# Wait for computation to finish, with timeout
|
17
|
+
#
|
18
|
+
# @param [Float] timeout
|
19
|
+
#
|
20
|
+
# @return [Variable::Result<Sink#status>]
|
21
|
+
# current status
|
22
|
+
def wait_timeout(timeout)
|
23
|
+
var_final.take_timeout(timeout)
|
24
|
+
|
25
|
+
finalize(status)
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
# Possibly finalize the exeuction
|
31
|
+
#
|
32
|
+
# @param [Status]
|
33
|
+
#
|
34
|
+
# @return [Status]
|
35
|
+
def finalize(status)
|
36
|
+
status.tap do
|
37
|
+
threads.each(&:join) if status.done?
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Get status
|
42
|
+
#
|
43
|
+
# @return [Status]
|
44
|
+
#
|
45
|
+
# ignore :reek:NestedIterators
|
46
|
+
def status
|
47
|
+
var_active_jobs.with do |active_jobs|
|
48
|
+
var_sink.with do |sink|
|
49
|
+
Status.new(
|
50
|
+
active_jobs: active_jobs.dup.freeze,
|
51
|
+
done: threads.all? { |thread| !thread.alive? },
|
52
|
+
payload: sink.status
|
53
|
+
)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end # Driver
|
58
|
+
end # Parallel
|
59
|
+
end # Mutant
|
@@ -6,6 +6,10 @@ module Mutant
|
|
6
6
|
class Source
|
7
7
|
include AbstractType
|
8
8
|
|
9
|
+
class Job
|
10
|
+
include Adamantium, Anima.new(:index, :payload)
|
11
|
+
end
|
12
|
+
|
9
13
|
NoJobError = Class.new(RuntimeError)
|
10
14
|
|
11
15
|
# Next job
|
@@ -43,13 +47,13 @@ module Mutant
|
|
43
47
|
|
44
48
|
# Next job
|
45
49
|
#
|
46
|
-
# @return [
|
50
|
+
# @return [Job]
|
47
51
|
#
|
48
52
|
# @raise [NoJobError]
|
49
53
|
# when no next job is available
|
50
54
|
def next
|
51
55
|
fail NoJobError unless next?
|
52
|
-
jobs.fetch(@next_index).tap do
|
56
|
+
Job.new(index: @next_index, payload: jobs.fetch(@next_index)).tap do
|
53
57
|
@next_index += 1
|
54
58
|
end
|
55
59
|
end
|
@@ -2,74 +2,92 @@
|
|
2
2
|
|
3
3
|
module Mutant
|
4
4
|
module Parallel
|
5
|
-
# Parallel execution worker
|
6
5
|
class Worker
|
7
6
|
include Adamantium::Flat, Anima.new(
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
7
|
+
:processor,
|
8
|
+
:var_active_jobs,
|
9
|
+
:var_final,
|
10
|
+
:var_running,
|
11
|
+
:var_sink,
|
12
|
+
:var_source
|
11
13
|
)
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
#
|
15
|
+
private(*anima.attribute_names)
|
16
|
+
|
17
|
+
# Run worker payload
|
16
18
|
#
|
17
19
|
# @return [self]
|
18
|
-
|
19
|
-
|
20
|
+
#
|
21
|
+
# ignore :reek:TooManyStatements
|
22
|
+
def call
|
23
|
+
loop do
|
24
|
+
job = next_job or break
|
25
|
+
|
26
|
+
job_start(job)
|
27
|
+
|
28
|
+
result = processor.call(job.payload)
|
29
|
+
|
30
|
+
job_done(job)
|
31
|
+
|
32
|
+
break if add_result(result)
|
33
|
+
end
|
34
|
+
|
35
|
+
finalize
|
36
|
+
|
20
37
|
self
|
21
38
|
end
|
22
39
|
|
23
|
-
|
40
|
+
private
|
24
41
|
|
25
|
-
#
|
42
|
+
# Next job, if any
|
26
43
|
#
|
27
|
-
# @return [
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
parent.call(Actor::Message.new(:ready, mailbox.sender))
|
33
|
-
end until handle(mailbox.receiver.call)
|
44
|
+
# @return [Job, nil]
|
45
|
+
def next_job
|
46
|
+
var_source.with do |source|
|
47
|
+
source.next if source.next?
|
48
|
+
end
|
34
49
|
end
|
35
50
|
|
36
|
-
|
37
|
-
|
38
|
-
# Handle job
|
51
|
+
# Add result
|
39
52
|
#
|
40
|
-
# @param [
|
53
|
+
# @param [Object] result
|
41
54
|
#
|
42
55
|
# @return [Boolean]
|
43
|
-
def
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
56
|
+
def add_result(result)
|
57
|
+
var_sink.with do |sink|
|
58
|
+
sink.result(result)
|
59
|
+
sink.stop?
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Register job to be started
|
64
|
+
#
|
65
|
+
# @param [Job] job
|
66
|
+
#
|
67
|
+
# @return [undefined]
|
68
|
+
def job_start(job)
|
69
|
+
var_active_jobs.with do |active_jobs|
|
70
|
+
active_jobs << job
|
53
71
|
end
|
54
72
|
end
|
55
73
|
|
56
|
-
#
|
74
|
+
# Register job to be done
|
57
75
|
#
|
58
76
|
# @param [Job] job
|
77
|
+
# @param [Object] result
|
78
|
+
#
|
79
|
+
# @return [undefined]
|
80
|
+
def job_done(job)
|
81
|
+
var_active_jobs.with do |active_jobs|
|
82
|
+
active_jobs.delete(job)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Finalize worker
|
59
87
|
#
|
60
88
|
# @return [undefined]
|
61
|
-
def
|
62
|
-
|
63
|
-
|
64
|
-
parent.call(
|
65
|
-
Actor::Message.new(
|
66
|
-
:result,
|
67
|
-
JobResult.new(
|
68
|
-
job: job,
|
69
|
-
payload: result
|
70
|
-
)
|
71
|
-
)
|
72
|
-
)
|
89
|
+
def finalize
|
90
|
+
var_final.put(nil) if var_running.modify(&:pred).zero?
|
73
91
|
end
|
74
92
|
|
75
93
|
end # Worker
|
data/lib/mutant/range.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mutant
|
4
|
+
module Range
|
5
|
+
# Test if two ranges overlap
|
6
|
+
#
|
7
|
+
# @param [Range] left
|
8
|
+
# @param [Range] right
|
9
|
+
#
|
10
|
+
# @return [Boolean]
|
11
|
+
def self.overlap?(left, right)
|
12
|
+
left.end >= right.begin && right.end >= left.begin
|
13
|
+
end
|
14
|
+
end # Range
|
15
|
+
end # end
|
data/lib/mutant/reporter/cli.rb
CHANGED
@@ -14,19 +14,15 @@ module Mutant
|
|
14
14
|
#
|
15
15
|
# :reek:ManualDispatch
|
16
16
|
def self.build(output)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
else
|
22
|
-
Format::Progressive.new(tty: tty)
|
23
|
-
end
|
24
|
-
new(output, format)
|
17
|
+
new(
|
18
|
+
output,
|
19
|
+
Format::Progressive.new(output.respond_to?(:tty?) && output.tty?)
|
20
|
+
)
|
25
21
|
end
|
26
22
|
|
27
23
|
# Report start
|
28
24
|
#
|
29
|
-
# @param [Env
|
25
|
+
# @param [Env] env
|
30
26
|
#
|
31
27
|
# @return [self]
|
32
28
|
def start(env)
|
@@ -46,8 +42,6 @@ module Mutant
|
|
46
42
|
|
47
43
|
# Report delay in seconds
|
48
44
|
#
|
49
|
-
# TODO: Move this to a callback registration
|
50
|
-
#
|
51
45
|
# @return [Float]
|
52
46
|
def delay
|
53
47
|
format.delay
|
@@ -7,11 +7,11 @@ module Mutant
|
|
7
7
|
#
|
8
8
|
# rubocop:disable FormatString
|
9
9
|
class Format
|
10
|
-
include AbstractType,
|
10
|
+
include AbstractType, Concord.new(:tty)
|
11
11
|
|
12
12
|
# Start representation
|
13
13
|
#
|
14
|
-
# @param [Env
|
14
|
+
# @param [Env] env
|
15
15
|
#
|
16
16
|
# @return [String]
|
17
17
|
abstract_method :start
|
@@ -72,7 +72,7 @@ module Mutant
|
|
72
72
|
#
|
73
73
|
# @return [String]
|
74
74
|
def start(env)
|
75
|
-
format(Printer::
|
75
|
+
format(Printer::Env, env)
|
76
76
|
end
|
77
77
|
|
78
78
|
# Progress representation
|
@@ -92,49 +92,6 @@ module Mutant
|
|
92
92
|
end
|
93
93
|
|
94
94
|
end # Progressive
|
95
|
-
|
96
|
-
# Format for framed rewindable output
|
97
|
-
class Framed < self
|
98
|
-
include anima.add(:tput)
|
99
|
-
|
100
|
-
BUFFER_FLAGS = 'a+'
|
101
|
-
|
102
|
-
REPORT_FREQUENCY = 20.0
|
103
|
-
REPORT_DELAY = 1 / REPORT_FREQUENCY
|
104
|
-
|
105
|
-
# Format start
|
106
|
-
#
|
107
|
-
# @param [Env::Bootstrap] env
|
108
|
-
#
|
109
|
-
# @return [String]
|
110
|
-
def start(_env)
|
111
|
-
tput.prepare
|
112
|
-
end
|
113
|
-
|
114
|
-
# Format progress
|
115
|
-
#
|
116
|
-
# @param [Runner::Status] status
|
117
|
-
#
|
118
|
-
# @return [String]
|
119
|
-
def progress(status)
|
120
|
-
format(Printer::Status, status)
|
121
|
-
end
|
122
|
-
|
123
|
-
private
|
124
|
-
|
125
|
-
# New buffer
|
126
|
-
#
|
127
|
-
# @return [StringIO]
|
128
|
-
def new_buffer
|
129
|
-
# For some reason this raises an Errno::EACCESS error:
|
130
|
-
#
|
131
|
-
# StringIO.new(Tput::INSTANCE.restore, BUFFER_FLAGS)
|
132
|
-
#
|
133
|
-
buffer = StringIO.new
|
134
|
-
buffer << tput.restore
|
135
|
-
end
|
136
|
-
|
137
|
-
end # Framed
|
138
95
|
end # Format
|
139
96
|
end # CLI
|
140
97
|
end # Reporter
|
@@ -13,12 +13,11 @@ module Mutant
|
|
13
13
|
#
|
14
14
|
# @return [undefined]
|
15
15
|
def run
|
16
|
-
info '
|
17
|
-
info '
|
18
|
-
info '
|
19
|
-
info '
|
20
|
-
info '
|
21
|
-
info 'Requires: %s', object.requires
|
16
|
+
info 'Matcher: %s', object.matcher.inspect
|
17
|
+
info 'Integration: %s', object.integration
|
18
|
+
info 'Jobs: %d', object.jobs
|
19
|
+
info 'Includes: %s', object.includes
|
20
|
+
info 'Requires: %s', object.requires
|
22
21
|
end
|
23
22
|
|
24
23
|
end # Config
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Mutant
|
4
|
+
class Reporter
|
5
|
+
class CLI
|
6
|
+
class Printer
|
7
|
+
# Env printer
|
8
|
+
class Env < self
|
9
|
+
delegate(
|
10
|
+
:amount_mutations,
|
11
|
+
:amount_selected_tests,
|
12
|
+
:amount_subjects,
|
13
|
+
:amount_total_tests,
|
14
|
+
:config,
|
15
|
+
:test_subject_ratio
|
16
|
+
)
|
17
|
+
|
18
|
+
FORMATS = IceNine.deep_freeze([
|
19
|
+
[:info, 'Subjects: %s', :amount_subjects ],
|
20
|
+
[:info, 'Total-Tests: %s', :amount_total_tests ],
|
21
|
+
[:info, 'Selected-Tests: %s', :amount_selected_tests],
|
22
|
+
[:info, 'Tests/Subject: %0.2f avg', :test_subject_ratio ],
|
23
|
+
[:info, 'Mutations: %s', :amount_mutations ]
|
24
|
+
])
|
25
|
+
|
26
|
+
# Run printer
|
27
|
+
#
|
28
|
+
# @return [undefined]
|
29
|
+
def run
|
30
|
+
info('Mutant environment:')
|
31
|
+
visit(Config, config)
|
32
|
+
FORMATS.each do |report, format, value|
|
33
|
+
__send__(report, format, __send__(value))
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end # EnvProgress
|
37
|
+
end # Printer
|
38
|
+
end # CLI
|
39
|
+
end # Reporter
|
40
|
+
end # Mutant
|
@@ -7,36 +7,32 @@ module Mutant
|
|
7
7
|
# Env progress printer
|
8
8
|
class EnvProgress < self
|
9
9
|
delegate(
|
10
|
-
:
|
11
|
-
:amount_subjects,
|
12
|
-
:amount_mutations,
|
10
|
+
:amount_mutation_results,
|
13
11
|
:amount_mutations_alive,
|
14
12
|
:amount_mutations_killed,
|
15
|
-
:
|
16
|
-
:
|
13
|
+
:coverage,
|
14
|
+
:env,
|
17
15
|
:killtime,
|
18
16
|
:overhead,
|
19
|
-
:
|
17
|
+
:runtime
|
20
18
|
)
|
21
19
|
|
22
20
|
FORMATS = IceNine.deep_freeze([
|
23
|
-
[:info, '
|
24
|
-
[:info, '
|
25
|
-
[:info, '
|
26
|
-
[:info, '
|
27
|
-
[:info, '
|
28
|
-
[:info, '
|
29
|
-
[:info, '
|
30
|
-
[:
|
31
|
-
[:info, 'Mutations/s: %0.2f', :mutations_per_second ],
|
32
|
-
[:status, 'Coverage: %0.2f%%', :coverage_percent ]
|
21
|
+
[:info, 'Results: %s', :amount_mutation_results],
|
22
|
+
[:info, 'Kills: %s', :amount_mutations_killed],
|
23
|
+
[:info, 'Alive: %s', :amount_mutations_alive ],
|
24
|
+
[:info, 'Runtime: %0.2fs', :runtime ],
|
25
|
+
[:info, 'Killtime: %0.2fs', :killtime ],
|
26
|
+
[:info, 'Overhead: %0.2f%%', :overhead_percent ],
|
27
|
+
[:info, 'Mutations/s: %0.2f', :mutations_per_second ],
|
28
|
+
[:status, 'Coverage: %0.2f%%', :coverage_percent ]
|
33
29
|
])
|
34
30
|
|
35
31
|
# Run printer
|
36
32
|
#
|
37
33
|
# @return [undefined]
|
38
34
|
def run
|
39
|
-
visit(
|
35
|
+
visit(Env, env)
|
40
36
|
FORMATS.each do |report, format, value|
|
41
37
|
__send__(report, format, __send__(value))
|
42
38
|
end
|