mutant 0.8.8 → 0.8.9
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/Changelog.md +9 -0
- data/README.md +1 -1
- data/Rakefile +12 -8
- data/bin/mutant +5 -1
- data/config/flay.yml +1 -1
- data/lib/mutant.rb +18 -17
- data/lib/mutant/actor.rb +1 -7
- data/lib/mutant/actor/env.rb +0 -4
- data/lib/mutant/actor/mailbox.rb +0 -4
- data/lib/mutant/actor/receiver.rb +0 -4
- data/lib/mutant/actor/sender.rb +0 -2
- data/lib/mutant/ast.rb +1 -5
- data/lib/mutant/ast/meta/const.rb +0 -2
- data/lib/mutant/ast/meta/optarg.rb +0 -2
- data/lib/mutant/ast/meta/send.rb +0 -12
- data/lib/mutant/ast/named_children.rb +0 -10
- data/lib/mutant/ast/sexp.rb +1 -5
- data/lib/mutant/cli.rb +19 -38
- data/lib/mutant/color.rb +1 -7
- data/lib/mutant/config.rb +11 -7
- data/lib/mutant/context.rb +0 -4
- data/lib/mutant/context/scope.rb +0 -18
- data/lib/mutant/delegator.rb +0 -6
- data/lib/mutant/diff.rb +0 -18
- data/lib/mutant/env.rb +8 -24
- data/lib/mutant/env/bootstrap.rb +18 -41
- data/lib/mutant/expression.rb +0 -8
- data/lib/mutant/expression/method.rb +6 -7
- data/lib/mutant/expression/methods.rb +5 -9
- data/lib/mutant/expression/namespace.rb +0 -13
- data/lib/mutant/expression/parser.rb +0 -6
- data/lib/mutant/integration.rb +2 -20
- data/lib/mutant/isolation.rb +0 -4
- data/lib/mutant/loader.rb +20 -35
- data/lib/mutant/matcher.rb +1 -1
- data/lib/mutant/matcher/chain.rb +1 -3
- data/lib/mutant/matcher/compiler.rb +0 -8
- data/lib/mutant/matcher/config.rb +2 -10
- data/lib/mutant/matcher/filter.rb +1 -3
- data/lib/mutant/matcher/method.rb +4 -26
- data/lib/mutant/matcher/method/instance.rb +1 -7
- data/lib/mutant/matcher/method/singleton.rb +0 -12
- data/lib/mutant/matcher/methods.rb +1 -19
- data/lib/mutant/matcher/namespace.rb +1 -7
- data/lib/mutant/matcher/null.rb +1 -3
- data/lib/mutant/matcher/scope.rb +1 -5
- data/lib/mutant/matcher/static.rb +0 -2
- data/lib/mutant/meta.rb +0 -2
- data/lib/mutant/meta/example.rb +0 -28
- data/lib/mutant/meta/example/dsl.rb +2 -16
- data/lib/mutant/mutation.rb +9 -18
- data/lib/mutant/mutator.rb +0 -24
- data/lib/mutant/mutator/node.rb +1 -33
- data/lib/mutant/mutator/node/and_asgn.rb +0 -2
- data/lib/mutant/mutator/node/argument.rb +0 -10
- data/lib/mutant/mutator/node/arguments.rb +0 -12
- data/lib/mutant/mutator/node/begin.rb +0 -4
- data/lib/mutant/mutator/node/binary.rb +2 -11
- data/lib/mutant/mutator/node/block.rb +0 -6
- data/lib/mutant/mutator/node/break.rb +0 -2
- data/lib/mutant/mutator/node/case.rb +0 -6
- data/lib/mutant/mutator/node/conditional_loop.rb +0 -2
- data/lib/mutant/mutator/node/const.rb +1 -3
- data/lib/mutant/mutator/node/define.rb +4 -11
- data/lib/mutant/mutator/node/defined.rb +0 -2
- data/lib/mutant/mutator/node/dstr.rb +0 -2
- data/lib/mutant/mutator/node/dsym.rb +0 -2
- data/lib/mutant/mutator/node/generic.rb +1 -3
- data/lib/mutant/mutator/node/if.rb +0 -8
- data/lib/mutant/mutator/node/kwbegin.rb +0 -2
- data/lib/mutant/mutator/node/literal/array.rb +0 -4
- data/lib/mutant/mutator/node/literal/boolean.rb +0 -2
- data/lib/mutant/mutator/node/literal/fixnum.rb +0 -6
- data/lib/mutant/mutator/node/literal/float.rb +0 -6
- data/lib/mutant/mutator/node/literal/hash.rb +0 -6
- data/lib/mutant/mutator/node/literal/nil.rb +0 -2
- data/lib/mutant/mutator/node/literal/range.rb +0 -8
- data/lib/mutant/mutator/node/literal/regex.rb +0 -4
- data/lib/mutant/mutator/node/literal/string.rb +0 -2
- data/lib/mutant/mutator/node/literal/symbol.rb +0 -2
- data/lib/mutant/mutator/node/masgn.rb +0 -2
- data/lib/mutant/mutator/node/match_current_line.rb +0 -2
- data/lib/mutant/mutator/node/mlhs.rb +0 -2
- data/lib/mutant/mutator/node/named_value/access.rb +0 -8
- data/lib/mutant/mutator/node/named_value/constant_assignment.rb +1 -7
- data/lib/mutant/mutator/node/named_value/variable_assignment.rb +0 -4
- data/lib/mutant/mutator/node/next.rb +0 -2
- data/lib/mutant/mutator/node/noop.rb +0 -2
- data/lib/mutant/mutator/node/nthref.rb +0 -2
- data/lib/mutant/mutator/node/op_asgn.rb +0 -2
- data/lib/mutant/mutator/node/or_asgn.rb +0 -2
- data/lib/mutant/mutator/node/resbody.rb +0 -4
- data/lib/mutant/mutator/node/rescue.rb +0 -10
- data/lib/mutant/mutator/node/return.rb +0 -2
- data/lib/mutant/mutator/node/send.rb +4 -32
- data/lib/mutant/mutator/node/send/attribute_assignment.rb +0 -6
- data/lib/mutant/mutator/node/send/binary.rb +0 -6
- data/lib/mutant/mutator/node/send/index.rb +0 -6
- data/lib/mutant/mutator/node/splat.rb +0 -2
- data/lib/mutant/mutator/node/super.rb +0 -2
- data/lib/mutant/mutator/node/when.rb +0 -10
- data/lib/mutant/mutator/node/yield.rb +0 -2
- data/lib/mutant/mutator/node/zsuper.rb +0 -2
- data/lib/mutant/mutator/registry.rb +0 -6
- data/lib/mutant/mutator/util.rb +0 -4
- data/lib/mutant/mutator/util/array.rb +0 -6
- data/lib/mutant/mutator/util/symbol.rb +0 -2
- data/lib/mutant/parallel.rb +21 -17
- data/lib/mutant/parallel/master.rb +0 -28
- data/lib/mutant/parallel/source.rb +0 -10
- data/lib/mutant/parallel/worker.rb +15 -10
- data/lib/mutant/parser.rb +23 -0
- data/lib/mutant/reporter.rb +5 -8
- data/lib/mutant/reporter/cli.rb +1 -15
- data/lib/mutant/reporter/cli/format.rb +3 -25
- data/lib/mutant/reporter/cli/printer.rb +0 -18
- data/lib/mutant/reporter/cli/printer/config.rb +0 -2
- data/lib/mutant/reporter/cli/printer/env_progress.rb +0 -2
- data/lib/mutant/reporter/cli/printer/env_result.rb +0 -2
- data/lib/mutant/reporter/cli/printer/mutation_progress_result.rb +0 -4
- data/lib/mutant/reporter/cli/printer/mutation_result.rb +0 -16
- data/lib/mutant/reporter/cli/printer/status.rb +0 -6
- data/lib/mutant/reporter/cli/printer/status_progressive.rb +0 -4
- data/lib/mutant/reporter/cli/printer/subject_progress.rb +0 -8
- data/lib/mutant/reporter/cli/printer/subject_result.rb +0 -2
- data/lib/mutant/reporter/cli/printer/test_result.rb +0 -2
- data/lib/mutant/reporter/cli/tput.rb +0 -4
- data/lib/mutant/repository.rb +4 -22
- data/lib/mutant/require_highjack.rb +0 -2
- data/lib/mutant/result.rb +23 -43
- data/lib/mutant/runner.rb +7 -20
- data/lib/mutant/runner/sink.rb +43 -86
- data/lib/mutant/selector.rb +0 -2
- data/lib/mutant/selector/expression.rb +0 -2
- data/lib/mutant/subject.rb +0 -22
- data/lib/mutant/subject/method.rb +2 -10
- data/lib/mutant/subject/method/instance.rb +0 -6
- data/lib/mutant/subject/method/singleton.rb +0 -2
- data/lib/mutant/test.rb +4 -3
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/warning_filter.rb +0 -10
- data/lib/mutant/zombifier.rb +5 -20
- data/meta/or_asgn.rb +6 -0
- data/meta/send.rb +29 -0
- data/mutant-rspec.gemspec +1 -1
- data/spec/integration/mutant/rspec_spec.rb +1 -1
- data/spec/integrations.yml +2 -3
- data/spec/shared/method_matcher_behavior.rb +7 -7
- data/spec/spec_helper.rb +2 -9
- data/spec/support/corpus.rb +37 -30
- data/spec/support/rb_bug.rb +1 -2
- data/spec/support/ruby_vm.rb +6 -3
- data/spec/support/shared_context.rb +19 -20
- data/spec/unit/mutant/actor/binding_spec.rb +6 -6
- data/spec/unit/mutant/actor/env_spec.rb +2 -2
- data/spec/unit/mutant/actor/mailbox_spec.rb +6 -6
- data/spec/unit/mutant/actor/message_spec.rb +2 -2
- data/spec/unit/mutant/actor/receiver_spec.rb +4 -4
- data/spec/unit/mutant/actor/sender_spec.rb +6 -6
- data/spec/unit/mutant/ast_spec.rb +9 -0
- data/spec/unit/mutant/cli_spec.rb +16 -10
- data/spec/unit/mutant/context/scope/root_spec.rb +1 -1
- data/spec/unit/mutant/context/scope/unqualified_name_spec.rb +1 -1
- data/spec/unit/mutant/context/scope_spec.rb +3 -3
- data/spec/unit/mutant/context_spec.rb +0 -22
- data/spec/unit/mutant/env/boostrap_spec.rb +34 -41
- data/spec/unit/mutant/env_spec.rb +74 -32
- data/spec/unit/mutant/integration/rspec_spec.rb +23 -17
- data/spec/unit/mutant/integration_spec.rb +4 -4
- data/spec/unit/mutant/isolation_spec.rb +4 -4
- data/spec/unit/mutant/loader_spec.rb +42 -0
- data/spec/unit/mutant/matcher/compiler_spec.rb +3 -3
- data/spec/unit/mutant/matcher/config_spec.rb +1 -1
- data/spec/unit/mutant/matcher/method/instance_spec.rb +8 -1
- data/spec/unit/mutant/matcher/method/singleton_spec.rb +8 -1
- data/spec/unit/mutant/matcher/namespace_spec.rb +7 -8
- data/spec/unit/mutant/matcher/null_spec.rb +3 -2
- data/spec/unit/mutant/mutation_spec.rb +11 -5
- data/spec/unit/mutant/mutator/registry_spec.rb +1 -1
- data/spec/unit/mutant/parallel/master_spec.rb +9 -9
- data/spec/unit/mutant/parallel/source/array_spec.rb +3 -3
- data/spec/unit/mutant/parallel/worker_spec.rb +5 -5
- data/spec/unit/mutant/parallel_spec.rb +4 -4
- data/spec/unit/mutant/parser_spec.rb +24 -0
- data/spec/unit/mutant/reporter/cli/printer_spec.rb +3 -3
- data/spec/unit/mutant/reporter/cli/tput_spec.rb +2 -2
- data/spec/unit/mutant/reporter/cli_spec.rb +7 -7
- data/spec/unit/mutant/reporter/null_spec.rb +5 -4
- data/spec/unit/mutant/repository/diff_spec.rb +30 -18
- data/spec/unit/mutant/repository/subject_filter_spec.rb +5 -5
- data/spec/unit/mutant/require_highjack_spec.rb +1 -1
- data/spec/unit/mutant/result/env_spec.rb +9 -9
- data/spec/unit/mutant/result/subject_spec.rb +5 -5
- data/spec/unit/mutant/runner/driver_spec.rb +4 -4
- data/spec/unit/mutant/runner/{sink/mutation_spec.rb → sink_spec.rb} +16 -4
- data/spec/unit/mutant/runner_spec.rb +31 -31
- data/spec/unit/mutant/selector/expression_spec.rb +8 -8
- data/spec/unit/mutant/subject/method/instance_spec.rb +9 -3
- data/spec/unit/mutant/subject/method/singleton_spec.rb +1 -1
- data/spec/unit/mutant/subject_spec.rb +1 -5
- data/spec/unit/mutant_spec.rb +3 -3
- metadata +9 -15
- data/config/mutant.yml +0 -14
- data/lib/mutant/cache.rb +0 -29
- data/lib/mutant/reporter/trace.rb +0 -36
- data/spec/support/rspec.rb +0 -21
- data/spec/unit/mutant/cache_spec.rb +0 -22
- data/spec/unit/mutant/loader/eval_spec.rb +0 -44
- data/spec/unit/mutant/reporter/trace_spec.rb +0 -21
- data/test_app/Gemfile.rspec3.2 +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6629a951cb8a81c688c0adc0acac1f3ff41f13b6
|
4
|
+
data.tar.gz: b8e775063ca733fe989083a38c31ef680135cbc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f11084993d2875f56e6fd86174eaae8a1b8681feee2f81d4442914fc63ab9a7e8a9be395145b55b424519f5c7975f114bf5adf0c7e01ce1dca5b2aa091fd0364
|
7
|
+
data.tar.gz: 44e651cc4312db4388d975f1955791966055c67fc4a648a297e34535d9f47cea0588e94921098416d2a0636d0d4d26e017a75377960beeb28dcfa8ad555032c0
|
data/Changelog.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
|
+
# v0.8.9 2016-01-05
|
2
|
+
|
3
|
+
* Add mutation from `Hash#[]` to `Hash#key?` (#511)
|
4
|
+
* Add mutation from `Hash#fetch` to `Hash#key?` (#511)
|
5
|
+
* Add mutation from `#at` to `#key?` (#511)
|
6
|
+
* Add mutation from `Hash#values_at` to `Hash#fetch_values` (#510)
|
7
|
+
|
1
8
|
# v0.8.8 2015-11-15
|
2
9
|
|
10
|
+
* Drop support for rspec-3.2
|
11
|
+
* Remove CI specific job number default
|
3
12
|
* Add support for rspec-3.3.4
|
4
13
|
* Add mutations/s performance metric to report
|
5
14
|
|
data/README.md
CHANGED
@@ -286,7 +286,7 @@ people do talks about it at conferences, user groups or other chances. Thanks fo
|
|
286
286
|
As I (the author @mbj) am not too happy with some of the facts being presented about
|
287
287
|
mutant the last month.
|
288
288
|
|
289
|
-
So if you plan to do a presentation: I offer to review your slides / talk - for free
|
289
|
+
So if you plan to do a presentation: I offer to review your slides / talk - for free of course.
|
290
290
|
My intention is NOT to change your bias pro / against this tool. Just to help to fix
|
291
291
|
invalid statements about the tool.
|
292
292
|
|
data/Rakefile
CHANGED
@@ -6,17 +6,21 @@ Rake.application.load_imports
|
|
6
6
|
|
7
7
|
task('metrics:mutant').clear
|
8
8
|
namespace :metrics do
|
9
|
-
task :
|
10
|
-
|
9
|
+
task mutant: :coverage do
|
10
|
+
arguments = %w[
|
11
11
|
bundle exec mutant
|
12
|
-
--
|
13
|
-
--use rspec
|
12
|
+
--ignore-subject Mutant::Meta*
|
14
13
|
--include lib
|
15
|
-
--require mutant
|
16
14
|
--since HEAD~1
|
17
|
-
--
|
18
|
-
|
19
|
-
|
15
|
+
--require mutant
|
16
|
+
--use rspec
|
17
|
+
--zombie
|
18
|
+
]
|
19
|
+
arguments.concat(%W[--jobs 4]) if ENV.key?('CIRCLE_CI')
|
20
|
+
|
21
|
+
arguments.concat(%w[-- Mutant*])
|
22
|
+
|
23
|
+
success = Kernel.system(*arguments) or fail 'Mutant task is not successful'
|
20
24
|
end
|
21
25
|
end
|
22
26
|
|
data/bin/mutant
CHANGED
@@ -15,7 +15,11 @@ namespace =
|
|
15
15
|
load_path: $LOAD_PATH,
|
16
16
|
kernel: Kernel,
|
17
17
|
pathname: Pathname,
|
18
|
-
require_highjack: Mutant::RequireHighjack
|
18
|
+
require_highjack: Mutant::RequireHighjack
|
19
|
+
.method(:call)
|
20
|
+
.to_proc
|
21
|
+
.curry
|
22
|
+
.call(Kernel),
|
19
23
|
root_require: 'mutant',
|
20
24
|
includes: %w[
|
21
25
|
mutant
|
data/config/flay.yml
CHANGED
data/lib/mutant.rb
CHANGED
@@ -23,6 +23,8 @@ require 'unparser'
|
|
23
23
|
Thread.abort_on_exception = true
|
24
24
|
|
25
25
|
# Library namespace
|
26
|
+
#
|
27
|
+
# @api private
|
26
28
|
module Mutant
|
27
29
|
EMPTY_STRING = ''.freeze
|
28
30
|
EMPTY_ARRAY = [].freeze
|
@@ -32,8 +34,6 @@ module Mutant
|
|
32
34
|
# Test if CI is detected via environment
|
33
35
|
#
|
34
36
|
# @return [Boolean]
|
35
|
-
#
|
36
|
-
# @api private
|
37
37
|
def self.ci?
|
38
38
|
ENV.key?('CI')
|
39
39
|
end
|
@@ -60,7 +60,7 @@ require 'mutant/actor/receiver'
|
|
60
60
|
require 'mutant/actor/sender'
|
61
61
|
require 'mutant/actor/mailbox'
|
62
62
|
require 'mutant/actor/env'
|
63
|
-
require 'mutant/
|
63
|
+
require 'mutant/parser'
|
64
64
|
require 'mutant/delegator'
|
65
65
|
require 'mutant/isolation'
|
66
66
|
require 'mutant/parallel'
|
@@ -69,8 +69,8 @@ require 'mutant/parallel/worker'
|
|
69
69
|
require 'mutant/parallel/source'
|
70
70
|
require 'mutant/warning_filter'
|
71
71
|
require 'mutant/require_highjack'
|
72
|
-
require 'mutant/mutator'
|
73
72
|
require 'mutant/mutation'
|
73
|
+
require 'mutant/mutator'
|
74
74
|
require 'mutant/mutator/registry'
|
75
75
|
require 'mutant/mutator/util'
|
76
76
|
require 'mutant/mutator/util/array'
|
@@ -168,7 +168,6 @@ require 'mutant/runner/sink'
|
|
168
168
|
require 'mutant/result'
|
169
169
|
require 'mutant/reporter'
|
170
170
|
require 'mutant/reporter/null'
|
171
|
-
require 'mutant/reporter/trace'
|
172
171
|
require 'mutant/reporter/cli'
|
173
172
|
require 'mutant/reporter/cli/printer'
|
174
173
|
require 'mutant/reporter/cli/printer/config'
|
@@ -189,26 +188,28 @@ require 'mutant/zombifier'
|
|
189
188
|
module Mutant
|
190
189
|
# Reopen class to initialize constant to avoid dep circle
|
191
190
|
class Config
|
192
|
-
CI_DEFAULT_PROCESSOR_COUNT = 4
|
193
|
-
|
194
191
|
DEFAULT = new(
|
195
192
|
debug: false,
|
196
|
-
fail_fast: false,
|
197
|
-
integration: Integration::Null,
|
198
|
-
matcher: Matcher::Config::DEFAULT,
|
199
|
-
includes: EMPTY_ARRAY,
|
200
|
-
requires: EMPTY_ARRAY,
|
201
|
-
isolation: Mutant::Isolation::Fork,
|
202
|
-
reporter: Reporter::CLI.build($stdout),
|
203
|
-
zombie: false,
|
204
|
-
jobs: Mutant.ci? ? CI_DEFAULT_PROCESSOR_COUNT : ::Parallel.processor_count,
|
205
193
|
expected_coverage: Rational(1),
|
206
194
|
expression_parser: Expression::Parser.new([
|
207
195
|
Expression::Method,
|
208
196
|
Expression::Methods,
|
209
197
|
Expression::Namespace::Exact,
|
210
198
|
Expression::Namespace::Recursive
|
211
|
-
])
|
199
|
+
]),
|
200
|
+
fail_fast: false,
|
201
|
+
includes: EMPTY_ARRAY,
|
202
|
+
integration: Integration::Null,
|
203
|
+
isolation: Mutant::Isolation::Fork,
|
204
|
+
jobs: ::Parallel.processor_count,
|
205
|
+
kernel: Kernel,
|
206
|
+
load_path: $LOAD_PATH,
|
207
|
+
matcher: Matcher::Config::DEFAULT,
|
208
|
+
open3: Open3,
|
209
|
+
pathname: Pathname,
|
210
|
+
requires: EMPTY_ARRAY,
|
211
|
+
reporter: Reporter::CLI.build($stdout),
|
212
|
+
zombie: false
|
212
213
|
)
|
213
214
|
end # Config
|
214
215
|
end # Mutant
|
data/lib/mutant/actor.rb
CHANGED
@@ -13,8 +13,6 @@ module Mutant
|
|
13
13
|
# Object inspection
|
14
14
|
#
|
15
15
|
# @return [String]
|
16
|
-
#
|
17
|
-
# @api private
|
18
16
|
def inspect
|
19
17
|
INSPECT
|
20
18
|
end
|
@@ -30,15 +28,13 @@ module Mutant
|
|
30
28
|
# @param [Object] payload
|
31
29
|
#
|
32
30
|
# @return [Message]
|
33
|
-
#
|
34
|
-
# @api private
|
35
31
|
def self.new(_type, _payload = Undefined)
|
36
32
|
super
|
37
33
|
end
|
38
34
|
|
39
35
|
end # Message
|
40
36
|
|
41
|
-
# Binding to
|
37
|
+
# Binding to other actors sender for simple RPC
|
42
38
|
class Binding
|
43
39
|
include Concord.new(:mailbox, :other)
|
44
40
|
|
@@ -47,8 +43,6 @@ module Mutant
|
|
47
43
|
# @param [Symbol] type
|
48
44
|
#
|
49
45
|
# @return [Object]
|
50
|
-
#
|
51
|
-
# @api private
|
52
46
|
def call(type)
|
53
47
|
other.call(Message.new(type, mailbox.sender))
|
54
48
|
message = mailbox.receiver.call
|
data/lib/mutant/actor/env.rb
CHANGED
@@ -7,8 +7,6 @@ module Mutant
|
|
7
7
|
# Spawn a new actor executing block
|
8
8
|
#
|
9
9
|
# @return [Actor::Sender]
|
10
|
-
#
|
11
|
-
# @api private
|
12
10
|
def spawn
|
13
11
|
mailbox = new_mailbox
|
14
12
|
|
@@ -22,8 +20,6 @@ module Mutant
|
|
22
20
|
# New unbound mailbox
|
23
21
|
#
|
24
22
|
# @return [Mailbox]
|
25
|
-
#
|
26
|
-
# @api private
|
27
23
|
def new_mailbox
|
28
24
|
Mailbox.new
|
29
25
|
end
|
data/lib/mutant/actor/mailbox.rb
CHANGED
@@ -7,8 +7,6 @@ module Mutant
|
|
7
7
|
# New mailbox
|
8
8
|
#
|
9
9
|
# @return [Mailbox]
|
10
|
-
#
|
11
|
-
# @api private
|
12
10
|
def self.new
|
13
11
|
mutex = Mutex.new
|
14
12
|
condition_variable = ConditionVariable.new
|
@@ -25,8 +23,6 @@ module Mutant
|
|
25
23
|
# @param [Actor::Sender] other
|
26
24
|
#
|
27
25
|
# @return [Binding]
|
28
|
-
#
|
29
|
-
# @api private
|
30
26
|
def bind(other)
|
31
27
|
Binding.new(self, other)
|
32
28
|
end
|
@@ -7,8 +7,6 @@ module Mutant
|
|
7
7
|
# Receives a message, blocking
|
8
8
|
#
|
9
9
|
# @return [Object]
|
10
|
-
#
|
11
|
-
# @api private
|
12
10
|
def call
|
13
11
|
2.times do
|
14
12
|
message = try_blocking_receive
|
@@ -26,8 +24,6 @@ module Mutant
|
|
26
24
|
#
|
27
25
|
# @return [Object]
|
28
26
|
# if there is a message
|
29
|
-
#
|
30
|
-
# @api private
|
31
27
|
def try_blocking_receive
|
32
28
|
mutex.synchronize do
|
33
29
|
if messages.empty?
|
data/lib/mutant/actor/sender.rb
CHANGED
data/lib/mutant/ast.rb
CHANGED
@@ -14,8 +14,6 @@ module Mutant
|
|
14
14
|
#
|
15
15
|
# @return [nil]
|
16
16
|
# otherwise
|
17
|
-
#
|
18
|
-
# @api private
|
19
17
|
def self.find_last_path(node, &predicate)
|
20
18
|
fail ArgumentError, 'block expected' unless block_given?
|
21
19
|
path = []
|
@@ -36,11 +34,9 @@ module Mutant
|
|
36
34
|
# all nodes visited recursively including root
|
37
35
|
#
|
38
36
|
# @return [undefined]
|
39
|
-
#
|
40
|
-
# @api private
|
41
37
|
def self.walk(node, stack, &block)
|
42
38
|
block.call(node, stack)
|
43
|
-
node.children.grep(Parser::AST::Node) do |child|
|
39
|
+
node.children.grep(::Parser::AST::Node) do |child|
|
44
40
|
stack.push(child)
|
45
41
|
walk(child, stack, &block)
|
46
42
|
stack.pop
|
data/lib/mutant/ast/meta/send.rb
CHANGED
@@ -15,15 +15,11 @@ module Mutant
|
|
15
15
|
# Arguments of mutated node
|
16
16
|
#
|
17
17
|
# @return [Enumerable<Parser::AST::Node>]
|
18
|
-
#
|
19
|
-
# @api private
|
20
18
|
alias_method :arguments, :remaining_children
|
21
19
|
|
22
20
|
# Test if AST node is a valid assignment target
|
23
21
|
#
|
24
22
|
# @return [Boolean]
|
25
|
-
#
|
26
|
-
# @api private
|
27
23
|
def assignment?
|
28
24
|
index_assignment? || attribute_assignment?
|
29
25
|
end
|
@@ -31,8 +27,6 @@ module Mutant
|
|
31
27
|
# Test if AST node is an attribute assignment?
|
32
28
|
#
|
33
29
|
# @return [Boolean]
|
34
|
-
#
|
35
|
-
# @api private
|
36
30
|
def attribute_assignment?
|
37
31
|
!Types::METHOD_OPERATORS.include?(selector) &&
|
38
32
|
selector.to_s.end_with?(ATTRIBUTE_ASSIGNMENT_SELECTOR_SUFFIX)
|
@@ -41,8 +35,6 @@ module Mutant
|
|
41
35
|
# Test if AST node is an index assign
|
42
36
|
#
|
43
37
|
# @return [Boolean]
|
44
|
-
#
|
45
|
-
# @api private
|
46
38
|
def index_assignment?
|
47
39
|
selector.equal?(INDEX_ASSIGNMENT_SELECTOR)
|
48
40
|
end
|
@@ -50,8 +42,6 @@ module Mutant
|
|
50
42
|
# Test for binary operator implemented as method
|
51
43
|
#
|
52
44
|
# @return [Boolean]
|
53
|
-
#
|
54
|
-
# @api private
|
55
45
|
def binary_method_operator?
|
56
46
|
Types::BINARY_METHOD_OPERATORS.include?(selector)
|
57
47
|
end
|
@@ -59,8 +49,6 @@ module Mutant
|
|
59
49
|
# Test if receiver is possibly a top level constant
|
60
50
|
#
|
61
51
|
# @return [Boolean]
|
62
|
-
#
|
63
|
-
# @api private
|
64
52
|
def receiver_possible_top_level_const?
|
65
53
|
return false unless receiver && n_const?(receiver)
|
66
54
|
|
@@ -9,8 +9,6 @@ module Mutant
|
|
9
9
|
# @param [Class, Module] host
|
10
10
|
#
|
11
11
|
# @return [undefined]
|
12
|
-
#
|
13
|
-
# @api private
|
14
12
|
def self.included(host)
|
15
13
|
host.class_eval do
|
16
14
|
include InstanceMethods
|
@@ -26,8 +24,6 @@ module Mutant
|
|
26
24
|
# Mutated nodes children
|
27
25
|
#
|
28
26
|
# @return [Array<Parser::AST::Node]
|
29
|
-
#
|
30
|
-
# @api private
|
31
27
|
def children
|
32
28
|
node.children
|
33
29
|
end
|
@@ -45,8 +41,6 @@ module Mutant
|
|
45
41
|
# @param [Fixnum] index
|
46
42
|
#
|
47
43
|
# @return [undefined]
|
48
|
-
#
|
49
|
-
# @api private
|
50
44
|
def define_named_child(name, index)
|
51
45
|
define_method(name) do
|
52
46
|
children.at(index)
|
@@ -58,8 +52,6 @@ module Mutant
|
|
58
52
|
# @param [Array<Symbol>] names
|
59
53
|
#
|
60
54
|
# @return [undefined]
|
61
|
-
#
|
62
|
-
# @api private
|
63
55
|
def define_remaining_children(names)
|
64
56
|
define_method(:remaining_children_with_index) do
|
65
57
|
children.each_with_index.drop(names.length)
|
@@ -77,8 +69,6 @@ module Mutant
|
|
77
69
|
# Create name helpers
|
78
70
|
#
|
79
71
|
# @return [undefined]
|
80
|
-
#
|
81
|
-
# @api private
|
82
72
|
def children(*names)
|
83
73
|
names.each_with_index do |name, index|
|
84
74
|
define_named_child(name, index)
|
data/lib/mutant/ast/sexp.rb
CHANGED
@@ -10,10 +10,8 @@ module Mutant
|
|
10
10
|
# @param [Symbol] type
|
11
11
|
#
|
12
12
|
# @return [Parser::AST::Node]
|
13
|
-
#
|
14
|
-
# @api private
|
15
13
|
def s(type, *children)
|
16
|
-
Parser::AST::Node.new(type, children)
|
14
|
+
::Parser::AST::Node.new(type, children)
|
17
15
|
end
|
18
16
|
|
19
17
|
# Build a negated boolean node
|
@@ -21,8 +19,6 @@ module Mutant
|
|
21
19
|
# @param [Parser::AST::Node] node
|
22
20
|
#
|
23
21
|
# @return [Parser::AST::Node]
|
24
|
-
#
|
25
|
-
# @api private
|
26
22
|
def n_not(node)
|
27
23
|
s(:send, node, :!)
|
28
24
|
end
|
data/lib/mutant/cli.rb
CHANGED
@@ -1,37 +1,31 @@
|
|
1
1
|
module Mutant
|
2
2
|
|
3
3
|
# Commandline parser
|
4
|
+
#
|
5
|
+
# rubocop:disable ClassLength
|
4
6
|
class CLI
|
5
7
|
include Adamantium::Flat, Equalizer.new(:config), Procto.call(:config)
|
6
8
|
|
7
9
|
# Error failed when CLI argv is invalid
|
8
10
|
Error = Class.new(RuntimeError)
|
9
11
|
|
10
|
-
EXIT_FAILURE = 1
|
11
|
-
EXIT_SUCCESS = 0
|
12
|
-
|
13
12
|
# Run cli with arguments
|
14
13
|
#
|
15
14
|
# @param [Array<String>] arguments
|
16
15
|
#
|
17
|
-
# @return [
|
18
|
-
# the exit status
|
19
|
-
#
|
20
|
-
# @api private
|
16
|
+
# @return [Boolean]
|
21
17
|
def self.run(arguments)
|
22
|
-
Runner.call(Env::Bootstrap.call(call(arguments))).success?
|
18
|
+
Runner.call(Env::Bootstrap.call(call(arguments))).success?
|
23
19
|
rescue Error => exception
|
24
20
|
$stderr.puts(exception.message)
|
25
|
-
|
21
|
+
false
|
26
22
|
end
|
27
23
|
|
28
|
-
# Initialize
|
24
|
+
# Initialize object
|
29
25
|
#
|
30
26
|
# @param [Array<String>]
|
31
27
|
#
|
32
28
|
# @return [undefined]
|
33
|
-
#
|
34
|
-
# @api private
|
35
29
|
def initialize(arguments)
|
36
30
|
@config = Config::DEFAULT
|
37
31
|
|
@@ -41,8 +35,6 @@ module Mutant
|
|
41
35
|
# Config parsed from CLI
|
42
36
|
#
|
43
37
|
# @return [Config]
|
44
|
-
#
|
45
|
-
# @api private
|
46
38
|
attr_reader :config
|
47
39
|
|
48
40
|
private
|
@@ -56,12 +48,10 @@ module Mutant
|
|
56
48
|
# An error occurred while parsing the options.
|
57
49
|
#
|
58
50
|
# @return [undefined]
|
59
|
-
#
|
60
|
-
# @api private
|
61
51
|
def parse(arguments)
|
62
52
|
opts = OptionParser.new do |builder|
|
63
53
|
builder.banner = 'usage: mutant [options] MATCH_EXPRESSION ...'
|
64
|
-
%
|
54
|
+
%i[add_environment_options add_mutation_options add_filter_options add_debug_options].each do |name|
|
65
55
|
__send__(name, builder)
|
66
56
|
end
|
67
57
|
end
|
@@ -76,8 +66,6 @@ module Mutant
|
|
76
66
|
# @param [Array<String>] expressions
|
77
67
|
#
|
78
68
|
# @return [undefined]
|
79
|
-
#
|
80
|
-
# @api private
|
81
69
|
def parse_match_expressions(expressions)
|
82
70
|
fail Error, 'No expressions given' if expressions.empty?
|
83
71
|
|
@@ -93,8 +81,6 @@ module Mutant
|
|
93
81
|
# @return [undefined]
|
94
82
|
#
|
95
83
|
# rubocop:disable MethodLength
|
96
|
-
#
|
97
|
-
# @api private
|
98
84
|
def add_environment_options(opts)
|
99
85
|
opts.separator('Environment:')
|
100
86
|
opts.on('--zombie', 'Run mutant zombified') do
|
@@ -116,8 +102,6 @@ module Mutant
|
|
116
102
|
# @param [String] name
|
117
103
|
#
|
118
104
|
# @return [undefined]
|
119
|
-
#
|
120
|
-
# @api private
|
121
105
|
def setup_integration(name)
|
122
106
|
with(integration: Integration.setup(name))
|
123
107
|
rescue LoadError
|
@@ -129,8 +113,6 @@ module Mutant
|
|
129
113
|
# @param [OptionParser] opts
|
130
114
|
#
|
131
115
|
# @return [undefined]
|
132
|
-
#
|
133
|
-
# @api private
|
134
116
|
def add_mutation_options(opts)
|
135
117
|
opts.separator(nil)
|
136
118
|
opts.separator('Options:')
|
@@ -149,14 +131,21 @@ module Mutant
|
|
149
131
|
# @param [OptionParser] opts
|
150
132
|
#
|
151
133
|
# @return [undefined]
|
152
|
-
#
|
153
|
-
# @api private
|
154
134
|
def add_filter_options(opts)
|
155
135
|
opts.on('--ignore-subject EXPRESSION', 'Ignore subjects that match EXPRESSION as prefix') do |pattern|
|
156
136
|
add_matcher(:ignore_expressions, config.expression_parser.(pattern))
|
157
137
|
end
|
158
138
|
opts.on('--since REVISION', 'Only select subjects touched since REVISION') do |revision|
|
159
|
-
add_matcher(
|
139
|
+
add_matcher(
|
140
|
+
:subject_filters,
|
141
|
+
Repository::SubjectFilter.new(
|
142
|
+
Repository::Diff.new(
|
143
|
+
config: config,
|
144
|
+
from: Repository::Diff::HEAD,
|
145
|
+
to: revision
|
146
|
+
)
|
147
|
+
)
|
148
|
+
)
|
160
149
|
end
|
161
150
|
end
|
162
151
|
|
@@ -165,22 +154,20 @@ module Mutant
|
|
165
154
|
# @param [OptionParser] opts
|
166
155
|
#
|
167
156
|
# @return [undefined]
|
168
|
-
#
|
169
|
-
# @api private
|
170
157
|
def add_debug_options(opts)
|
171
158
|
opts.on('--fail-fast', 'Fail fast') do
|
172
159
|
with(fail_fast: true)
|
173
160
|
end
|
174
161
|
opts.on('--version', 'Print mutants version') do
|
175
162
|
puts("mutant-#{VERSION}")
|
176
|
-
|
163
|
+
config.kernel.exit
|
177
164
|
end
|
178
165
|
opts.on('-d', '--debug', 'Enable debugging output') do
|
179
166
|
with(debug: true)
|
180
167
|
end
|
181
168
|
opts.on_tail('-h', '--help', 'Show this message') do
|
182
169
|
puts(opts.to_s)
|
183
|
-
|
170
|
+
config.kernel.exit
|
184
171
|
end
|
185
172
|
end
|
186
173
|
|
@@ -189,8 +176,6 @@ module Mutant
|
|
189
176
|
# @param [Hash<Symbol, Object>] attributes
|
190
177
|
#
|
191
178
|
# @return [undefined]
|
192
|
-
#
|
193
|
-
# @api private
|
194
179
|
def with(attributes)
|
195
180
|
@config = config.with(attributes)
|
196
181
|
end
|
@@ -204,8 +189,6 @@ module Mutant
|
|
204
189
|
# the value to add
|
205
190
|
#
|
206
191
|
# @return [undefined]
|
207
|
-
#
|
208
|
-
# @api private
|
209
192
|
def add(attribute, value)
|
210
193
|
with(attribute => config.public_send(attribute) + [value])
|
211
194
|
end
|
@@ -219,8 +202,6 @@ module Mutant
|
|
219
202
|
# the value to add
|
220
203
|
#
|
221
204
|
# @return [undefined]
|
222
|
-
#
|
223
|
-
# @api private
|
224
205
|
def add_matcher(attribute, value)
|
225
206
|
with(matcher: config.matcher.add(attribute, value))
|
226
207
|
end
|