mutant 0.5.15 → 0.5.16

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
  SHA1:
3
- metadata.gz: 7719c9ed5bb595d9b8d454c41e5943105e8b28ce
4
- data.tar.gz: 7f1760d8ea3f9ca24d57ffcd6d5f422d8e2559be
3
+ metadata.gz: 9eae77be848852158b71548e280781bfb5a4dd55
4
+ data.tar.gz: 05c57b8131bbbc16f7284c6528a075f84e8efc21
5
5
  SHA512:
6
- metadata.gz: bb4176e8b2c072f4e4196bdee1b034b23a4de52e7e9a88d903ec68b2f8338ec8c122d1c37af71834eac71afa1c94abbdc098ea8c493302ce7e13f95aa62fe52a
7
- data.tar.gz: b7fac720483acddbc0d91f5288a008c8b465b888f481ff518693fe1aa6004be09397bf8f3136b7e747c0b45c2d4f34e9ced634e9b3d20c6eabac3d6f27152170
6
+ metadata.gz: 046f7c2d99e04971d914eba1761ef5e469b9fd3f62b1a3c61f1897ff4c5c38d6f851a9f72fc436d2a31418d8d64ef24fd2fcbcf97766d7a02e0be84600a2ed22
7
+ data.tar.gz: 87f6eec29d72085a441e1eb678b8287895021ecdfbacdc165b9c867a9d9816fe29a9d738a756bf0cff01fe5b23218eccefd6108db9c264a3bbaeb55ae1eec2e3
data/Changelog.md CHANGED
@@ -1,3 +1,13 @@
1
+ # v0.5.16 2014-05-27
2
+
3
+ Changes:
4
+
5
+ * Fix granularity of test selection under rspec
6
+ * Add mutation from [item] to item
7
+ * Add mutation from #reverse_each to #each
8
+ * Add mutation from #reverse_map to #each, #map
9
+ * Add mutation from #map to #each
10
+
1
11
  # v0.5.15 2014-05-24
2
12
 
3
13
  Changes:
data/config/flay.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  ---
2
2
  threshold: 18
3
- total_score: 791
3
+ total_score: 794
data/lib/mutant.rb CHANGED
@@ -50,7 +50,7 @@ module Mutant
50
50
  # @api private
51
51
  #
52
52
  def self.isolate(&block)
53
- reader, writer = IO.pipe.map(&:binmode)
53
+ reader, writer = IO.pipe.each(&:binmode)
54
54
 
55
55
  pid = fork do
56
56
  reader.close
@@ -21,6 +21,9 @@ module Mutant
21
21
  emit_nil
22
22
  emit_self
23
23
  mutate_body
24
+ if children.one?
25
+ emit(children.first)
26
+ end
24
27
  end
25
28
 
26
29
  # Mutate body
@@ -12,10 +12,13 @@ module Mutant
12
12
  children :receiver, :selector
13
13
 
14
14
  SELECTOR_REPLACEMENTS = IceNine.deep_freeze(
15
- send: [:public_send],
16
- gsub: [:sub],
17
- eql?: [:equal?],
18
- :== => [:eql?, :equal?]
15
+ reverse_map: [:map, :each],
16
+ reverse_each: [:each],
17
+ map: [:each],
18
+ send: [:public_send],
19
+ gsub: [:sub],
20
+ eql?: [:equal?],
21
+ :== => [:eql?, :equal?]
19
22
  )
20
23
 
21
24
  INDEX_REFERENCE = :[]
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Mutant
4
4
  # The current mutant version
5
- VERSION = '0.5.15'.freeze
5
+ VERSION = '0.5.16'.freeze
6
6
  end # Mutant
@@ -4,13 +4,13 @@ require 'spec_helper'
4
4
 
5
5
  describe 'Mutant on ruby corpus' do
6
6
 
7
- before do
8
- pending 'Unparser is too slow on big files'
9
- end
10
-
11
7
  ROOT = Pathname.new(__FILE__).parent.parent.parent.parent
12
8
 
13
- TMP = ROOT.join('tmp')
9
+ TMP = ROOT.join('tmp').freeze
10
+
11
+ before do
12
+ pending 'Corpus test is deactivated on 1.9.3' if RUBY_VERSION.eql?('1.9.3')
13
+ end
14
14
 
15
15
  class Project
16
16
  include Anima.new(:name, :repo_uri, :exclude)
@@ -25,17 +25,36 @@ describe 'Mutant on ruby corpus' do
25
25
  #
26
26
  def verify
27
27
  checkout
