mutant 0.3.0.rc4 → 0.3.0.rc5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mutant/constants.rb +19 -45
- data/lib/mutant/mutator/node/mlhs.rb +1 -1
- data/lib/mutant/version.rb +1 -1
- data/spec/unit/mutant/mutator/node/block/mutation_spec.rb +22 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93fb22e9e2e3e14dc8a4801c5bb1258307f2a45d
|
4
|
+
data.tar.gz: e3777ec7be30e6e2ba7623ba884962d79f2ed3f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ac0e6884996342e298c117bded83b14949bf4eb68b8dcf58ee436dafee7dcd44ef76c916d7a551b3ea92ae75105ee79909cd6a4a1d1a94775a4f6093912f1bb
|
7
|
+
data.tar.gz: 8e819ec82cf6305e3bf5124bae1b9f7363d06e1ca6d3c05bb7dacef7c044f69ea557ffe48c767c5b9550730f3501d30ee487aa0e4490dfc7ae1506ab92dc909b
|
data/lib/mutant/constants.rb
CHANGED
@@ -2,18 +2,12 @@
|
|
2
2
|
|
3
3
|
module Mutant
|
4
4
|
|
5
|
-
|
6
|
-
'?' => '_predicate',
|
7
|
-
'=' => '_writer',
|
8
|
-
'!' => '_bang'
|
9
|
-
}.freeze
|
10
|
-
|
11
|
-
# Set of not assignable nodes
|
5
|
+
# Set of nodes that cannot be on the LHS of an assignment
|
12
6
|
NOT_ASSIGNABLE = [
|
13
7
|
:int, :float, :str, :dstr, :class, :module, :self
|
14
8
|
].to_set.freeze
|
15
9
|
|
16
|
-
# Set of op
|
10
|
+
# Set of op-assign types
|
17
11
|
OP_ASSIGN = [
|
18
12
|
:or_asgn, :and_asgn, :op_asgn
|
19
13
|
].to_set.freeze
|
@@ -21,50 +15,30 @@ module Mutant
|
|
21
15
|
# Set of node types that are not valid when emitted standalone
|
22
16
|
NOT_STANDALONE = [:splat, :restarg, :block_pass].to_set.freeze
|
23
17
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
:<= => :less_than_or_equal_to_operator,
|
30
|
-
:>= => :greater_than_or_equal_to_operator,
|
31
|
-
:== => :equality_operator,
|
32
|
-
:'!~' => :nomatch_operator,
|
33
|
-
:'!=' => :inequality_operator,
|
34
|
-
:=~ => :match_operator,
|
35
|
-
:<< => :left_shift_operator,
|
36
|
-
:>> => :right_shift_operator,
|
37
|
-
:** => :exponentation_operator,
|
38
|
-
:* => :multiplication_operator,
|
39
|
-
:% => :modulo_operator,
|
40
|
-
:/ => :division_operator,
|
41
|
-
:| => :bitwise_or_operator,
|
42
|
-
:^ => :bitwise_xor_operator,
|
43
|
-
:& => :bitwise_and_operator,
|
44
|
-
:< => :less_than_operator,
|
45
|
-
:> => :greater_than_operator,
|
46
|
-
:+ => :addition_operator,
|
47
|
-
:- => :substraction_operator,
|
48
|
-
:~@ => :unary_match_operator,
|
49
|
-
:+@ => :unary_addition_operator,
|
50
|
-
:-@ => :unary_substraction_operator,
|
51
|
-
:'!' => :negation_operator
|
52
|
-
}.freeze
|
18
|
+
# Operators ruby implementeds as methods
|
19
|
+
METHOD_OPERATORS = %w(
|
20
|
+
<=> === []= [] <= >= == !~ != =~ <<
|
21
|
+
>> ** * % / | ^ & < > + - ~@ +@ -@ !
|
22
|
+
).map(&:to_sym).to_set.freeze
|
53
23
|
|
54
|
-
INDEX_OPERATORS = [:[], :[]=].freeze
|
24
|
+
INDEX_OPERATORS = [:[], :[]=].to_set.freeze
|
55
25
|
|
56
|
-
UNARY_METHOD_OPERATORS =
|
57
|
-
|
58
|
-
|
26
|
+
UNARY_METHOD_OPERATORS = %w(
|
27
|
+
~@ +@ -@ !
|
28
|
+
).map(&:to_sym).to_set.freeze
|
59
29
|
|
60
30
|
BINARY_METHOD_OPERATORS = (
|
61
|
-
|
31
|
+
METHOD_OPERATORS - (INDEX_OPERATORS + UNARY_METHOD_OPERATORS)
|
62
32
|
).to_set.freeze
|
63
33
|
|
64
|
-
OPERATOR_METHODS =
|
65
|
-
|
34
|
+
OPERATOR_METHODS = (
|
35
|
+
METHOD_OPERATORS + INDEX_OPERATORS + UNARY_METHOD_OPERATORS
|
36
|
+
).to_set.freeze
|
66
37
|
|
67
|
-
# Hopefully all types parser does generate
|
38
|
+
# Hopefully all node types parser does generate.
|
39
|
+
#
|
40
|
+
# FIXME: Maintain this list only in unparser / parser!
|
41
|
+
#
|
68
42
|
NODE_TYPES = [
|
69
43
|
:lvasgn, :ivasgn, :cvasgn, :gvasgn,
|
70
44
|
:casgn, :masgn, :mlhs, :break, :rescue,
|
data/lib/mutant/version.rb
CHANGED
@@ -70,4 +70,26 @@ describe Mutant::Mutator, 'block' do
|
|
70
70
|
|
71
71
|
it_should_behave_like 'a mutator'
|
72
72
|
end
|
73
|
+
|
74
|
+
context 'with mini block pattern arg' do
|
75
|
+
|
76
|
+
before do
|
77
|
+
Mutant::Random.stub(hex_string: 'random')
|
78
|
+
end
|
79
|
+
|
80
|
+
let(:source) { 'foo { |(a)| }' }
|
81
|
+
|
82
|
+
let(:mutations) do
|
83
|
+
mutations = []
|
84
|
+
mutations << 'foo { || }'
|
85
|
+
mutations << 'foo { |a| }'
|
86
|
+
mutations << 'foo { |(a)| raise }'
|
87
|
+
mutations << 'foo { |(srandom)| }'
|
88
|
+
mutations << 'foo'
|
89
|
+
mutations << 'nil'
|
90
|
+
end
|
91
|
+
|
92
|
+
it_should_behave_like 'a mutator'
|
93
|
+
|
94
|
+
end
|
73
95
|
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.rc5
|
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-12-
|
11
|
+
date: 2013-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|