mutant 0.9.7 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9191d87ebe0bde331ae432c838ec2718f41f89d099952598e98fe6d2ee3b9885
4
- data.tar.gz: 713134773a289c22d6b43b678c44b483f383aeb2520fd0f95711c47489ad64f0
3
+ metadata.gz: 5ac360cb601cc521059ca91167f18898ca897a7c475244e122c2fa46c80213b6
4
+ data.tar.gz: 557f073ba78b87381f7a424b198df8a6450e16b2f4bf3b3863ba370aa4fe7207
5
5
  SHA512:
6
- metadata.gz: 00b83021df08f58b84688d6dad27792e0d5aab81288bf5f7afca9a43b2ebdf05fe09133c18dc19e8169727c20e4815caaafabfab9bbc9c7258100b9201ba967a
7
- data.tar.gz: 79659afba997fc24650398f33bc0de60905845429b01a49d999c24e2004f97b0c0ac3bee987e1cbf73010c213906e79a0e8fb856b5de826049cfc169f8154f24
6
+ metadata.gz: d8375c95cab6deab2f6b460892e40c3922dc5adf2b2dc188f9a3ac459dfe5c5a453da543b4fb8f95e7596019989aca80cf01c66d49a3796ef678b3f48c30b136
7
+ data.tar.gz: 4dc79e273ef83112e0e4b2d4e6c74dd8f0bc0366537cb7efc5f71fbdd0a22a93ab29e8c7726c1a78224fc020a92b202eed2ab1ef9a534fd008f5a621779a7aa8
@@ -0,0 +1,121 @@
1
+ name: CI
2
+
3
+ on: push
4
+
5
+ jobs:
6
+ base:
7
+ name: Base steps
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v2
11
+ - name: Check Whitespace
12
+ run: git diff --check -- HEAD~1
13
+ ruby-spec:
14
+ name: Unit Specs
15
+ runs-on: ${{ matrix.os }}
16
+ timeout-minutes: 5
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ ruby: ['2.6', '2.7']
21
+ os: [ubuntu-latest]
22
+ steps:
23
+ - uses: actions/checkout@v2
24
+ - uses: actions/setup-ruby@v1
25
+ with:
26
+ ruby-version: ${{ matrix.ruby }}
27
+ - run: |
28
+ gem install bundler
29
+ bundle install
30
+ - run: bundle exec rspec spec/unit
31
+ ruby-mutant:
32
+ name: Mutation coverage
33
+ runs-on: ${{ matrix.os }}
34
+ timeout-minutes: 5
35
+ strategy:
36
+ fail-fast: false
37
+ matrix:
38
+ ruby: ['2.6', '2.7']
39
+ os: [ubuntu-latest]
40
+ steps:
41
+ - uses: actions/checkout@v2
42
+ with:
43
+ fetch-depth: 0
44
+ - uses: actions/setup-ruby@v1
45
+ with:
46
+ ruby-version: ${{ matrix.ruby }}
47
+ - run: |
48
+ gem install bundler
49
+ bundle install
50
+ - run: bundle exec mutant --since HEAD~1 --zombie -- 'Mutant*'
51
+ ruby-integration-minitest:
52
+ name: Integration Minitest
53
+ runs-on: ${{ matrix.os }}
54
+ timeout-minutes: 5
55
+ strategy:
56
+ fail-fast: false
57
+ matrix:
58
+ ruby: ['2.6', '2.7']
59
+ os: [ubuntu-latest]
60
+ steps:
61
+ - uses: actions/checkout@v2
62
+ - uses: actions/setup-ruby@v1
63
+ with:
64
+ ruby-version: ${{ matrix.ruby }}
65
+ - run: gem list
66
+ - run: |
67
+ gem install bundler
68
+ bundle install
69
+ - run: bundle exec rspec spec/integration -e minitest
70
+ ruby-integration-rspec:
71
+ name: Integration RSpec
72
+ runs-on: ${{ matrix.os }}
73
+ timeout-minutes: 10
74
+ strategy:
75
+ fail-fast: false
76
+ matrix:
77
+ ruby: ['2.6', '2.7']
78
+ os: [ubuntu-latest]
79
+ steps:
80
+ - uses: actions/checkout@v2
81
+ - uses: actions/setup-ruby@v1
82
+ with:
83
+ ruby-version: ${{ matrix.ruby }}
84
+ - run: |
85
+ gem install bundler
86
+ bundle install
87
+ - run: bundle exec rspec spec/integration -e rspec
88
+ ruby-integration-generation:
89
+ name: Integration Mutation Generation
90
+ runs-on: ${{ matrix.os }}
91
+ timeout-minutes: 5
92
+ strategy:
93
+ fail-fast: false
94
+ matrix:
95
+ ruby: ['2.6', '2.7']
96
+ os: [ubuntu-latest]
97
+ steps:
98
+ - uses: actions/checkout@v2
99
+ - uses: actions/setup-ruby@v1
100
+ with:
101
+ ruby-version: ${{ matrix.ruby }}
102
+ - run: |
103
+ gem install bundler
104
+ bundle install
105
+ - run: bundle exec rspec spec/integration -e generation
106
+ ruby-rubocop:
107
+ name: Rubocop
108
+ runs-on: ${{ matrix.os }}
109
+ timeout-minutes: 5
110
+ strategy:
111
+ fail-fast: false
112
+ matrix:
113
+ ruby: ['2.7']
114
+ os: [ubuntu-latest]
115
+ steps:
116
+ - uses: actions/checkout@v2
117
+ - uses: actions/setup-ruby@v1
118
+ with:
119
+ ruby-version: ${{ matrix.ruby }}
120
+ - run: bundle install
121
+ - run: bundle exec rake metrics:rubocop
@@ -1,3 +1,7 @@
1
+ # v0.9.8 2020-08-02
2
+
3
+ * Change to generic catch all node mutator. This allows better cross parser version compatibility.
4
+
1
5
  # v0.9.7 2020-07-22
