mutant 0.8.2 → 0.8.3
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 +7 -4
- data/Gemfile +1 -0
- data/README.md +19 -0
- data/config/flay.yml +1 -1
- data/lib/mutant.rb +3 -0
- data/lib/mutant/ast/meta.rb +0 -62
- data/lib/mutant/ast/meta/optarg.rb +26 -0
- data/lib/mutant/ast/meta/resbody.rb +15 -0
- data/lib/mutant/ast/meta/send.rb +62 -0
- data/lib/mutant/mutator/node/argument.rb +1 -3
- data/lib/mutant/mutator/node/define.rb +42 -0
- data/lib/mutant/mutator/node/named_value/constant_assignment.rb +11 -1
- data/lib/mutant/mutator/node/super.rb +0 -1
- data/lib/mutant/subject/method/instance.rb +1 -1
- data/lib/mutant/version.rb +1 -1
- data/meta/block.rb +6 -6
- data/meta/casgn.rb +10 -0
- data/meta/def.rb +39 -7
- data/meta/super.rb +0 -3
- data/mutant.gemspec +2 -2
- data/spec/unit/mutant/ast/meta/optarg_spec.rb +22 -0
- data/spec/unit/mutant/subject/method/instance_spec.rb +5 -0
- metadata +12 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d31268248349a065fe46a960fe2a0d0ace09f0d8
|
4
|
+
data.tar.gz: c35d18b21c3761d28fece74e573ef7f6ab0dfd69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3aec0dac703c7e91f164c60baa26d941e9a2d2149bd4542fcaac33f8e4794d9431ce4e226a5af29b88ec13e77f1ab2e32b6c4431a2a514ea4f2e1cb4200ea3bd
|
7
|
+
data.tar.gz: 9fb92420b95b0ae6fd1df55941e3df971b89d80ff7bef55a06c9823d1c96d6b4d50aedb88814a1c308ca57f99aa30e8d12ddc6275a6036073c21ca16d6d74aa9
|
data/Changelog.md
CHANGED
@@ -1,14 +1,17 @@
|
|
1
|
+
# v0.8.3 2015-09-01
|
2
|
+
|
3
|
+
* Remove invalid mutation `super(...)` to `super`
|
4
|
+
* Add mutation from `def foo(a = true); end` to `def foo(a = true); a = true; end` #419
|
5
|
+
* Add mutation from `def foo; end` to `remove_method :foo` #413
|
6
|
+
|
1
7
|
# v0.8.2 2015-08-11
|
2
8
|
|
3
9
|
* Remove invalid mutation `foo or bar` to `!(foo or bar)` see #287
|
4
10
|
* Add mutation from `#to_h` to `#to_hash` #218
|
5
|
-
<<<<<<< 2914e9c8d906540edc1cc7d4bc6393f68db39b8d
|
6
|
-
* Add mutation from `#defined?` to `true` / `false` #334
|
7
11
|
* Add mutation from `super` to `super()` #309
|
8
|
-
=======
|
9
12
|
* Add mutation from `#defined?` to `true` / `false` #399
|
10
13
|
* Reduce framed (multiline) progress reporter noise
|
11
|
-
|
14
|
+
* Fix a bug where killfork pipes where not properly closed
|
12
15
|
|
13
16
|
# v0.8.1 2015-07-24
|
14
17
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -191,6 +191,25 @@ Mutation output is grouped by selection groups. Each group contains three sectio
|
|
191
191
|
-----------------------
|
192
192
|
```
|
193
193
|
|
194
|
+
Planning a presentation?
|
195
|
+
------------------------
|
196
|
+
|
197
|
+
Mutation testing lately (not only mutant) seems to attract some attention. So naturally
|
198
|
+
people do talks about it at conferences, user groups or other chances. Thx for that!
|
199
|
+
|
200
|
+
As I (the author @mbj) am not too happy with some of the facts being presented about
|
201
|
+
mutant the last month.
|
202
|
+
|
203
|
+
So if you plan to do a presentation: I offer to review your slides / talk - for free off course.
|
204
|
+
My intention is NOT to change your bias pro / against this tool. Just to help to fix
|
205
|
+
invalid statements about the tool.
|
206
|
+
|
207
|
+
Also in many cases a conversation to the author, should help you to imporve the talk
|
208
|
+
significantly. One of mutants biggest weaknesses is the bad documentation, but instead of
|
209
|
+
assumptions based on the absence of docs, use the tool authors brain to fill the gaps.
|
210
|
+
|
211
|
+
Hint, same applies to papers.
|
212
|
+
|
194
213
|
Rails
|
195
214
|
-------
|
196
215
|
|
data/config/flay.yml
CHANGED
data/lib/mutant.rb
CHANGED
@@ -48,6 +48,9 @@ require 'mutant/ast/nodes'
|
|
48
48
|
require 'mutant/ast/named_children'
|
49
49
|
require 'mutant/ast/node_predicates'
|
50
50
|
require 'mutant/ast/meta'
|
51
|
+
require 'mutant/ast/meta/send'
|
52
|
+
require 'mutant/ast/meta/optarg'
|
53
|
+
require 'mutant/ast/meta/resbody'
|
51
54
|
require 'mutant/actor'
|
52
55
|
require 'mutant/actor/receiver'
|
53
56
|
require 'mutant/actor/sender'
|
data/lib/mutant/ast/meta.rb
CHANGED
@@ -2,68 +2,6 @@ module Mutant
|
|
2
2
|
module AST
|
3
3
|
# Node meta information mixin
|
4
4
|
module Meta
|
5
|
-
|
6
|
-
# Metadata for resbody nods
|
7
|
-
class Resbody
|
8
|
-
include NamedChildren, Concord.new(:node)
|
9
|
-
|
10
|
-
children :captures, :assignment, :body
|
11
|
-
end # Resbody
|
12
|
-
|
13
|
-
# Metadata for send nodes
|
14
|
-
class Send
|
15
|
-
include NamedChildren, Concord.new(:node)
|
16
|
-
|
17
|
-
children :receiver, :selector
|
18
|
-
|
19
|
-
INDEX_ASSIGNMENT_SELECTOR = :[]=
|
20
|
-
ATTRIBUTE_ASSIGNMENT_SELECTOR_SUFFIX = '='.freeze
|
21
|
-
|
22
|
-
# Arguments of mutated node
|
23
|
-
#
|
24
|
-
# @return [Enumerable<Parser::AST::Node>]
|
25
|
-
#
|
26
|
-
# @api private
|
27
|
-
alias_method :arguments, :remaining_children
|
28
|
-
|
29
|
-
# Test if AST node is a valid assignment target
|
30
|
-
#
|
31
|
-
# @return [Boolean]
|
32
|
-
#
|
33
|
-
# @api private
|
34
|
-
def assignment?
|
35
|
-
index_assignment? || attribute_assignment?
|
36
|
-
end
|
37
|
-
|
38
|
-
# Test if AST node is an attribute assignment?
|
39
|
-
#
|
40
|
-
# @return [Boolean]
|
41
|
-
#
|
42
|
-
# @api private
|
43
|
-
def attribute_assignment?
|
44
|
-
!Types::METHOD_OPERATORS.include?(selector) &&
|
45
|
-
selector.to_s.end_with?(ATTRIBUTE_ASSIGNMENT_SELECTOR_SUFFIX)
|
46
|
-
end
|
47
|
-
|
48
|
-
# Test if AST node is an index assign
|
49
|
-
#
|
50
|
-
# @return [Boolean]
|
51
|
-
#
|
52
|
-
# @api private
|
53
|
-
def index_assignment?
|
54
|
-
selector.equal?(INDEX_ASSIGNMENT_SELECTOR)
|
55
|
-
end
|
56
|
-
|
57
|
-
# Test for binary operator implemented as method
|
58
|
-
#
|
59
|
-
# @return [Boolean]
|
60
|
-
#
|
61
|
-
# @api private
|
62
|
-
def binary_method_operator?
|
63
|
-
Types::BINARY_METHOD_OPERATORS.include?(selector)
|
64
|
-
end
|
65
|
-
|
66
|
-
end # Send
|
67
5
|
end # Meta
|
68
6
|
end # AST
|
69
7
|
end # Mutant
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Mutant
|
2
|
+
module AST
|
3
|
+
# Node meta information mixin
|
4
|
+
module Meta
|
5
|
+
|
6
|
+
# Metadata for optional argument nodes
|
7
|
+
class Optarg
|
8
|
+
include NamedChildren, Concord.new(:node)
|
9
|
+
|
10
|
+
UNDERSCORE = '_'.freeze
|
11
|
+
|
12
|
+
children :name, :default_value
|
13
|
+
|
14
|
+
# Test if optarg definition intends to be used
|
15
|
+
#
|
16
|
+
# @return [Boolean]
|
17
|
+
#
|
18
|
+
# @api private
|
19
|
+
def used?
|
20
|
+
!name.to_s.start_with?(UNDERSCORE)
|
21
|
+
end
|
22
|
+
end # Optarg
|
23
|
+
|
24
|
+
end # Meta
|
25
|
+
end # AST
|
26
|
+
end # Mutant
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Mutant
|
2
|
+
module AST
|
3
|
+
# Node meta information mixin
|
4
|
+
module Meta
|
5
|
+
|
6
|
+
# Metadata for resbody nodes
|
7
|
+
class Resbody
|
8
|
+
include NamedChildren, Concord.new(:node)
|
9
|
+
|
10
|
+
children :captures, :assignment, :body
|
11
|
+
end # Resbody
|
12
|
+
|
13
|
+
end # Meta
|
14
|
+
end # AST
|
15
|
+
end # Mutant
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Mutant
|
2
|
+
module AST
|
3
|
+
# Node meta information mixin
|
4
|
+
module Meta
|
5
|
+
|
6
|
+
# Metadata for send nodes
|
7
|
+
class Send
|
8
|
+
include NamedChildren, Concord.new(:node)
|
9
|
+
|
10
|
+
children :receiver, :selector
|
11
|
+
|
12
|
+
INDEX_ASSIGNMENT_SELECTOR = :[]=
|
13
|
+
ATTRIBUTE_ASSIGNMENT_SELECTOR_SUFFIX = '='.freeze
|
14
|
+
|
15
|
+
# Arguments of mutated node
|
16
|
+
#
|
17
|
+
# @return [Enumerable<Parser::AST::Node>]
|
18
|
+
#
|
19
|
+
# @api private
|
20
|
+
alias_method :arguments, :remaining_children
|
21
|
+
|
22
|
+
# Test if AST node is a valid assignment target
|
23
|
+
#
|
24
|
+
# @return [Boolean]
|
25
|
+
#
|
26
|
+
# @api private
|
27
|
+
def assignment?
|
28
|
+
index_assignment? || attribute_assignment?
|
29
|
+
end
|
30
|
+
|
31
|
+
# Test if AST node is an attribute assignment?
|
32
|
+
#
|
33
|
+
# @return [Boolean]
|
34
|
+
#
|
35
|
+
# @api private
|
36
|
+
def attribute_assignment?
|
37
|
+
!Types::METHOD_OPERATORS.include?(selector) &&
|
38
|
+
selector.to_s.end_with?(ATTRIBUTE_ASSIGNMENT_SELECTOR_SUFFIX)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Test if AST node is an index assign
|
42
|
+
#
|
43
|
+
# @return [Boolean]
|
44
|
+
#
|
45
|
+
# @api private
|
46
|
+
def index_assignment?
|
47
|
+
selector.equal?(INDEX_ASSIGNMENT_SELECTOR)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Test for binary operator implemented as method
|
51
|
+
#
|
52
|
+
# @return [Boolean]
|
53
|
+
#
|
54
|
+
# @api private
|
55
|
+
def binary_method_operator?
|
56
|
+
Types::BINARY_METHOD_OPERATORS.include?(selector)
|
57
|
+
end
|
58
|
+
|
59
|
+
end # Send
|
60
|
+
end # Meta
|
61
|
+
end # AST
|
62
|
+
end # Mutant
|
@@ -13,11 +13,40 @@ module Mutant
|
|
13
13
|
# @api private
|
14
14
|
def dispatch
|
15
15
|
emit_arguments_mutations
|
16
|
+
emit_optarg_body_assignments
|
16
17
|
emit_body(N_RAISE)
|
17
18
|
emit_body(nil)
|
18
19
|
emit_body_mutations if body
|
19
20
|
end
|
20
21
|
|
22
|
+
# Emit mutations with optional arguments as assignments in method
|
23
|
+
#
|
24
|
+
# @return [undefined]
|
25
|
+
#
|
26
|
+
# @api private
|
27
|
+
def emit_optarg_body_assignments
|
28
|
+
arguments.children.each do |argument|
|
29
|
+
next unless n_optarg?(argument) && AST::Meta::Optarg.new(argument).used?
|
30
|
+
|
31
|
+
emit_body_prepend(s(:lvasgn, *argument))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Emit valid body ASTs depending on instance body
|
36
|
+
#
|
37
|
+
# @param node [Parser::AST::Node]
|
38
|
+
#
|
39
|
+
# @return [undefined]
|
40
|
+
#
|
41
|
+
# @api private
|
42
|
+
def emit_body_prepend(node)
|
43
|
+
if body
|
44
|
+
emit_body(s(:begin, node, body))
|
45
|
+
else
|
46
|
+
emit_body(node)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
21
50
|
# Mutator for instance method defines
|
22
51
|
class Instance < self
|
23
52
|
|
@@ -25,6 +54,19 @@ module Mutant
|
|
25
54
|
|
26
55
|
children :name, :arguments, :body
|
27
56
|
|
57
|
+
def dispatch
|
58
|
+
super()
|
59
|
+
emit_remove_method
|
60
|
+
end
|
61
|
+
|
62
|
+
# Remove an instance method
|
63
|
+
#
|
64
|
+
# @return [undefined]
|
65
|
+
#
|
66
|
+
# @api private
|
67
|
+
def emit_remove_method
|
68
|
+
emit(s(:send, nil, :remove_method, s(:sym, name)))
|
69
|
+
end
|
28
70
|
end # Instance
|
29
71
|
|
30
72
|
# Mutator for singleton method defines
|
@@ -19,7 +19,17 @@ module Mutant
|
|
19
19
|
# @api private
|
20
20
|
def dispatch
|
21
21
|
mutate_name
|
22
|
-
emit_value_mutations
|
22
|
+
emit_value_mutations
|
23
|
+
emit_remove_const
|
24
|
+
end
|
25
|
+
|
26
|
+
# Emit remove_const
|
27
|
+
#
|
28
|
+
# @return [undefined]
|
29
|
+
#
|
30
|
+
# @api private
|
31
|
+
def emit_remove_const
|
32
|
+
emit(s(:send, cbase, :remove_const, s(:sym, name)))
|
23
33
|
end
|
24
34
|
|
25
35
|
# Emit name mutations
|
data/lib/mutant/version.rb
CHANGED
data/meta/block.rb
CHANGED
@@ -20,8 +20,8 @@ Mutant::Meta::Example.add do
|
|
20
20
|
singleton_mutations
|
21
21
|
mutation 'foo'
|
22
22
|
mutation 'foo { |a, b| raise }'
|
23
|
-
mutation 'foo { |a,
|
24
|
-
mutation 'foo { |
|
23
|
+
mutation 'foo { |a, _b| }'
|
24
|
+
mutation 'foo { |_a, b| }'
|
25
25
|
mutation 'foo { |a| }'
|
26
26
|
mutation 'foo { |b| }'
|
27
27
|
mutation 'foo { || }'
|
@@ -38,9 +38,9 @@ Mutant::Meta::Example.add do
|
|
38
38
|
mutation 'foo { |(b), c| }'
|
39
39
|
mutation 'foo { |(a, b)| }'
|
40
40
|
mutation 'foo { |c| }'
|
41
|
-
mutation 'foo { |(
|
42
|
-
mutation 'foo { |(a,
|
43
|
-
mutation 'foo { |(a, b),
|
41
|
+
mutation 'foo { |(_a, b), c| }'
|
42
|
+
mutation 'foo { |(a, _b), c| }'
|
43
|
+
mutation 'foo { |(a, b), _c| }'
|
44
44
|
mutation 'foo'
|
45
45
|
end
|
46
46
|
|
@@ -66,6 +66,6 @@ Mutant::Meta::Example.add do
|
|
66
66
|
mutation 'foo { || }'
|
67
67
|
mutation 'foo { |a| }'
|
68
68
|
mutation 'foo { |(a)| raise }'
|
69
|
-
mutation 'foo { |(
|
69
|
+
mutation 'foo { |(_a)| }'
|
70
70
|
mutation 'foo'
|
71
71
|
end
|
data/meta/casgn.rb
CHANGED
@@ -4,4 +4,14 @@ Mutant::Meta::Example.add do
|
|
4
4
|
mutation 'A__MUTANT__ = true'
|
5
5
|
mutation 'A = false'
|
6
6
|
mutation 'A = nil'
|
7
|
+
mutation 'remove_const :A'
|
8
|
+
end
|
9
|
+
|
10
|
+
Mutant::Meta::Example.add do
|
11
|
+
source 'self::A = true'
|
12
|
+
|
13
|
+
mutation 'self::A__MUTANT__ = true'
|
14
|
+
mutation 'self::A = false'
|
15
|
+
mutation 'self::A = nil'
|
16
|
+
mutation 'self.remove_const :A'
|
7
17
|
end
|
data/meta/def.rb
CHANGED
@@ -2,6 +2,7 @@ Mutant::Meta::Example.add do
|
|
2
2
|
source 'def foo; end'
|
3
3
|
|
4
4
|
mutation 'def foo; raise; end'
|
5
|
+
mutation 'remove_method :foo'
|
5
6
|
end
|
6
7
|
|
7
8
|
Mutant::Meta::Example.add do
|
@@ -11,6 +12,7 @@ Mutant::Meta::Example.add do
|
|
11
12
|
mutation 'def foo; nil; rescue; end'
|
12
13
|
mutation 'def foo; self; rescue; end'
|
13
14
|
mutation 'def foo; end'
|
15
|
+
mutation 'remove_method :foo'
|
14
16
|
|
15
17
|
# Promote rescue resbody bodies
|
16
18
|
mutation 'def foo; foo; end'
|
@@ -41,6 +43,8 @@ Mutant::Meta::Example.add do
|
|
41
43
|
|
42
44
|
# Failing body
|
43
45
|
mutation 'def a; raise; end'
|
46
|
+
|
47
|
+
mutation 'remove_method :a'
|
44
48
|
end
|
45
49
|
|
46
50
|
Mutant::Meta::Example.add do
|
@@ -60,6 +64,8 @@ Mutant::Meta::Example.add do
|
|
60
64
|
mutation 'def foo; end'
|
61
65
|
|
62
66
|
mutation 'def foo; raise; end'
|
67
|
+
|
68
|
+
mutation 'remove_method :foo'
|
63
69
|
end
|
64
70
|
|
65
71
|
Mutant::Meta::Example.add do
|
@@ -73,11 +79,30 @@ Mutant::Meta::Example.add do
|
|
73
79
|
mutation 'def foo; end'
|
74
80
|
|
75
81
|
# Rename each argument
|
76
|
-
mutation 'def foo(
|
77
|
-
mutation 'def foo(a,
|
82
|
+
mutation 'def foo(_a, b); end'
|
83
|
+
mutation 'def foo(a, _b); end'
|
78
84
|
|
79
85
|
# Mutation of body
|
80
86
|
mutation 'def foo(a, b); raise; end'
|
87
|
+
|
88
|
+
mutation 'remove_method :foo'
|
89
|
+
end
|
90
|
+
|
91
|
+
Mutant::Meta::Example.add do
|
92
|
+
source 'def foo(a, b = nil); true; end'
|
93
|
+
|
94
|
+
mutation 'def foo(_a, b = nil); true; end'
|
95
|
+
mutation 'def foo(a, b = nil); end'
|
96
|
+
mutation 'def foo; true; end'
|
97
|
+
mutation 'def foo(a, b = nil); raise; end'
|
98
|
+
mutation 'def foo(a, b = nil); nil; end'
|
99
|
+
mutation 'def foo(a, b = nil); false; end'
|
100
|
+
mutation 'def foo(a); true; end'
|
101
|
+
mutation 'def foo(a, b = nil); b = nil; true; end'
|
102
|
+
mutation 'def foo(b = nil); true; end'
|
103
|
+
mutation 'def foo(a, _b = nil); true; end'
|
104
|
+
mutation 'def foo(a, b); true; end'
|
105
|
+
mutation 'remove_method :foo'
|
81
106
|
end
|
82
107
|
|
83
108
|
Mutant::Meta::Example.add do
|
@@ -85,6 +110,7 @@ Mutant::Meta::Example.add do
|
|
85
110
|
|
86
111
|
mutation 'def foo(_unused); raise; end'
|
87
112
|
mutation 'def foo; end'
|
113
|
+
mutation 'remove_method :foo'
|
88
114
|
end
|
89
115
|
|
90
116
|
Mutant::Meta::Example.add do
|
@@ -95,12 +121,13 @@ Mutant::Meta::Example.add do
|
|
95
121
|
mutation 'def foo(_unused = true); raise; end'
|
96
122
|
mutation 'def foo(_unused); end'
|
97
123
|
mutation 'def foo; end'
|
124
|
+
mutation 'remove_method :foo'
|
98
125
|
end
|
99
126
|
|
100
127
|
Mutant::Meta::Example.add do
|
101
128
|
source 'def foo(a = 0, b = 0); end'
|
102
|
-
mutation 'def foo(a = 0,
|
103
|
-
mutation 'def foo(
|
129
|
+
mutation 'def foo(a = 0, _b = 0); end'
|
130
|
+
mutation 'def foo(_a = 0, b = 0); end'
|
104
131
|
mutation 'def foo(a = 0, b = 1); end'
|
105
132
|
mutation 'def foo(a = 0, b = -1); end'
|
106
133
|
mutation 'def foo(a = 0, b = self); end'
|
@@ -113,7 +140,10 @@ Mutant::Meta::Example.add do
|
|
113
140
|
mutation 'def foo(b = 0); end'
|
114
141
|
mutation 'def foo(a, b = 0); end'
|
115
142
|
mutation 'def foo; end'
|
143
|
+
mutation 'def foo(a = 0, b = 0); a = 0; end'
|
144
|
+
mutation 'def foo(a = 0, b = 0); b = 0; end'
|
116
145
|
mutation 'def foo(a = 0, b = 0); raise; end'
|
146
|
+
mutation 'remove_method :foo'
|
117
147
|
end
|
118
148
|
|
119
149
|
Mutant::Meta::Example.add do
|
@@ -123,8 +153,10 @@ Mutant::Meta::Example.add do
|
|
123
153
|
mutation 'def foo(); end'
|
124
154
|
mutation 'def foo(a = false); end'
|
125
155
|
mutation 'def foo(a = nil); end'
|
126
|
-
mutation 'def foo(
|
156
|
+
mutation 'def foo(_a = true); end'
|
127
157
|
mutation 'def foo(a = true); raise; end'
|
158
|
+
mutation 'def foo(a = true); a = true; end'
|
159
|
+
mutation 'remove_method :foo'
|
128
160
|
end
|
129
161
|
|
130
162
|
Mutant::Meta::Example.add do
|
@@ -158,8 +190,8 @@ Mutant::Meta::Example.add do
|
|
158
190
|
mutation 'def self.foo; end'
|
159
191
|
|
160
192
|
# Rename each argument
|
161
|
-
mutation 'def self.foo(
|
162
|
-
mutation 'def self.foo(a,
|
193
|
+
mutation 'def self.foo(_a, b); end'
|
194
|
+
mutation 'def self.foo(a, _b); end'
|
163
195
|
|
164
196
|
# Mutation of body
|
165
197
|
mutation 'def self.foo(a, b); raise; end'
|
data/meta/super.rb
CHANGED
@@ -9,15 +9,12 @@ Mutant::Meta::Example.add do
|
|
9
9
|
source 'super()'
|
10
10
|
|
11
11
|
singleton_mutations
|
12
|
-
# this is zsuper a totally different node than super()
|
13
|
-
mutation 'super'
|
14
12
|
end
|
15
13
|
|
16
14
|
Mutant::Meta::Example.add do
|
17
15
|
source 'super(foo, bar)'
|
18
16
|
|
19
17
|
singleton_mutations
|
20
|
-
mutation 'super'
|
21
18
|
mutation 'super()'
|
22
19
|
mutation 'super(foo)'
|
23
20
|
mutation 'super(bar)'
|
data/mutant.gemspec
CHANGED
@@ -24,10 +24,10 @@ Gem::Specification.new do |gem|
|
|
24
24
|
gem.required_ruby_version = '>= 2.1'
|
25
25
|
|
26
26
|
gem.add_runtime_dependency('parser', '~> 2.2.2')
|
27
|
-
gem.add_runtime_dependency('ast', '~> 2.
|
27
|
+
gem.add_runtime_dependency('ast', '~> 2.1')
|
28
28
|
gem.add_runtime_dependency('diff-lcs', '~> 1.2')
|
29
29
|
gem.add_runtime_dependency('parallel', '~> 1.3')
|
30
|
-
gem.add_runtime_dependency('morpher', '~> 0.2.
|
30
|
+
gem.add_runtime_dependency('morpher', '~> 0.2.4')
|
31
31
|
gem.add_runtime_dependency('procto', '~> 0.0.2')
|
32
32
|
gem.add_runtime_dependency('abstract_type', '~> 0.0.7')
|
33
33
|
gem.add_runtime_dependency('unparser', '~> 0.2.4')
|
@@ -0,0 +1,22 @@
|
|
1
|
+
RSpec.describe Mutant::AST::Meta::Optarg do
|
2
|
+
subject(:object) { described_class.new(node) }
|
3
|
+
|
4
|
+
let(:node) { s(:optarg, name, value) }
|
5
|
+
let(:name) { :foo }
|
6
|
+
let(:value) { s(:sym, :bar) }
|
7
|
+
|
8
|
+
its(:name) { should be(:foo) }
|
9
|
+
its(:default_value) { should eql(s(:sym, :bar)) }
|
10
|
+
|
11
|
+
describe '#used?' do
|
12
|
+
subject { object.used? }
|
13
|
+
|
14
|
+
it { should be true }
|
15
|
+
|
16
|
+
context 'when name is prefixed with an underscore' do
|
17
|
+
let(:name) { :_foo }
|
18
|
+
it { should be false }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -144,6 +144,11 @@ RSpec.describe Mutant::Subject::Method::Instance::Memoized do
|
|
144
144
|
object,
|
145
145
|
s(:begin,
|
146
146
|
s(:def, :foo, s(:args), nil), s(:send, nil, :memoize, s(:args, s(:sym, :foo))))
|
147
|
+
),
|
148
|
+
Mutant::Mutation::Evil.new(
|
149
|
+
object,
|
150
|
+
s(:begin,
|
151
|
+
s(:send, nil, :remove_method, s(:sym, :foo)), s(:send, nil, :memoize, s(:args, s(:sym, :foo))))
|
147
152
|
)
|
148
153
|
]
|
149
154
|
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.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '2.
|
33
|
+
version: '2.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '2.
|
40
|
+
version: '2.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: diff-lcs
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.2.
|
75
|
+
version: 0.2.4
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.2.
|
82
|
+
version: 0.2.4
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: procto
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -279,6 +279,9 @@ files:
|
|
279
279
|
- lib/mutant/actor/sender.rb
|
280
280
|
- lib/mutant/ast.rb
|
281
281
|
- lib/mutant/ast/meta.rb
|
282
|
+
- lib/mutant/ast/meta/optarg.rb
|
283
|
+
- lib/mutant/ast/meta/resbody.rb
|
284
|
+
- lib/mutant/ast/meta/send.rb
|
282
285
|
- lib/mutant/ast/named_children.rb
|
283
286
|
- lib/mutant/ast/node_predicates.rb
|
284
287
|
- lib/mutant/ast/nodes.rb
|
@@ -494,6 +497,7 @@ files:
|
|
494
497
|
- spec/unit/mutant/actor/message_spec.rb
|
495
498
|
- spec/unit/mutant/actor/receiver_spec.rb
|
496
499
|
- spec/unit/mutant/actor/sender_spec.rb
|
500
|
+
- spec/unit/mutant/ast/meta/optarg_spec.rb
|
497
501
|
- spec/unit/mutant/ast/meta/send_spec.rb
|
498
502
|
- spec/unit/mutant/ast/named_children_spec.rb
|
499
503
|
- spec/unit/mutant/ast/sexp_spec.rb
|
@@ -595,7 +599,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
595
599
|
version: '0'
|
596
600
|
requirements: []
|
597
601
|
rubyforge_project:
|
598
|
-
rubygems_version: 2.4.5
|
602
|
+
rubygems_version: 2.4.5.1
|
599
603
|
signing_key:
|
600
604
|
specification_version: 4
|
601
605
|
summary: Mutation testing tool for ruby under MRI and Rubinius
|
@@ -610,6 +614,7 @@ test_files:
|
|
610
614
|
- spec/unit/mutant/actor/message_spec.rb
|
611
615
|
- spec/unit/mutant/actor/receiver_spec.rb
|
612
616
|
- spec/unit/mutant/actor/sender_spec.rb
|
617
|
+
- spec/unit/mutant/ast/meta/optarg_spec.rb
|
613
618
|
- spec/unit/mutant/ast/meta/send_spec.rb
|
614
619
|
- spec/unit/mutant/ast/named_children_spec.rb
|
615
620
|
- spec/unit/mutant/ast/sexp_spec.rb
|