mutant 0.8.8 → 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/meta/or_asgn.rb
CHANGED
data/meta/send.rb
CHANGED
@@ -223,6 +223,22 @@ Mutant::Meta::Example.add do
|
|
223
223
|
mutation 'self.gsub(a, b)'
|
224
224
|
end
|
225
225
|
|
226
|
+
Mutant::Meta::Example.add do
|
227
|
+
source 'foo.values_at(a, b)'
|
228
|
+
|
229
|
+
singleton_mutations
|
230
|
+
mutation 'foo.fetch_values(a, b)'
|
231
|
+
mutation 'foo'
|
232
|
+
mutation 'self.values_at(a, b)'
|
233
|
+
mutation 'foo.values_at(a)'
|
234
|
+
mutation 'foo.values_at(b)'
|
235
|
+
mutation 'foo.values_at(nil, b)'
|
236
|
+
mutation 'foo.values_at(self, b)'
|
237
|
+
mutation 'foo.values_at(a, nil)'
|
238
|
+
mutation 'foo.values_at(a, self)'
|
239
|
+
mutation 'foo.values_at'
|
240
|
+
end
|
241
|
+
|
226
242
|
Mutant::Meta::Example.add do
|
227
243
|
source 'foo.__send__(bar)'
|
228
244
|
|
@@ -359,6 +375,15 @@ Mutant::Meta::Example.add do
|
|
359
375
|
mutation 'foo(nil)'
|
360
376
|
end
|
361
377
|
|
378
|
+
Mutant::Meta::Example.add do
|
379
|
+
source 'self.fetch(nil)'
|
380
|
+
|
381
|
+
singleton_mutations
|
382
|
+
mutation 'self.fetch'
|
383
|
+
mutation 'fetch(nil)'
|
384
|
+
mutation 'self.key?(nil)'
|
385
|
+
end
|
386
|
+
|
362
387
|
Unparser::Constants::KEYWORDS.each do |keyword|
|
363
388
|
Mutant::Meta::Example.add do
|
364
389
|
source "foo.#{keyword}(nil)"
|
@@ -405,6 +430,7 @@ Mutant::Meta::Example.add do
|
|
405
430
|
mutation 'foo[]'
|
406
431
|
mutation 'foo.at(1)'
|
407
432
|
mutation 'foo.fetch(1)'
|
433
|
+
mutation 'foo.key?(1)'
|
408
434
|
mutation 'self[1]'
|
409
435
|
mutation 'foo[0]'
|
410
436
|
mutation 'foo[2]'
|
@@ -420,6 +446,7 @@ Mutant::Meta::Example.add do
|
|
420
446
|
mutation 'self.foo'
|
421
447
|
mutation 'self.foo.at()'
|
422
448
|
mutation 'self.foo.fetch()'
|
449
|
+
mutation 'self.foo.key?()'
|
423
450
|
mutation 'self[]'
|
424
451
|
mutation 'foo[]'
|
425
452
|
end
|
@@ -433,6 +460,7 @@ Mutant::Meta::Example.add do
|
|
433
460
|
mutation 'self[]'
|
434
461
|
mutation 'self.at(foo)'
|
435
462
|
mutation 'self.fetch(foo)'
|
463
|
+
mutation 'self.key?(foo)'
|
436
464
|
mutation 'foo'
|
437
465
|
end
|
438
466
|
|
@@ -444,6 +472,7 @@ Mutant::Meta::Example.add do
|
|
444
472
|
mutation 'foo[]'
|
445
473
|
mutation 'foo.at(*bar)'
|
446
474
|
mutation 'foo.fetch(*bar)'
|
475
|
+
mutation 'foo.key?(*bar)'
|
447
476
|
mutation 'foo[nil]'
|
448
477
|
mutation 'foo[self]'
|
449
478
|
mutation 'foo[bar]'
|
data/mutant-rspec.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.extra_rdoc_files = %w[TODO LICENSE]
|
17
17
|
|
18
18
|
gem.add_runtime_dependency('mutant', "~> #{gem.version}")
|
19
|
-
gem.add_runtime_dependency('rspec-core', '>= 3.
|
19
|
+
gem.add_runtime_dependency('rspec-core', '>= 3.3.0', '< 3.5.0')
|
20
20
|
|
21
21
|
gem.add_development_dependency('bundler', '~> 1.3', '>= 1.3.5')
|
22
22
|
end
|
@@ -2,7 +2,7 @@ RSpec.describe 'rspec integration', mutant: false do
|
|
2
2
|
|
3
3
|
let(:base_cmd) { 'bundle exec mutant -I lib --require test_app --use rspec' }
|
4
4
|
|
5
|
-
%w[3.
|
5
|
+
%w[3.3 3.4].each do |version|
|
6
6
|
context "RSpec #{version}" do
|
7
7
|
let(:gemfile) { "Gemfile.rspec#{version}" }
|
8
8
|
|
data/spec/integrations.yml
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
---
|
2
2
|
- name: rubyspec
|
3
3
|
namespace: Rubyspec
|
4
|
-
repo_uri: 'https://github.com/
|
4
|
+
repo_uri: 'https://github.com/ruby/rubyspec.git'
|
5
5
|
mutation_coverage: false
|
6
6
|
mutation_generation: true
|
7
7
|
expect_coverage: 0 # not run
|
8
8
|
exclude:
|
9
9
|
# Binary encoded source subjected to limitations see README of unparser
|
10
10
|
- core/array/pack/{b,h,u}_spec.rb
|
11
|
-
- language/
|
11
|
+
- language/regexp/escapes_spec.rb
|
12
12
|
- core/array/pack/shared/float.rb
|
13
13
|
- core/array/pack/shared/integer.rb
|
14
14
|
- core/array/pack/{c,m,w}_spec.rb
|
15
|
-
- core/regexp/shared/new.rb
|
16
15
|
- core/regexp/shared/quote.rb
|
17
16
|
- core/encoding/compatible_spec.rb
|
18
17
|
- core/io/readpartial_spec.rb
|
@@ -11,7 +11,7 @@ RSpec.shared_examples_for 'a method matcher' do
|
|
11
11
|
expect(name).to eql(method_name)
|
12
12
|
end
|
13
13
|
|
14
|
-
it 'has
|
14
|
+
it 'has expected line number' do
|
15
15
|
expect(node.location.expression.line).to eql(method_line)
|
16
16
|
end
|
17
17
|
|
@@ -33,13 +33,13 @@ RSpec.shared_examples_for 'a method matcher' do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
RSpec.shared_examples_for 'skipped candidate' do
|
36
|
-
|
37
|
-
|
36
|
+
before do
|
37
|
+
expected_warnings.each do |warning|
|
38
|
+
expect(env).to receive(:warn).with(warning).and_return(env)
|
39
|
+
end
|
38
40
|
end
|
39
41
|
|
40
|
-
it 'does
|
41
|
-
subject
|
42
|
-
|
43
|
-
expect(env.config.reporter.warn_calls).to eql(expected_warnings)
|
42
|
+
it 'does not emit matcher' do
|
43
|
+
expect(subject).to eql([])
|
44
44
|
end
|
45
45
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -33,9 +33,8 @@ $LOAD_PATH << File.join(TestApp.root, 'lib')
|
|
33
33
|
require 'test_app'
|
34
34
|
|
35
35
|
module Fixtures
|
36
|
-
TEST_CONFIG = Mutant::Config::DEFAULT.with(reporter: Mutant::Reporter::
|
37
|
-
|
38
|
-
TEST_ENV = Mutant::Env::Bootstrap.(TEST_CONFIG, TEST_CACHE)
|
36
|
+
TEST_CONFIG = Mutant::Config::DEFAULT.with(reporter: Mutant::Reporter::Null.new)
|
37
|
+
TEST_ENV = Mutant::Env::Bootstrap.(TEST_CONFIG)
|
39
38
|
end # Fixtures
|
40
39
|
|
41
40
|
module ParserHelper
|
@@ -43,12 +42,6 @@ module ParserHelper
|
|
43
42
|
Unparser.unparse(node)
|
44
43
|
end
|
45
44
|
|
46
|
-
def test_env
|
47
|
-
Fixtures::TEST_ENV.with(
|
48
|
-
config: Mutant::Config::DEFAULT.with(reporter: Mutant::Reporter::Trace.new)
|
49
|
-
)
|
50
|
-
end
|
51
|
-
|
52
45
|
def parse(string)
|
53
46
|
Unparser::Preprocessor.run(Parser::CurrentRuby.parse(string))
|
54
47
|
end
|
data/spec/support/corpus.rb
CHANGED
@@ -2,6 +2,7 @@ require 'morpher'
|
|
2
2
|
require 'anima'
|
3
3
|
require 'mutant'
|
4
4
|
|
5
|
+
# @api private
|
5
6
|
module MutantSpec
|
6
7
|
ROOT = Pathname.new(__FILE__).parent.parent.parent
|
7
8
|
|
@@ -9,20 +10,28 @@ module MutantSpec
|
|
9
10
|
#
|
10
11
|
# rubocop:disable MethodLength
|
11
12
|
module Corpus
|
13
|
+
TMP = ROOT.join('tmp').freeze
|
14
|
+
EXCLUDE_GLOB_FORMAT = '{%s}'.freeze
|
15
|
+
RUBY_GLOB_PATTERN = '**/*.rb'.freeze
|
16
|
+
|
17
|
+
# Not in the docs. Number from chatting with their support.
|
18
|
+
# 2 processors allocated per container, 4 processes works well.
|
19
|
+
CIRCLE_CI_CONTAINER_PROCESSES = 4
|
20
|
+
|
21
|
+
private_constant(*constants(false))
|
22
|
+
|
12
23
|
# Project under corpus test
|
13
24
|
# rubocop:disable ClassLength
|
14
|
-
TMP = ROOT.join('tmp').freeze
|
15
|
-
|
16
25
|
class Project
|
17
26
|
MUTEX = Mutex.new
|
18
27
|
include Adamantium, Anima.new(
|
19
|
-
:name,
|
20
|
-
:repo_uri,
|
21
28
|
:exclude,
|
29
|
+
:expect_coverage,
|
22
30
|
:mutation_coverage,
|
23
31
|
:mutation_generation,
|
32
|
+
:name,
|
24
33
|
:namespace,
|
25
|
-
:
|
34
|
+
:repo_uri
|
26
35
|
)
|
27
36
|
|
28
37
|
# Verify mutation coverage
|
@@ -31,8 +40,6 @@ module MutantSpec
|
|
31
40
|
# if successful
|
32
41
|
#
|
33
42
|
# @raise [Exception]
|
34
|
-
#
|
35
|
-
# @api private
|
36
43
|
def verify_mutation_coverage
|
37
44
|
checkout
|
38
45
|
Dir.chdir(repo_path) do
|
@@ -59,20 +66,16 @@ module MutantSpec
|
|
59
66
|
#
|
60
67
|
# @raise [Exception]
|
61
68
|
# otherwise
|
62
|
-
#
|
63
|
-
# rubocop:disable AbcSize
|
64
|
-
#
|
65
|
-
# @api private
|
66
69
|
def verify_mutation_generation
|
67
70
|
checkout
|
68
71
|
start = Time.now
|
69
|
-
|
72
|
+
|
70
73
|
options = {
|
71
74
|
finish: method(:finish),
|
72
75
|
start: method(:start),
|
73
76
|
in_processes: parallel_processes
|
74
77
|
}
|
75
|
-
total = Parallel.map(
|
78
|
+
total = Parallel.map(effective_ruby_paths, options) do |path|
|
76
79
|
count = 0
|
77
80
|
node =
|
78
81
|
begin
|
@@ -100,8 +103,6 @@ module MutantSpec
|
|
100
103
|
# Checkout repository
|
101
104
|
#
|
102
105
|
# @return [self]
|
103
|
-
#
|
104
|
-
# @api private
|
105
106
|
def checkout
|
106
107
|
return self if noinstall?
|
107
108
|
TMP.mkdir unless TMP.directory?
|
@@ -126,8 +127,6 @@ module MutantSpec
|
|
126
127
|
# Install mutant
|
127
128
|
#
|
128
129
|
# @return [undefined]
|
129
|
-
#
|
130
|
-
# @api private
|
131
130
|
def install_mutant
|
132
131
|
return if noinstall?
|
133
132
|
relative = ROOT.relative_path_from(repo_path)
|
@@ -138,20 +137,34 @@ module MutantSpec
|
|
138
137
|
end
|
139
138
|
lockfile = repo_path.join('Gemfile.lock')
|
140
139
|
lockfile.delete if lockfile.exist?
|
141
|
-
system(
|
140
|
+
system(%w[bundle])
|
142
141
|
end
|
143
142
|
|
144
|
-
#
|
145
|
-
|
143
|
+
# The effective ruby file paths
|
144
|
+
#
|
145
|
+
# @return [Array<Pathname>]
|
146
|
+
def effective_ruby_paths
|
147
|
+
paths = Pathname
|
148
|
+
.glob(repo_path.join(RUBY_GLOB_PATTERN))
|
149
|
+
.sort_by(&:size)
|
150
|
+
.reverse
|
151
|
+
|
152
|
+
paths - excluded_paths
|
153
|
+
end
|
154
|
+
|
155
|
+
# The excluded file paths
|
156
|
+
#
|
157
|
+
# @return [Array<Pathname>]
|
158
|
+
def excluded_paths
|
159
|
+
Pathname.glob(repo_path.join(EXCLUDE_GLOB_FORMAT % exclude.join(',')))
|
160
|
+
end
|
146
161
|
|
147
162
|
# Number of parallel processes to use
|
148
163
|
#
|
149
164
|
# @return [Fixnum]
|
150
|
-
#
|
151
|
-
# @api private
|
152
165
|
def parallel_processes
|
153
|
-
if ENV
|
154
|
-
|
166
|
+
if ENV.key?('CI')
|
167
|
+
CIRCLE_CI_CONTAINER_PROCESSES
|
155
168
|
else
|
156
169
|
Parallel.processor_count
|
157
170
|
end
|
@@ -160,8 +173,6 @@ module MutantSpec
|
|
160
173
|
# Repository path
|
161
174
|
#
|
162
175
|
# @return [Pathname]
|
163
|
-
#
|
164
|
-
# @api private
|
165
176
|
def repo_path
|
166
177
|
TMP.join(name)
|
167
178
|
end
|
@@ -169,8 +180,6 @@ module MutantSpec
|
|
169
180
|
# Test if installation should be skipped
|
170
181
|
#
|
171
182
|
# @return [Boolean]
|
172
|
-
#
|
173
|
-
# @api private
|
174
183
|
def noinstall?
|
175
184
|
ENV.key?('NOINSTALL')
|
176
185
|
end
|
@@ -205,8 +214,6 @@ module MutantSpec
|
|
205
214
|
# Helper method to execute system commands
|
206
215
|
#
|
207
216
|
# @param [Array<String>] arguments
|
208
|
-
#
|
209
|
-
# @api private
|
210
217
|
def system(arguments)
|
211
218
|
return if Kernel.system(*arguments)
|
212
219
|
if block_given?
|
data/spec/support/rb_bug.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'ffi'
|
2
2
|
|
3
|
+
# @api private
|
3
4
|
module RbBug
|
4
5
|
extend FFI::Library
|
5
6
|
ffi_lib 'ruby'
|
@@ -8,8 +9,6 @@ module RbBug
|
|
8
9
|
# Call the test bug
|
9
10
|
#
|
10
11
|
# @return [undefined]
|
11
|
-
#
|
12
|
-
# @api private
|
13
12
|
def self.call
|
14
13
|
rb_bug('%s', :string, 'test bug')
|
15
14
|
end
|
data/spec/support/ruby_vm.rb
CHANGED
@@ -12,7 +12,10 @@ module MutantSpec
|
|
12
12
|
|
13
13
|
# An event being expected, can advance the VM
|
14
14
|
class EventExpectation
|
15
|
-
include AbstractType, Anima.new(
|
15
|
+
include AbstractType, Anima.new(
|
16
|
+
:expected_payload,
|
17
|
+
:trigger_requires
|
18
|
+
)
|
16
19
|
|
17
20
|
DEFAULTS = IceNine.deep_freeze(trigger_requires: [])
|
18
21
|
|
@@ -56,8 +59,8 @@ module MutantSpec
|
|
56
59
|
handle_event(
|
57
60
|
EventObservation.new(
|
58
61
|
EventExpectation::Eval,
|
59
|
-
binding:
|
60
|
-
source:
|
62
|
+
binding: binding,
|
63
|
+
source: source,
|
61
64
|
source_location: location
|
62
65
|
)
|
63
66
|
)
|
@@ -25,22 +25,22 @@ module SharedContext
|
|
25
25
|
# rubocop:disable MethodLength
|
26
26
|
# rubocop:disable AbcSize
|
27
27
|
def setup_shared_context
|
28
|
-
let(:env) {
|
29
|
-
let(:job_a) { Mutant::Parallel::Job.new(index: 0, payload: mutation_a)
|
30
|
-
let(:job_b) { Mutant::Parallel::Job.new(index: 1, payload: mutation_b)
|
31
|
-
let(:job_a_result) { Mutant::Runner::JobResult.new(job: job_a, result: mutation_a_result)
|
32
|
-
let(:job_b_result) { Mutant::Runner::JobResult.new(job: job_b, result: mutation_b_result)
|
33
|
-
let(:test_a) {
|
34
|
-
let(:test_b) {
|
35
|
-
let(:output) { StringIO.new
|
36
|
-
let(:matchable_scopes) {
|
37
|
-
let(:message_sequence) { FakeActor::MessageSequence.new
|
38
|
-
let(:mutations) { [mutation_a, mutation_b]
|
39
|
-
let(:mutation_a_node) { s(:false)
|
40
|
-
let(:mutation_b_node) { s(:nil)
|
41
|
-
let(:mutation_b) { Mutant::Mutation::Evil.new(subject_a, mutation_b_node)
|
42
|
-
let(:mutation_a) { Mutant::Mutation::Evil.new(subject_a, mutation_a_node)
|
43
|
-
let(:subject_a_node) { s(:true)
|
28
|
+
let(:env) { instance_double(Mutant::Env, config: config, subjects: [subject_a], mutations: mutations) }
|
29
|
+
let(:job_a) { Mutant::Parallel::Job.new(index: 0, payload: mutation_a) }
|
30
|
+
let(:job_b) { Mutant::Parallel::Job.new(index: 1, payload: mutation_b) }
|
31
|
+
let(:job_a_result) { Mutant::Runner::JobResult.new(job: job_a, result: mutation_a_result) }
|
32
|
+
let(:job_b_result) { Mutant::Runner::JobResult.new(job: job_b, result: mutation_b_result) }
|
33
|
+
let(:test_a) { instance_double(Mutant::Test, identification: 'test-a') }
|
34
|
+
let(:test_b) { instance_double(Mutant::Test, identification: 'test-b') }
|
35
|
+
let(:output) { StringIO.new }
|
36
|
+
let(:matchable_scopes) { instance_double(Array, length: 10) }
|
37
|
+
let(:message_sequence) { FakeActor::MessageSequence.new }
|
38
|
+
let(:mutations) { [mutation_a, mutation_b] }
|
39
|
+
let(:mutation_a_node) { s(:false) }
|
40
|
+
let(:mutation_b_node) { s(:nil) }
|
41
|
+
let(:mutation_b) { Mutant::Mutation::Evil.new(subject_a, mutation_b_node) }
|
42
|
+
let(:mutation_a) { Mutant::Mutation::Evil.new(subject_a, mutation_a_node) }
|
43
|
+
let(:subject_a_node) { s(:true) }
|
44
44
|
|
45
45
|
let(:status) do
|
46
46
|
Mutant::Parallel::Status.new(
|
@@ -53,16 +53,15 @@ module SharedContext
|
|
53
53
|
let(:config) do
|
54
54
|
Mutant::Config::DEFAULT.with(
|
55
55
|
jobs: 1,
|
56
|
-
reporter: Mutant::Reporter::
|
56
|
+
reporter: Mutant::Reporter::Null.new
|
57
57
|
)
|
58
58
|
end
|
59
59
|
|
60
60
|
let(:subject_a) do
|
61
|
-
|
62
|
-
|
61
|
+
instance_double(
|
62
|
+
Mutant::Subject,
|
63
63
|
node: subject_a_node,
|
64
64
|
source: Unparser.unparse(subject_a_node),
|
65
|
-
tests: [test_a],
|
66
65
|
identification: 'subject-a'
|
67
66
|
)
|
68
67
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
RSpec.describe Mutant::Actor::Binding do
|
2
|
-
let(:actor_a) {
|
3
|
-
let(:sender_a) {
|
4
|
-
let(:sender_b) {
|
5
|
-
let(:receiver_a) {
|
6
|
-
let(:payload) {
|
7
|
-
let(:type) {
|
2
|
+
let(:actor_a) { instance_double(Mutant::Actor::Mailbox, sender: sender_a, receiver: receiver_a) }
|
3
|
+
let(:sender_a) { instance_double(Mutant::Actor::Sender) }
|
4
|
+
let(:sender_b) { instance_double(Mutant::Actor::Sender) }
|
5
|
+
let(:receiver_a) { instance_double(Mutant::Actor::Receiver) }
|
6
|
+
let(:payload) { instance_double(Object) }
|
7
|
+
let(:type) { instance_double(Symbol) }
|
8
8
|
|
9
9
|
let(:object) { described_class.new(actor_a, sender_b) }
|
10
10
|
|