2
6
 
3
7
  * Bump parser dependency to 2.7.1, note this still does not support Ruby 2.7 syntax.
data/Gemfile CHANGED
@@ -5,10 +5,3 @@ source 'https://rubygems.org'
5
5
  gemspec name: 'mutant'
6
6
 
7
7
  eval_gemfile File.expand_path('Gemfile.shared', __dir__)
8
-
9
- # Mutant itself uses an opensource license key.
10
- # Scoped to https://github.com/mbj/mutant it'll
11
- # not be useful elsewhere.
12
- source 'https://oss:Px2ENN7S91OmWaD5G7MIQJi1dmtmYrEh@gem.mutant.dev' do
13
- gem 'mutant-license'
14
- end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mutant (0.9.6)
4
+ mutant (0.9.8)
5
5
  abstract_type (~> 0.0.7)
6
6
  adamantium (~> 0.2.0)
7
7
  anima (~> 0.3.1)
@@ -164,4 +164,4 @@ DEPENDENCIES
164
164
  parallel (~> 1.3)
165
165
 
166
166
  BUNDLED WITH
167
- 1.17.3
167
+ 2.1.2
@@ -1,3 +1,10 @@
1
+ # Mutant itself uses an opensource license key.
2
+ # Scoped to https://github.com/mbj/mutant it'll
3
+ # not be useful elsewhere.
4
+ source 'https://oss:Px2ENN7S91OmWaD5G7MIQJi1dmtmYrEh@gem.mutant.dev' do
5
+ gem 'mutant-license'
6
+ end
7
+
1
8
  # Place for shared git sources, used for developing updates to depedencies
2
9
  # where the git sources (without this file) need to be consistently edited
3
10
  # into multiple Gemfiles.
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  mutant
2
2
  ======
3
3
 
