mutant 0.5.18 → 0.5.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +7 -0
- data/README.md +2 -2
- data/config/flay.yml +1 -1
- data/lib/mutant.rb +4 -1
- data/lib/mutant/meta/example/dsl.rb +11 -0
- data/lib/mutant/mutator/node.rb +29 -5
- data/lib/mutant/mutator/node/and_asgn.rb +34 -0
- data/lib/mutant/mutator/node/binary.rb +1 -1
- data/lib/mutant/mutator/node/block.rb +1 -1
- data/lib/mutant/mutator/node/break.rb +29 -0
- data/lib/mutant/mutator/node/case.rb +1 -1
- data/lib/mutant/mutator/node/conditional_loop.rb +1 -1
- data/lib/mutant/mutator/node/const.rb +1 -1
- data/lib/mutant/mutator/node/defined.rb +30 -0
- data/lib/mutant/mutator/node/dstr.rb +1 -1
- data/lib/mutant/mutator/node/dsym.rb +1 -1
- data/lib/mutant/mutator/node/generic.rb +1 -1
- data/lib/mutant/mutator/node/if.rb +4 -2
- data/lib/mutant/mutator/node/kwbegin.rb +1 -1
- data/lib/mutant/mutator/node/literal/array.rb +1 -1
- data/lib/mutant/mutator/node/literal/fixnum.rb +1 -1
- data/lib/mutant/mutator/node/literal/float.rb +1 -1
- data/lib/mutant/mutator/node/literal/hash.rb +1 -1
- data/lib/mutant/mutator/node/literal/range.rb +1 -1
- data/lib/mutant/mutator/node/literal/regex.rb +1 -1
- data/lib/mutant/mutator/node/literal/string.rb +1 -1
- data/lib/mutant/mutator/node/literal/symbol.rb +1 -1
- data/lib/mutant/mutator/node/masgn.rb +1 -1
- data/lib/mutant/mutator/node/match_current_line.rb +1 -1
- data/lib/mutant/mutator/node/named_value/access.rb +1 -1
- data/lib/mutant/mutator/node/named_value/variable_assignment.rb +1 -1
- data/lib/mutant/mutator/node/{loop_control.rb → next.rb} +5 -9
- data/lib/mutant/mutator/node/op_asgn.rb +9 -4
- data/lib/mutant/mutator/node/or_asgn.rb +6 -2
- data/lib/mutant/mutator/node/resbody.rb +2 -2
- data/lib/mutant/mutator/node/return.rb +1 -1
- data/lib/mutant/mutator/node/send.rb +1 -1
- data/lib/mutant/mutator/node/splat.rb +1 -1
- data/lib/mutant/mutator/node/super.rb +1 -1
- data/lib/mutant/mutator/node/yield.rb +1 -1
- data/lib/mutant/mutator/node/zsuper.rb +1 -1
- data/lib/mutant/node_helpers.rb +6 -5
- data/lib/mutant/version.rb +1 -1
- data/meta/and.rb +1 -1
- data/meta/and_asgn.rb +3 -1
- data/meta/array.rb +2 -2
- data/meta/block.rb +6 -4
- data/meta/block_pass.rb +1 -1
- data/meta/blockarg.rb +1 -1
- data/meta/break.rb +1 -2
- data/meta/case.rb +104 -183
- data/meta/cbase.rb +1 -1
- data/meta/const.rb +1 -1
- data/meta/cvar.rb +1 -1
- data/meta/cvasgn.rb +1 -1
- data/meta/{define.rb → def.rb} +2 -1
- data/meta/dstr.rb +4 -1
- data/meta/dsym.rb +4 -2
- data/meta/ensure.rb +1 -1
- data/meta/false.rb +8 -0
- data/meta/float.rb +3 -4
- data/meta/gvar.rb +1 -1
- data/meta/gvasgn.rb +1 -1
- data/meta/hash.rb +1 -2
- data/meta/if.rb +25 -27
- data/meta/{fixnum.rb → int.rb} +1 -2
- data/meta/ivasgn.rb +1 -1
- data/meta/kwbegin.rb +1 -1
- data/meta/lvar.rb +2 -0
- data/meta/lvasgn.rb +1 -1
- data/meta/masgn.rb +1 -1
- data/meta/match_current_line.rb +1 -1
- data/meta/next.rb +1 -1
- data/meta/op_assgn.rb +3 -1
- data/meta/{binary.rb → or.rb} +1 -1
- data/meta/or_asgn.rb +4 -2
- data/meta/range.rb +6 -2
- data/meta/regex.rb +4 -2
- data/meta/rescue.rb +7 -6
- data/meta/restarg.rb +3 -1
- data/meta/return.rb +3 -2
- data/meta/send.rb +48 -51
- data/meta/{string.rb → str.rb} +1 -1
- data/meta/super.rb +6 -3
- data/meta/symbol.rb +1 -1
- data/meta/true.rb +8 -0
- data/meta/until.rb +17 -0
- data/meta/while.rb +4 -2
- data/meta/yield.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +13 -8
- data/meta/unless.rb +0 -15
data/meta/cbase.rb
CHANGED
data/meta/const.rb
CHANGED
data/meta/cvar.rb
CHANGED
data/meta/cvasgn.rb
CHANGED
data/meta/{define.rb → def.rb}
RENAMED
@@ -7,10 +7,11 @@ Mutant::Meta::Example.add do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
Mutant::Meta::Example.add do
|
10
|
-
source
|
10
|
+
source 'def foo; foo; rescue; end'
|
11
11
|
|
12
12
|
mutation 'def foo; raise; end'
|
13
13
|
mutation 'def foo; nil; rescue; end'
|
14
|
+
mutation 'def foo; self; rescue; end'
|
14
15
|
mutation 'def foo; end'
|
15
16
|
end
|
16
17
|
|
data/meta/dstr.rb
CHANGED
@@ -3,8 +3,11 @@
|
|
3
3
|
Mutant::Meta::Example.add do
|
4
4
|
source '"foo#{bar}baz"'
|
5
5
|
|
6
|
-
|
6
|
+
singleton_mutations
|
7
7
|
mutation '"#{nil}#{bar}baz"'
|
8
|
+
mutation '"#{self}#{bar}baz"'
|
8
9
|
mutation '"foo#{bar}#{nil}"'
|
10
|
+
mutation '"foo#{bar}#{self}"'
|
9
11
|
mutation '"foo#{nil}baz"'
|
12
|
+
mutation '"foo#{self}baz"'
|
10
13
|
end
|
data/meta/dsym.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
Mutant::Meta::Example.add do
|
4
|
-
|
5
4
|
source ':"foo#{bar}baz"'
|
6
5
|
|
6
|
+
singleton_mutations
|
7
7
|
mutation ':"#{nil}#{bar}baz"'
|
8
|
+
mutation ':"#{self}#{bar}baz"'
|
8
9
|
mutation ':"foo#{bar}#{nil}"'
|
10
|
+
mutation ':"foo#{bar}#{self}"'
|
9
11
|
mutation ':"foo#{nil}baz"'
|
10
|
-
mutation '
|
12
|
+
mutation ':"foo#{self}baz"'
|
11
13
|
end
|
data/meta/ensure.rb
CHANGED
data/meta/false.rb
ADDED
data/meta/float.rb
CHANGED
@@ -3,8 +3,7 @@
|
|
3
3
|
Mutant::Meta::Example.add do
|
4
4
|
source '10.0'
|
5
5
|
|
6
|
-
|
7
|
-
mutation 'nil'
|
6
|
+
singleton_mutations
|
8
7
|
|
9
8
|
# edge cases
|
10
9
|
mutation '0.0'
|
@@ -20,7 +19,7 @@ end
|
|
20
19
|
Mutant::Meta::Example.add do
|
21
20
|
source '0.0'
|
22
21
|
|
23
|
-
|
22
|
+
singleton_mutations
|
24
23
|
mutation '1.0'
|
25
24
|
mutation '(0.0 / 0.0)'
|
26
25
|
mutation '(1.0 / 0.0)'
|
@@ -30,7 +29,7 @@ end
|
|
30
29
|
Mutant::Meta::Example.add do
|
31
30
|
source '-0.0'
|
32
31
|
|
33
|
-
|
32
|
+
singleton_mutations
|
34
33
|
mutation '1.0'
|
35
34
|
mutation '(0.0 / 0.0)'
|
36
35
|
mutation '(1.0 / 0.0)'
|
data/meta/gvar.rb
CHANGED
data/meta/gvasgn.rb
CHANGED
data/meta/hash.rb
CHANGED
data/meta/if.rb
CHANGED
@@ -1,57 +1,55 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
Mutant::Meta::Example.add do
|
4
|
-
source 'if
|
4
|
+
source 'if condition; true; else false; end'
|
5
|
+
|
6
|
+
singleton_mutations
|
5
7
|
|
6
8
|
# mutation of condition
|
7
|
-
mutation 'if
|
8
|
-
mutation 'if
|
9
|
-
mutation 'if
|
10
|
-
mutation 'if
|
11
|
-
mutation 'if false; true; else false; end'
|
9
|
+
mutation 'if !condition; true; else false; end'
|
10
|
+
mutation 'if nil; true; else false; end'
|
11
|
+
mutation 'if true; true; else false; end'
|
12
|
+
mutation 'if false; true; else false; end'
|
12
13
|
|
13
14
|
# Deleted else branch
|
14
|
-
mutation 'if
|
15
|
+
mutation 'if condition; true end'
|
15
16
|
|
16
17
|
# Deleted if branch resuting in unless rendering
|
17
|
-
mutation 'unless
|
18
|
+
mutation 'unless condition; false; end'
|
18
19
|
|
19
20
|
# Deleted if branch with promoting else branch to if branch
|
20
|
-
mutation 'if
|
21
|
+
mutation 'if condition; false end'
|
21
22
|
|
22
23
|
# mutation of if body
|
23
|
-
mutation 'if
|
24
|
-
mutation 'if
|
24
|
+
mutation 'if condition; false; else false; end'
|
25
|
+
mutation 'if condition; nil; else false; end'
|
25
26
|
|
26
27
|
# mutation of else body
|
27
|
-
mutation 'if
|
28
|
-
mutation 'if
|
29
|
-
|
30
|
-
mutation 'nil'
|
28
|
+
mutation 'if condition; true; else true; end'
|
29
|
+
mutation 'if condition; true; else nil; end'
|
31
30
|
end
|
32
31
|
|
33
32
|
Mutant::Meta::Example.add do
|
34
33
|
source 'if condition; true; end'
|
35
34
|
|
35
|
+
singleton_mutations
|
36
36
|
mutation 'if !condition; true; end'
|
37
37
|
mutation 'if condition; false; end'
|
38
38
|
mutation 'if condition; nil; end'
|
39
39
|
mutation 'if true; true; end'
|
40
40
|
mutation 'if false; true; end'
|
41
41
|
mutation 'if nil; true; end'
|
42
|
-
mutation 'nil'
|
43
42
|
end
|
44
43
|
|
45
44
|
Mutant::Meta::Example.add do
|
46
|
-
source 'unless
|
47
|
-
|
48
|
-
|
49
|
-
mutation 'unless
|
50
|
-
mutation 'unless nil;
|
51
|
-
mutation 'unless
|
52
|
-
mutation 'unless
|
53
|
-
mutation 'unless
|
54
|
-
mutation 'unless
|
55
|
-
mutation 'if
|
56
|
-
mutation 'nil'
|
45
|
+
source 'unless condition; true; end'
|
46
|
+
|
47
|
+
singleton_mutations
|
48
|
+
mutation 'unless !condition; true; end'
|
49
|
+
mutation 'unless nil; true; end'
|
50
|
+
mutation 'unless true; true; end'
|
51
|
+
mutation 'unless false; true; end'
|
52
|
+
mutation 'unless condition; false; end'
|
53
|
+
mutation 'unless condition; nil; end'
|
54
|
+
mutation 'if condition; true; end'
|
57
55
|
end
|
data/meta/{fixnum.rb → int.rb}
RENAMED
data/meta/ivasgn.rb
CHANGED
data/meta/kwbegin.rb
CHANGED
data/meta/lvar.rb
CHANGED
@@ -4,11 +4,13 @@ Mutant::Meta::Example.add do
|
|
4
4
|
source 'a = nil; a'
|
5
5
|
|
6
6
|
mutation 'a = nil; nil'
|
7
|
+
mutation 'a = nil; self'
|
7
8
|
mutation 'a = nil'
|
8
9
|
# TODO: fix invalid AST
|
9
10
|
# These ASTs are not valid and should NOT be emitted
|
10
11
|
# Mutations of lvarasgn need to be special cased to avoid this.
|
11
12
|
mutation s(:begin, s(:lvasgn, :a__mutant__, s(:nil)), s(:lvar, :a))
|
12
13
|
mutation s(:begin, s(:nil), s(:lvar, :a))
|
14
|
+
mutation s(:begin, s(:self), s(:lvar, :a))
|
13
15
|
mutation s(:lvar, :a)
|
14
16
|
end
|
data/meta/lvasgn.rb
CHANGED
data/meta/masgn.rb
CHANGED
data/meta/match_current_line.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
Mutant::Meta::Example.add do
|
4
4
|
source 'true if /foo/'
|
5
5
|
|
6
|
+
singleton_mutations
|
6
7
|
mutation 'false if /foo/'
|
7
8
|
mutation 'true if //'
|
8
9
|
mutation 'nil if /foo/'
|
@@ -10,5 +11,4 @@ Mutant::Meta::Example.add do
|
|
10
11
|
mutation 'true if false'
|
11
12
|
mutation 'true if nil'
|
12
13
|
mutation 'true if /a\A/'
|
13
|
-
mutation 'nil'
|
14
14
|
end
|
data/meta/next.rb
CHANGED
data/meta/op_assgn.rb
CHANGED
@@ -3,12 +3,14 @@
|
|
3
3
|
Mutant::Meta::Example.add do
|
4
4
|
source '@a.b += 1'
|
5
5
|
|
6
|
+
singleton_mutations
|
6
7
|
mutation '@a.b += -1'
|
7
8
|
mutation '@a.b += 2'
|
8
9
|
mutation '@a.b += 0'
|
9
10
|
mutation '@a.b += nil'
|
11
|
+
mutation '@a.b += self'
|
10
12
|
mutation 'nil.b += 1'
|
11
|
-
mutation '
|
13
|
+
mutation 'self.b += 1'
|
12
14
|
# TODO: fix invalid AST
|
13
15
|
# This should not get emitted as invalid AST with valid unparsed source
|
14
16
|
mutation s(:op_asgn, s(:ivar, :@a), :+, s(:int, 1))
|
data/meta/{binary.rb → or.rb}
RENAMED
data/meta/or_asgn.rb
CHANGED
@@ -3,20 +3,22 @@
|
|
3
3
|
Mutant::Meta::Example.add do
|
4
4
|
source 'a ||= 1'
|
5
5
|
|
6
|
+
singleton_mutations
|
6
7
|
mutation 'a__mutant__ ||= 1'
|
7
8
|
mutation 'a ||= nil'
|
9
|
+
mutation 'a ||= self'
|
8
10
|
mutation 'a ||= 0'
|
9
11
|
mutation 'a ||= -1'
|
10
12
|
mutation 'a ||= 2'
|
11
|
-
mutation 'nil'
|
12
13
|
end
|
13
14
|
|
14
15
|
Mutant::Meta::Example.add do
|
15
16
|
source '@a ||= 1'
|
16
17
|
|
18
|
+
singleton_mutations
|
17
19
|
mutation '@a ||= nil'
|
20
|
+
mutation '@a ||= self'
|
18
21
|
mutation '@a ||= 0'
|
19
22
|
mutation '@a ||= -1'
|
20
23
|
mutation '@a ||= 2'
|
21
|
-
mutation 'nil'
|
22
24
|
end
|
data/meta/range.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Mutant::Meta::Example.add do
|
4
4
|
source '1..100'
|
5
5
|
|
6
|
-
|
6
|
+
singleton_mutations
|
7
7
|
mutation '1...100'
|
8
8
|
mutation '(0.0 / 0.0)..100'
|
9
9
|
mutation '1..(1.0 / 0.0)'
|
@@ -12,7 +12,9 @@ Mutant::Meta::Example.add do
|
|
12
12
|
mutation '0..100'
|
13
13
|
mutation '2..100'
|
14
14
|
mutation 'nil..100'
|
15
|
+
mutation 'self..100'
|
15
16
|
mutation '1..nil'
|
17
|
+
mutation '1..self'
|
16
18
|
mutation '1..0'
|
17
19
|
mutation '1..1'
|
18
20
|
mutation '1..99'
|
@@ -23,7 +25,7 @@ end
|
|
23
25
|
Mutant::Meta::Example.add do
|
24
26
|
source '1...100'
|
25
27
|
|
26
|
-
|
28
|
+
singleton_mutations
|
27
29
|
mutation '1..100'
|
28
30
|
mutation '(0.0 / 0.0)...100'
|
29
31
|
mutation '1...(1.0 / 0.0)'
|
@@ -32,7 +34,9 @@ Mutant::Meta::Example.add do
|
|
32
34
|
mutation '0...100'
|
33
35
|
mutation '2...100'
|
34
36
|
mutation 'nil...100'
|
37
|
+
mutation 'self...100'
|
35
38
|
mutation '1...nil'
|
39
|
+
mutation '1...self'
|
36
40
|
mutation '1...0'
|
37
41
|
mutation '1...1'
|
38
42
|
mutation '1...99'
|
data/meta/regex.rb
CHANGED
@@ -3,18 +3,20 @@
|
|
3
3
|
Mutant::Meta::Example.add do
|
4
4
|
source '/foo/'
|
5
5
|
|
6
|
+
singleton_mutations
|
6
7
|
mutation '//' # match all
|
7
8
|
mutation '/a\A/' # match nothing
|
8
|
-
mutation 'nil'
|
9
9
|
end
|
10
10
|
|
11
11
|
Mutant::Meta::Example.add do
|
12
12
|
source '/#{foo.bar}n/'
|
13
13
|
|
14
|
+
singleton_mutations
|
14
15
|
mutation '//' # match all
|
15
16
|
mutation '/#{foo}n/'
|
16
17
|
mutation '/a\A/' # match nothing
|
17
18
|
mutation '/#{nil.bar}n/'
|
19
|
+
mutation '/#{self.bar}n/'
|
18
20
|
mutation '/#{nil}n/'
|
19
|
-
mutation '
|
21
|
+
mutation '/#{self}n/'
|
20
22
|
end
|