28
+ total = 0
29
+ parse_errors = []
30
+ start = Time.now
28
31
  Pathname.glob(repo_path.join('**/*.rb')).sort.each do |path|
29
32
  puts "Generating mutations for: #{path.to_s}"
30
- node = Parser::CurrentRuby.parse(path.read)
33
+ begin
34
+ node = Parser::CurrentRuby.parse(path.read)
35
+ # Ignore known parser bugs
36
+ rescue ArgumentError, EncodingError
37
+ parse_errors << path
38
+ next
39
+ end
40
+ next if node.nil?
31
41
  count = 0
32
42
  Mutant::Mutator::Node.each(node) do |mutant|
33
43
  count += 1
34
- if (count % 100).zero?
44
+ if (count % 1000).zero?
35
45
  puts count
36
46
  end
37
47
  end
38
48
  puts "Mutations: #{count}"
49
+ total += count
50
+ end
51
+ took = Time.now - start
52
+ puts "Total Mutations/Time/Parse-Errors: %s/%0.2fs/%i - %0.2f/s" % [
53
+ total, took, parse_errors.size, total / took
54
+ ]
55
+ if parse_errors.any?
56
+ puts 'Files with parse errors:'
57
+ parse_errors.each(&method(:puts))
39
58
  end
40
59
  self
41
60
  end
@@ -3,27 +3,45 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe Mutant::Mutator::Node::Literal, 'array' do
6
- let(:source) { '[true, false]' }
7
6
 
8
- let(:mutations) do
9
- mutations = []
7
+ context 'on one item' do
8
+ let(:source) { '[true]' }
10
9
 
11
- # Literal replaced with nil
12
- mutations << 'nil'
10
+ let(:mutations) do
11
+ mutations = []
12
+ mutations << 'nil'
13
+ mutations << 'true'
14
+ mutations << '[false]'
15
+ mutations << '[nil]'
16
+ mutations << '[]'
17
+ end
13
18
 
14
- # Mutation of each element in array
15
- mutations << '[nil, false]'
16
- mutations << '[false, false]'
17
- mutations << '[true, nil]'
18
- mutations << '[true, true]'
19
+ it_should_behave_like 'a mutator'
20
+ end
19
21
 
20
- # Remove each element of array once
21
- mutations << '[true]'
22
- mutations << '[false]'
22
+ context 'on arrays with more than one item' do
23
+ let(:source) { '[true, false]' }
23
24
 
24
- # Empty array
25
- mutations << '[]'
26
- end
25
+ let(:mutations) do
26
+ mutations = []
27
+
28
+ # Literal replaced with nil
29
+ mutations << 'nil'
30
+
31
+ # Mutation of each element in array
32
+ mutations << '[nil, false]'
33
+ mutations << '[false, false]'
34
+ mutations << '[true, nil]'
35
+ mutations << '[true, true]'
27
36
 
28
- it_should_behave_like 'a mutator'
37
+ # Remove each element of array once
38
+ mutations << '[true]'
39
+ mutations << '[false]'
40
+
41
+ # Empty array
42
+ mutations << '[]'
43
+ end
44
+
45
+ it_should_behave_like 'a mutator'
46
+ end
29
47
  end
@@ -5,6 +5,43 @@ require 'spec_helper'
5
5
  # FIXME: This spec needs to be structured better!
6
6
  describe Mutant::Mutator, 'send' do
7
7
 
8
+ context 'when using #reverse_each' do
9
+ let(:source) { 'reverse_each' }
10
+
11
+ let(:mutations) do
12
+ mutations = []
13
+ mutations << 'nil'
14
+ mutations << 'each'
15
+ end
16
+
17
+ it_should_behave_like 'a mutator'
18
+ end
19
+
20
+ context 'when using #reverse_map' do
21
+ let(:source) { 'reverse_map' }
22
+
23
+ let(:mutations) do
24
+ mutations = []
25
+ mutations << 'nil'
26
+ mutations << 'map'
27
+ mutations << 'each'
28
+ end
29
+
30
+ it_should_behave_like 'a mutator'
31
+ end
32
+
33
+ context 'when using #map' do
34
+ let(:source) { 'map' }
35
+
36
+ let(:mutations) do
37
+ mutations = []
38
+ mutations << 'nil'
39
+ mutations << 'each'
40
+ end
41
+
42
+ it_should_behave_like 'a mutator'
43
+ end
44
+
8
45
  context 'when using #==' do
9
46
  let(:source) { 'foo == bar' }
10
47
 
