mutant 0.3.0.beta18 → 0.3.0.beta19
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/Gemfile.devtools +10 -13
- data/README.md +2 -2
- data/config/rubocop.yml +4 -1
- data/lib/mutant.rb +4 -1
- data/lib/mutant/cli/classifier.rb +3 -2
- data/lib/mutant/killer/rspec.rb +1 -6
- data/lib/mutant/mutator/node/generic.rb +2 -1
- data/lib/mutant/mutator/node/literal/regex.rb +0 -2
- data/lib/mutant/mutator/node/lvar.rb +25 -0
- data/lib/mutant/mutator/node/masgn.rb +1 -1
- data/mutant.gemspec +1 -1
- data/spec/unit/mutant/mutator/node/lvar/mutation_spec.rb +21 -0
- data/spec/unit/mutant/mutator/node/masgn/mutation_spec.rb +0 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd13dcc39d401fa798781aa0bf540654ccda03d3
|
4
|
+
data.tar.gz: 32b01710b1a1214b94996389fbd95cb2e06eca15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08e171e88fd7fd7dbae3130694c983ca35db23f9b8018f395e0bb1ba8c6f5e43876e9fe510d54b0d405f4d651f2129688baf40ad4002a2bf72f417dbbda84d13
|
7
|
+
data.tar.gz: e483bea1d72eeb4c5010589fe68cb73e05b5da52c8735d1b4fb76c118728d424a7d18100754ea5667d802c1122d666b7884b9b72a389031c478e28a16b291568
|
data/Gemfile.devtools
CHANGED
@@ -14,26 +14,27 @@ group :guard do
|
|
14
14
|
gem 'guard', '~> 1.8.1'
|
15
15
|
gem 'guard-bundler', '~> 1.0.0'
|
16
16
|
gem 'guard-rspec', '~> 3.0.2'
|
17
|
-
|
17
|
+
gem 'guard-rubocop', '~> 0.2.0'
|
18
|
+
gem 'guard-mutant', '~> 0.0.1'
|
18
19
|
|
19
20
|
# file system change event handling
|
20
21
|
gem 'listen', '~> 1.2.2'
|
21
|
-
gem 'rb-fchange', '~> 0.0.6', :
|
22
|
-
gem 'rb-fsevent', '~> 0.9.3', :
|
23
|
-
gem 'rb-inotify', '~> 0.9.0', :
|
22
|
+
gem 'rb-fchange', '~> 0.0.6', require: false
|
23
|
+
gem 'rb-fsevent', '~> 0.9.3', require: false
|
24
|
+
gem 'rb-inotify', '~> 0.9.0', require: false
|
24
25
|
|
25
26
|
# notification handling
|
26
|
-
gem 'libnotify', '~> 0.8.0', :
|
27
|
-
gem 'rb-notifu', '~> 0.0.4', :
|
28
|
-
gem 'terminal-notifier-guard', '~> 1.5.3', :
|
27
|
+
gem 'libnotify', '~> 0.8.0', require: false
|
28
|
+
gem 'rb-notifu', '~> 0.0.4', require: false
|
29
|
+
gem 'terminal-notifier-guard', '~> 1.5.3', require: false
|
29
30
|
end
|
30
31
|
|
31
32
|
group :metrics do
|
32
33
|
gem 'coveralls', '~> 0.6.7'
|
33
34
|
gem 'flay', '~> 2.3.1'
|
34
35
|
gem 'flog', '~> 4.1.1'
|
35
|
-
gem 'reek', '~> 1.3.1',
|
36
|
-
|
36
|
+
gem 'reek', '~> 1.3.1', git: 'https://github.com/troessner/reek.git'
|
37
|
+
gem 'rubocop', '~> 0.10.0', git: 'https://github.com/bbatsov/rubocop.git'
|
37
38
|
gem 'simplecov', '~> 0.7.1'
|
38
39
|
gem 'yardstick', '~> 0.9.6'
|
39
40
|
|
@@ -41,10 +42,6 @@ group :metrics do
|
|
41
42
|
gem 'yard-spellcheck', '~> 0.1.5'
|
42
43
|
end
|
43
44
|
|
44
|
-
platforms :ruby_19 do
|
45
|
-
gem 'json', '~> 1.8.0'
|
46
|
-
end
|
47
|
-
|
48
45
|
platforms :rbx do
|
49
46
|
gem 'pelusa', '~> 0.2.2'
|
50
47
|
end
|
data/README.md
CHANGED
@@ -56,7 +56,7 @@ Mutations
|
|
56
56
|
Mutant supports a very wide range of mutation operators. Listing them all in detail would blow this document up.
|
57
57
|
|
58
58
|
It is planned to parse a list of mutation operators from the source. In the meantime please refer to the
|
59
|
-
[code](https://github.com/mbj/mutant/tree/master/lib/mutant/mutator/node) each subclass of `Mutant::Mutator::Node`
|
59
|
+
[code](https://github.com/mbj/mutant/tree/master/lib/mutant/mutator/node) each subclass of `Mutant::Mutator::Node`
|
60
60
|
emits around 3-6 mutations.
|
61
61
|
|
62
62
|
Currently mutant covers the majority of ruby's complex nodes that often occur in method bodies.
|
@@ -75,7 +75,7 @@ Alive: 57 # Amount of alive mutations.
|
|
75
75
|
```
|
76
76
|
|
77
77
|
|
78
|
-
Nodes still missing a dedicated mutator are handled via the
|
78
|
+
Nodes still missing a dedicated mutator are handled via the
|
79
79
|
[Generic](https://github.com/mbj/mutant/blob/master/lib/mutant/mutator/node/generic.rb) mutator.
|
80
80
|
The goal is to remove this mutator and have dedicated mutator for every type of node and removing
|
81
81
|
the Generic handler altogether.
|
data/config/rubocop.yml
CHANGED
data/lib/mutant.rb
CHANGED
@@ -20,7 +20,9 @@ require 'concord'
|
|
20
20
|
|
21
21
|
# Library namespace
|
22
22
|
module Mutant
|
23
|
-
|
23
|
+
# The empty string used within this namespace
|
24
|
+
EMPTY_STRING = ''.freeze
|
25
|
+
end # Mutant
|
24
26
|
|
25
27
|
require 'mutant/cache'
|
26
28
|
require 'mutant/node_helpers'
|
@@ -56,6 +58,7 @@ require 'mutant/mutator/node/assignment'
|
|
56
58
|
require 'mutant/mutator/node/argument'
|
57
59
|
require 'mutant/mutator/node/arguments'
|
58
60
|
require 'mutant/mutator/node/begin'
|
61
|
+
require 'mutant/mutator/node/lvar'
|
59
62
|
require 'mutant/mutator/node/while'
|
60
63
|
require 'mutant/mutator/node/super'
|
61
64
|
require 'mutant/mutator/node/send'
|
@@ -10,7 +10,8 @@ module Mutant
|
|
10
10
|
OPERATOR_PATTERN = Regexp.union(*OPERATOR_METHODS.map(&:to_s)).freeze
|
11
11
|
METHOD_NAME_PATTERN = /([_A-Za-z][A-Za-z0-9_]*[!?=]?|#{OPERATOR_PATTERN})/.freeze
|
12
12
|
SCOPE_PATTERN = /(?:::)?#{SCOPE_NAME_PATTERN}(?:::#{SCOPE_NAME_PATTERN})*/.freeze
|
13
|
-
|
13
|
+
CBASE_PATTERN = /\A::/.freeze
|
14
|
+
SCOPE_OPERATOR = '::'.freeze
|
14
15
|
SINGLETON_PATTERN = %r(\A(#{SCOPE_PATTERN})\z).freeze
|
15
16
|
|
16
17
|
REGISTRY = []
|
@@ -35,7 +36,7 @@ module Mutant
|
|
35
36
|
# @api private
|
36
37
|
#
|
37
38
|
def self.constant_lookup(location)
|
38
|
-
location.gsub(
|
39
|
+
location.gsub(CBASE_PATTERN, EMPTY_STRING).split(SCOPE_OPERATOR).inject(Object) do |parent, name|
|
39
40
|
parent.const_get(name)
|
40
41
|
end
|
41
42
|
end
|
data/lib/mutant/killer/rspec.rb
CHANGED
@@ -20,12 +20,7 @@ module Mutant
|
|
20
20
|
# TODO: replace with real streams from configuration
|
21
21
|
require 'stringio'
|
22
22
|
null = StringIO.new
|
23
|
-
|
24
|
-
begin
|
25
|
-
!::RSpec::Core::Runner.run(argv, null, null).zero?
|
26
|
-
rescue StandardError
|
27
|
-
true
|
28
|
-
end
|
23
|
+
!::RSpec::Core::Runner.run(command_line_arguments, null, null).zero?
|
29
24
|
end
|
30
25
|
|
31
26
|
# Return command line arguments
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Mutant
|
2
2
|
class Mutator
|
3
3
|
class Node
|
4
|
+
|
4
5
|
# Generic mutator
|
5
6
|
class Generic < self
|
6
7
|
|
@@ -12,7 +13,7 @@ module Mutant
|
|
12
13
|
:zsuper, :not, :or, :and, :defined,
|
13
14
|
:next, :break, :match, :gvar, :cvar, :ensure,
|
14
15
|
:dstr, :dsym, :yield, :rescue, :redo, :defined?,
|
15
|
-
:
|
16
|
+
:const, :blockarg, :block_pass, :op_asgn, :and_asgn,
|
16
17
|
:regopt, :ivar, :restarg, :casgn, :resbody, :retry, :arg_expr,
|
17
18
|
:kwrestarg, :kwoptarg, :kwarg, :undef, :module, :cbase, :empty,
|
18
19
|
:alias, :for, :xstr, :back_ref, :nth_ref, :class,
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Mutant
|
2
|
+
class Mutator
|
3
|
+
class Node
|
4
|
+
|
5
|
+
# Mutation emitter to handle local variable nodes
|
6
|
+
class LocalVariable < self
|
7
|
+
|
8
|
+
handle(:lvar)
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
# Emit mutations
|
13
|
+
#
|
14
|
+
# @return [undefined]
|
15
|
+
#
|
16
|
+
# @api private
|
17
|
+
#
|
18
|
+
def dispatch
|
19
|
+
emit_nil
|
20
|
+
end
|
21
|
+
|
22
|
+
end # LocalVariable
|
23
|
+
end # Node
|
24
|
+
end # Mutator
|
25
|
+
end # Mutant
|
data/mutant.gemspec
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Mutant::Mutator, 'lvar' do
|
4
|
+
|
5
|
+
before do
|
6
|
+
Mutant::Random.stub(:hex_string => 'random')
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:source) { 'a = nil; a' }
|
10
|
+
|
11
|
+
let(:mutations) do
|
12
|
+
mutants = []
|
13
|
+
mutants << 'a = nil; nil'
|
14
|
+
mutants << 'a = nil'
|
15
|
+
mutants << 'a'
|
16
|
+
mutants << 'a = ::Object.new; a'
|
17
|
+
mutants << 'srandom = nil; a'
|
18
|
+
end
|
19
|
+
|
20
|
+
it_should_behave_like 'a mutator'
|
21
|
+
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.3.0.
|
4
|
+
version: 0.3.0.beta19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -240,6 +240,7 @@ files:
|
|
240
240
|
- lib/mutant/mutator/node/literal/regex.rb
|
241
241
|
- lib/mutant/mutator/node/literal/string.rb
|
242
242
|
- lib/mutant/mutator/node/literal/symbol.rb
|
243
|
+
- lib/mutant/mutator/node/lvar.rb
|
243
244
|
- lib/mutant/mutator/node/masgn.rb
|
244
245
|
- lib/mutant/mutator/node/mlhs.rb
|
245
246
|
- lib/mutant/mutator/node/return.rb
|
@@ -334,6 +335,7 @@ files:
|
|
334
335
|
- spec/unit/mutant/mutator/node/literal/regex_spec.rb
|
335
336
|
- spec/unit/mutant/mutator/node/literal/string_spec.rb
|
336
337
|
- spec/unit/mutant/mutator/node/literal/symbol_spec.rb
|
338
|
+
- spec/unit/mutant/mutator/node/lvar/mutation_spec.rb
|
337
339
|
- spec/unit/mutant/mutator/node/masgn/mutation_spec.rb
|
338
340
|
- spec/unit/mutant/mutator/node/return/mutation_spec.rb
|
339
341
|
- spec/unit/mutant/mutator/node/send/mutation_spec.rb
|
@@ -441,6 +443,7 @@ test_files:
|
|
441
443
|
- spec/unit/mutant/mutator/node/literal/regex_spec.rb
|
442
444
|
- spec/unit/mutant/mutator/node/literal/string_spec.rb
|
443
445
|
- spec/unit/mutant/mutator/node/literal/symbol_spec.rb
|
446
|
+
- spec/unit/mutant/mutator/node/lvar/mutation_spec.rb
|
444
447
|
- spec/unit/mutant/mutator/node/masgn/mutation_spec.rb
|
445
448
|
- spec/unit/mutant/mutator/node/return/mutation_spec.rb
|
446
449
|
- spec/unit/mutant/mutator/node/send/mutation_spec.rb
|