4
- [![Build Status](https://circleci.com/gh/mbj/mutant.svg?style=shield&circle-token=1afd77e8f0f9d0a11fd8f15f5d7b10270f4665e2)](https://circleci.com/gh/mbj/mutant/tree/master)
4
+ ![Build Status](https://github.com/mbj/mutant/workflows/CI/badge.svg)
5
5
  [![Gem Version](https://img.shields.io/gem/v/mutant.svg)](https://rubygems.org/gems/mutant)
6
6
  [![Slack Status](https://mutation-testing-slack.herokuapp.com/badge.svg)](https://mutation-testing.slack.com/messages/mutant)
7
7
 
@@ -3,80 +3,9 @@
3
3
  module Mutant
4
4
  class Mutator
5
5
  class Node
6
-
7
6
  # Generic mutator
8
7
  class Generic < self
9
8
 
10
- unsupported_nodes = %i[
11
- __FILE__
12
- __LINE__
13
- alias
14
- arg_expr
15
- array_pattern
16
- array_pattern_with_tail
17
- back_ref
18
- blockarg
19
- blockarg_expr
20
- case_match
21
- complex
22
- const_pattern
23
- def_e
24
- defs_e
25
- eflipflop
26
- empty
27
- empty_else
28
- ensure
29
- find_pattern
30
- for
31
- forward_arg
32
- forward_args
33
- forwarded_args
34
- hash_pattern
35
- ident
36
- if_guard
37
- iflipflop
38
- in_match
39
- in_pattern
40
- kwnilarg
41
- kwrestarg
42
- kwsplat
43
- match_alt
44
- match_as
45
- match_nil_pattern
46
- match_rest
47
- match_var
48
- match_with_lvasgn
49
- match_with_trailing_comma
50
- module
51
- mrasgn
52
- numargs
53
- numblock
54
- objc_kwarg
55
- objc_restarg
56
- objc_varargs
57
- pin
58
- postexe
59
- preexe
60
- rasgn
61
- rational
62
- redo
63
- restarg
64
- restarg_expr
65
- retry
66
- root
67
- sclass
68
- shadowarg
69
- undef
70
- unless_guard
71
- until_post
72
- while_post
73
- xstr
74
- ]
75
-
76
- # These nodes still need a dedicated mutator,
77
- # your contribution is that close!
78
- handle(*unsupported_nodes)
79
-
80
9
  private
81
10
 
82
11
  # Emit mutations
@@ -32,14 +32,9 @@ module Mutant
32
32
  #
33
33
  # @param [Symbol] type
34
34
  #
35
- # @return [Class]
36
- #
37
- # @raise [ArgumentError]
38
- # raises argument error when class cannot be found
35
+ # @return [Class<Mutator>]
39
36
  def lookup(type)
40
- contents.fetch(type) do
41
- fail RegistryError, "No entry for: #{type.inspect}"
42
- end
37
+ contents.fetch(type, Mutator::Node::Generic)
43
38
  end
44
39
 
45
40
  end # Registry
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Mutant
4
4
  # Current mutant version
5
- VERSION = '0.9.7'
5
+ VERSION = '0.9.8'
6
6
  end # Mutant
@@ -1,47 +1,74 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe Mutant::Registry do
4
- let(:lookup) { object.lookup(type) }
5
- let(:object) { described_class.new }
6
4
  let(:mutator) { class_double(Mutant::Mutator) }
5
+ let(:object) { described_class.new }
7
6
 
8
- def register_mutator
9
- object.register(type, mutator)
10
- end
11
-
12
- context 'on registered type' do
13
- subject { register_mutator }
7
+ describe '#lookup' do
8
+ subject { object.lookup(type) }
14
9
 
15
- let(:type) { :true }
10
+ def register
11
+ object.register(type, mutator)
12
+ end
16
13
 
17
- before { subject }
14
+ context 'on known type' do
15
+ let(:type) { :true }
18
16
 
19
- it 'returns registered mutator' do
20
- expect(lookup).to be(mutator)
17
+ it 'returns registered' do
18
+ register
19
+ expect(subject).to be(mutator)
20
+ end
21
21
  end
22
22
 
23
- it_behaves_like 'a command method'
23
+ context 'on unknown type' do
24
+ let(:type) { :unknown }
24
25
 
25
- context 'when registered twice' do
26
- it 'fails upon registration' do
27
- expect { register_mutator }.to raise_error(described_class::RegistryError, 'Duplicate type registration: :true')
26
+ it 'returns genericm mutator' do
27
+ expect(subject).to be(Mutant::Mutator::Node::Generic)
28
28
  end
29
29
  end
30
30
  end
31
31
 
32
- context 'on unknown type' do
33
- let(:type) { :unknown }
32
+ describe '#register' do
33
+ subject { object.register(type, mutator) }
34
34
 
35
- it 'raises error' do
36
- expect { lookup }.to raise_error(described_class::RegistryError, 'No entry for: :unknown')
35
+ def lookup
36
+ subject.lookup(type)
37
37
  end
38
- end
39
38
 
40
- context 'when registering an invalid node type' do
41
- let(:type) { :invalid }
39
+ context 'on registered type' do
40
+ let(:type) { :true }
41
+
42
+ it_behaves_like 'a command method'
42
43
 
43
- it 'raises error' do
44
- expect { register_mutator }.to raise_error(described_class::RegistryError, 'Invalid type registration: :invalid')
44
+ it 'allows to lookup the mutator' do
45
+ subject
46
+ expect(lookup).to be(mutator)
47
+ end
48
+
49
+ context 'when registering twice' do
50
+ it 'fails upon registration' do
51
+ object.register(type, mutator)
52
+
53
+ expect { subject }
54
+ .to raise_error(
55
+ described_class::RegistryError,
56
+ 'Duplicate type registration: :true'
57
+ )
58
+ end
59
+ end
60
+ end
61
+
62
+ context 'when registering an invalid node type' do
63
+ let(:type) { :invalid }
64
+
65
+ it 'raises error' do
66
+ expect { subject }
67
+ .to raise_error(
68
+ described_class::RegistryError,
69
+ 'Invalid type registration: :invalid'
70
+ )
71
+ end
45
72
  end
46
73
  end
47
74
  end
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.9.7
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-22 00:00:00.000000000 Z
11
+ date: 2020-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: abstract_type
@@ -243,7 +243,7 @@ extensions: []
243
243
  extra_rdoc_files:
244
244
  - LICENSE
245
245
  files:
246
- - ".circleci/config.yml"
246
+ - ".github/workflows/ci.yml"
247
247
  - ".gitignore"
248
248
  - ".rspec"
249
249
  - ".rubocop.yml"
@@ -637,7 +637,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
637
637
  - !ruby/object:Gem::Version
638
638
  version: '0'
639
639
  requirements: []
640
- rubygems_version: 3.0.3
640
+ rubygems_version: 3.1.2
641
641
  signing_key:
642
642
  specification_version: 4
643
643
  summary: ''
@@ -1,53 +0,0 @@
1
- defaults: &defaults
2
- working_directory: ~/mutant
3
- docker:
4
- - image: circleci/ruby:2.6.0
5
- version: 2
6
- jobs:
7
- unit_specs:
8
- <<: *defaults
9
- steps:
10
- - checkout
11
- - run: bundle install
12
- - run: bundle exec rspec spec/unit spec/integration/mutant/test_mutator_handles_types_spec.rb
13
- integration_minitest:
14
- <<: *defaults
15
- steps:
16
- - checkout
17
- - run: bundle install
18
- - run: bundle exec rspec spec/integration -e minitest
19
- integration_rspec:
20
- <<: *defaults
21
- steps:
22
- - checkout
23
- - run: bundle install
24
- - run: bundle exec rspec spec/integration -e rspec
25
- integration_mutation_generation:
26
- <<: *defaults
27
- steps:
28
- - checkout
29
- - run: bundle install
30
- - run: bundle exec rspec spec/integration -e generation
31
- metrics:
32
- <<: *defaults
33
- steps:
34
- - checkout
35
- - run: bundle install
36
- - run: bundle exec rake metrics:rubocop
37
- - run: bundle exec rake metrics:reek
38
- mutant:
39
- <<: *defaults
40
- steps:
41
- - checkout
42
- - run: bundle install
43
- - run: bundle exec mutant --jobs 4 --since HEAD~1 --zombie -- 'Mutant*'
44
- workflows:
45
- version: 2
46
- test:
47
- jobs:
48
- - unit_specs
49
- - integration_rspec
50
- - integration_minitest
51
- - integration_mutation_generation
52
- - metrics
53
- - mutant