metadata CHANGED
@@ -1,229 +1,229 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mutant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.15
4
+ version: 0.5.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-24 00:00:00.000000000 Z
11
+ date: 2014-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ast
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '2.0'
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
40
  version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: diff-lcs
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.2'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: morpher
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.2.3
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.2.3
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: procto
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
75
  version: 0.0.2
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
82
  version: 0.0.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: abstract_type
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
89
  version: 0.0.7
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.0.7
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: unparser
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ~>
102
102
  - !ruby/object:Gem::Version
103
103
  version: 0.1.12
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ~>
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.1.12
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: ice_nine
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ~>
116
116
  - !ruby/object:Gem::Version
117
117
  version: 0.11.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ~>
123
123
  - !ruby/object:Gem::Version
124
124
  version: 0.11.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: adamantium
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ~>
130
130
  - !ruby/object:Gem::Version
131
131
  version: 0.2.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ~>
137
137
  - !ruby/object:Gem::Version
138
138
  version: 0.2.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: memoizable
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - "~>"
143
+ - - ~>
144
144
  - !ruby/object:Gem::Version
145
145
  version: 0.4.2
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - "~>"
150
+ - - ~>
151
151
  - !ruby/object:Gem::Version
152
152
  version: 0.4.2
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: equalizer
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - "~>"
157
+ - - ~>
158
158
  - !ruby/object:Gem::Version
159
159
  version: 0.0.9
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - "~>"
164
+ - - ~>
165
165
  - !ruby/object:Gem::Version
166
166
  version: 0.0.9
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: inflecto
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - "~>"
171
+ - - ~>
172
172
  - !ruby/object:Gem::Version
173
173
  version: 0.0.2
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - "~>"
178
+ - - ~>
179
179
  - !ruby/object:Gem::Version
180
180
  version: 0.0.2
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: anima
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - "~>"
185
+ - - ~>
186
186
  - !ruby/object:Gem::Version
187
187
  version: 0.2.0
188
188
  type: :runtime
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - "~>"
192
+ - - ~>
193
193
  - !ruby/object:Gem::Version
194
194
  version: 0.2.0
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: concord
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - "~>"
199
+ - - ~>
200
200
  - !ruby/object:Gem::Version
201
201
  version: 0.1.5
202
202
  type: :runtime
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - "~>"
206
+ - - ~>
207
207
  - !ruby/object:Gem::Version
208
208
  version: 0.1.5
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: bundler
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
- - - "~>"
213
+ - - ~>
214
214
  - !ruby/object:Gem::Version
215
215
  version: '1.3'
216
- - - ">="
216
+ - - '>='
217
217
  - !ruby/object:Gem::Version
218
218
  version: 1.3.5
219
219
  type: :development
220
220
  prerelease: false
221
221
  version_requirements: !ruby/object:Gem::Requirement
222
222
  requirements:
223
- - - "~>"
223
+ - - ~>
224
224
  - !ruby/object:Gem::Version
225
225
  version: '1.3'
226
- - - ">="
226
+ - - '>='
227
227
  - !ruby/object:Gem::Version
228
228
  version: 1.3.5
229
229
  description: Mutation testing for ruby
@@ -236,11 +236,11 @@ extra_rdoc_files:
236
236
  - TODO
237
237
  - LICENSE
238
238
  files:
239
- - ".gitignore"
240
- - ".rspec"
241
- - ".rubocop.yml"
242
- - ".ruby-gemset"
243
- - ".travis.yml"
239
+ - .gitignore
240
+ - .rspec
241
+ - .rubocop.yml
242
+ - .ruby-gemset
243
+ - .travis.yml
244
244
  - Changelog.md
245
245
  - Gemfile
246
246
  - Gemfile.devtools
@@ -491,17 +491,17 @@ require_paths:
491
491
  - lib
492
492
  required_ruby_version: !ruby/object:Gem::Requirement
493
493
  requirements:
494
- - - ">="
494
+ - - '>='
495
495
  - !ruby/object:Gem::Version
496
496
  version: 1.9.3
497
497
  required_rubygems_version: !ruby/object:Gem::Requirement
498
498
  requirements:
499
- - - ">="
499
+ - - '>='
500
500
  - !ruby/object:Gem::Version
501
501
  version: '0'
502
502
  requirements: []
503
503
  rubyforge_project:
504
- rubygems_version: 2.2.2
504
+ rubygems_version: 2.0.14
505
505
  signing_key:
506
506
  specification_version: 4
507
507
  summary: Mutation testing tool for ruby under MRI and Rubinius