mutant 0.9.5 → 0.9.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +121 -0
  3. data/.rubocop.yml +203 -0
  4. data/Changelog.md +27 -0
  5. data/Gemfile +0 -7
  6. data/Gemfile.lock +30 -87
  7. data/Gemfile.shared +7 -0
  8. data/README.md +88 -27
  9. data/config/reek.yml +1 -0
  10. data/lib/mutant.rb +5 -3
  11. data/lib/mutant/ast.rb +0 -9
  12. data/lib/mutant/ast/find_metaclass_containing.rb +48 -0
  13. data/lib/mutant/ast/meta/send.rb +0 -6
  14. data/lib/mutant/bootstrap.rb +0 -36
  15. data/lib/mutant/cli.rb +5 -49
  16. data/lib/mutant/config.rb +0 -8
  17. data/lib/mutant/context.rb +0 -3
  18. data/lib/mutant/env.rb +0 -6
  19. data/lib/mutant/expression/method.rb +6 -6
  20. data/lib/mutant/expression/methods.rb +6 -6
  21. data/lib/mutant/expression/parser.rb +0 -6
  22. data/lib/mutant/integration.rb +0 -18
  23. data/lib/mutant/isolation/fork.rb +0 -22
  24. data/lib/mutant/license.rb +12 -1
  25. data/lib/mutant/matcher.rb +0 -14
  26. data/lib/mutant/matcher/config.rb +0 -11
  27. data/lib/mutant/matcher/method.rb +0 -31
  28. data/lib/mutant/matcher/method/instance.rb +0 -8
  29. data/lib/mutant/matcher/method/metaclass.rb +86 -0
  30. data/lib/mutant/matcher/method/singleton.rb +0 -25
  31. data/lib/mutant/matcher/methods.rb +17 -28
  32. data/lib/mutant/matcher/namespace.rb +0 -10
  33. data/lib/mutant/matcher/scope.rb +2 -4
  34. data/lib/mutant/meta/example/dsl.rb +0 -21
  35. data/lib/mutant/meta/example/verification.rb +0 -20
  36. data/lib/mutant/mutation.rb +0 -3
  37. data/lib/mutant/mutator.rb +1 -29
  38. data/lib/mutant/mutator/node.rb +1 -66
  39. data/lib/mutant/mutator/node/and_asgn.rb +0 -3
  40. data/lib/mutant/mutator/node/argument.rb +0 -15
  41. data/lib/mutant/mutator/node/arguments.rb +0 -20
  42. data/lib/mutant/mutator/node/begin.rb +0 -3
  43. data/lib/mutant/mutator/node/binary.rb +0 -23
  44. data/lib/mutant/mutator/node/block.rb +0 -15
  45. data/lib/mutant/mutator/node/break.rb +0 -3
  46. data/lib/mutant/mutator/node/case.rb +0 -9
  47. data/lib/mutant/mutator/node/class.rb +0 -3
  48. data/lib/mutant/mutator/node/conditional_loop.rb +0 -3
  49. data/lib/mutant/mutator/node/const.rb +0 -3
  50. data/lib/mutant/mutator/node/define.rb +0 -11
  51. data/lib/mutant/mutator/node/defined.rb +0 -3
  52. data/lib/mutant/mutator/node/dstr.rb +0 -3
  53. data/lib/mutant/mutator/node/dsym.rb +0 -3
  54. data/lib/mutant/mutator/node/generic.rb +0 -67
  55. data/lib/mutant/mutator/node/if.rb +0 -12
  56. data/lib/mutant/mutator/node/index.rb +0 -27
  57. data/lib/mutant/mutator/node/kwbegin.rb +0 -3
  58. data/lib/mutant/mutator/node/literal.rb +0 -3
  59. data/lib/mutant/mutator/node/literal/array.rb +0 -6
  60. data/lib/mutant/mutator/node/literal/boolean.rb +0 -4
  61. data/lib/mutant/mutator/node/literal/float.rb +0 -9
  62. data/lib/mutant/mutator/node/literal/hash.rb +0 -9
  63. data/lib/mutant/mutator/node/literal/integer.rb +0 -9
  64. data/lib/mutant/mutator/node/literal/nil.rb +0 -3
  65. data/lib/mutant/mutator/node/literal/range.rb +1 -7
  66. data/lib/mutant/mutator/node/literal/regex.rb +0 -6
  67. data/lib/mutant/mutator/node/literal/string.rb +0 -3
  68. data/lib/mutant/mutator/node/literal/symbol.rb +0 -3
  69. data/lib/mutant/mutator/node/masgn.rb +0 -3
  70. data/lib/mutant/mutator/node/match_current_line.rb +0 -3
  71. data/lib/mutant/mutator/node/mlhs.rb +0 -3
  72. data/lib/mutant/mutator/node/named_value/access.rb +2 -14
  73. data/lib/mutant/mutator/node/named_value/constant_assignment.rb +0 -9
  74. data/lib/mutant/mutator/node/named_value/variable_assignment.rb +0 -6
  75. data/lib/mutant/mutator/node/next.rb +0 -3
  76. data/lib/mutant/mutator/node/noop.rb +0 -3
  77. data/lib/mutant/mutator/node/nthref.rb +0 -3
  78. data/lib/mutant/mutator/node/op_asgn.rb +0 -3
  79. data/lib/mutant/mutator/node/or_asgn.rb +0 -3
  80. data/lib/mutant/mutator/node/procarg_zero.rb +0 -3
  81. data/lib/mutant/mutator/node/regopt.rb +0 -6
  82. data/lib/mutant/mutator/node/resbody.rb +0 -6
  83. data/lib/mutant/mutator/node/rescue.rb +2 -19
  84. data/lib/mutant/mutator/node/return.rb +0 -3
  85. data/lib/mutant/mutator/node/sclass.rb +20 -0
  86. data/lib/mutant/mutator/node/send.rb +2 -61
  87. data/lib/mutant/mutator/node/send/attribute_assignment.rb +0 -9
  88. data/lib/mutant/mutator/node/send/binary.rb +0 -11
  89. data/lib/mutant/mutator/node/send/conditional.rb +0 -3
  90. data/lib/mutant/mutator/node/splat.rb +0 -3
  91. data/lib/mutant/mutator/node/super.rb +0 -3
  92. data/lib/mutant/mutator/node/when.rb +0 -19
  93. data/lib/mutant/mutator/node/yield.rb +0 -3
  94. data/lib/mutant/mutator/node/zsuper.rb +0 -3
  95. data/lib/mutant/mutator/util/array.rb +0 -6
  96. data/lib/mutant/mutator/util/symbol.rb +0 -3
  97. data/lib/mutant/parallel.rb +0 -13
  98. data/lib/mutant/parallel/driver.rb +0 -10
  99. data/lib/mutant/parallel/worker.rb +0 -22
  100. data/lib/mutant/registry.rb +2 -7
  101. data/lib/mutant/reporter/cli.rb +0 -5
  102. data/lib/mutant/reporter/cli/format.rb +0 -9
  103. data/lib/mutant/reporter/cli/printer.rb +2 -42
  104. data/lib/mutant/reporter/cli/printer/env_progress.rb +0 -15
  105. data/lib/mutant/reporter/cli/printer/isolation_result.rb +0 -18
  106. data/lib/mutant/reporter/cli/printer/mutation_progress_result.rb +0 -5
  107. data/lib/mutant/reporter/cli/printer/mutation_result.rb +1 -22
  108. data/lib/mutant/reporter/cli/printer/status_progressive.rb +0 -8
  109. data/lib/mutant/reporter/cli/printer/subject_progress.rb +0 -9
  110. data/lib/mutant/repository/diff.rb +1 -13
  111. data/lib/mutant/repository/diff/ranges.rb +0 -11
  112. data/lib/mutant/result.rb +0 -3
  113. data/lib/mutant/runner.rb +0 -18
  114. data/lib/mutant/runner/sink.rb +0 -5
  115. data/lib/mutant/subject.rb +0 -8
  116. data/lib/mutant/subject/method.rb +0 -3
  117. data/lib/mutant/subject/method/instance.rb +40 -6
  118. data/lib/mutant/subject/method/metaclass.rb +30 -0
  119. data/lib/mutant/transform.rb +0 -92
  120. data/lib/mutant/version.rb +1 -1
  121. data/lib/mutant/warnings.rb +0 -6
  122. data/lib/mutant/zombifier.rb +2 -34
  123. data/meta/and.rb +0 -2
  124. data/meta/array.rb +0 -3
  125. data/meta/begin.rb +0 -3
  126. data/meta/block.rb +0 -3
  127. data/meta/break.rb +0 -1
  128. data/meta/case.rb +0 -6
  129. data/meta/casgn.rb +0 -3
  130. data/meta/cvasgn.rb +0 -1
  131. data/meta/def.rb +0 -7
  132. data/meta/ensure.rb +0 -1
  133. data/meta/false.rb +0 -1
  134. data/meta/gvasgn.rb +0 -1
  135. data/meta/hash.rb +0 -4
  136. data/meta/if.rb +0 -5
  137. data/meta/ivasgn.rb +0 -1
  138. data/meta/kwbegin.rb +0 -1
  139. data/meta/lvasgn.rb +0 -1
  140. data/meta/match_current_line.rb +0 -1
  141. data/meta/next.rb +0 -1
  142. data/meta/or.rb +0 -2
  143. data/meta/range.rb +26 -0
  144. data/meta/regexp.rb +0 -1
  145. data/meta/rescue.rb +0 -6
  146. data/meta/sclass.rb +12 -0
  147. data/meta/send.rb +0 -4
  148. data/meta/true.rb +0 -1
  149. data/meta/until.rb +0 -1
  150. data/meta/while.rb +0 -2
  151. data/meta/yield.rb +0 -1
  152. data/mutant.gemspec +8 -4
  153. data/mutant.sh +12 -0
  154. data/spec/integrations.yml +3 -1
  155. data/spec/spec_helper.rb +37 -22
  156. data/spec/unit/mutant/ast/find_metaclass_containing_spec.rb +64 -0
  157. data/spec/unit/mutant/expression/methods_spec.rb +7 -2
  158. data/spec/unit/mutant/license_spec.rb +17 -5
  159. data/spec/unit/mutant/matcher/method/metaclass_spec.rb +108 -0
  160. data/spec/unit/mutant/matcher/methods/metaclass_spec.rb +62 -0
  161. data/spec/unit/mutant/matcher/namespace_spec.rb +3 -1
  162. data/spec/unit/mutant/matcher/scope_spec.rb +11 -1
  163. data/spec/unit/mutant/meta/example_spec.rb +3 -3
  164. data/spec/unit/mutant/mutator/node_spec.rb +1 -6
  165. data/spec/unit/mutant/parallel/driver_spec.rb +4 -4
  166. data/spec/unit/mutant/parallel/worker_spec.rb +5 -5
  167. data/spec/unit/mutant/parallel_spec.rb +7 -7
  168. data/spec/unit/mutant/registry_spec.rb +52 -25
  169. data/spec/unit/mutant/reporter/cli/printer/env_result_spec.rb +1 -1
  170. data/spec/unit/mutant/reporter/cli/printer/mutation_progress_result_spec.rb +2 -2
  171. data/spec/unit/mutant/reporter/cli/printer/mutation_result_spec.rb +12 -12
  172. data/spec/unit/mutant/reporter/cli/printer/subject_result_spec.rb +1 -1
  173. data/spec/unit/mutant/reporter/cli/printer_spec.rb +4 -4
  174. data/spec/unit/mutant/reporter/cli_spec.rb +1 -1
  175. data/spec/unit/mutant/subject/method/instance_spec.rb +117 -22
  176. data/spec/unit/mutant/subject/method/metaclass_spec.rb +63 -0
  177. data/test_app/Gemfile.minitest +2 -0
  178. data/test_app/lib/test_app.rb +5 -0
  179. data/test_app/lib/test_app/metaclasses.rb +108 -0
  180. metadata +85 -25
  181. data/.circleci/config.yml +0 -53
  182. data/config/rubocop.yml +0 -205
  183. data/lib/mutant/color.rb +0 -43
  184. data/lib/mutant/diff.rb +0 -114
  185. data/lib/mutant/variable.rb +0 -282
  186. data/spec/shared/base_behavior.rb +0 -45
  187. data/spec/support/test_app.rb +0 -7
  188. data/spec/support/warnings.yml +0 -6
  189. data/spec/unit/mutant/diff_spec.rb +0 -189
  190. data/spec/unit/mutant/variable_spec.rb +0 -618
@@ -116,7 +116,7 @@ RSpec.describe Mutant::Reporter::CLI do
116
116
  let(:tty?) { true }
117
117
 
118
118
  # rubocop:disable Metrics/LineLength
119
- it_reports Mutant::Color::GREEN.format('progress: 00/02 alive: 0 runtime: 4.00s killtime: 0.00s mutations/s: 0.00') + "\n"
119
+ it_reports Unparser::Color::GREEN.format('progress: 00/02 alive: 0 runtime: 4.00s killtime: 0.00s mutations/s: 0.00') + "\n"
120
120
  # rubocop:enable Metrics/LineLength
121
121
  end
122
122
 
@@ -62,10 +62,6 @@ RSpec.describe Mutant::Subject::Method::Instance do
62
62
  end
63
63
 
64
64
  describe '#prepare' do
65
- let(:context) do
66
- Mutant::Context.new(scope, instance_double(Pathname))
67
- end
68
-
69
65
  subject { object.prepare }
70
66
 
71
67
  it 'undefines method on scope' do
@@ -104,7 +100,10 @@ RSpec.describe Mutant::Subject::Method::Instance::Memoized do
104
100
  )
105
101
  end
106
102
 
107
- let(:context) { double('Context') }
103
+ let(:context) do
104
+ Mutant::Context.new(scope, double('Source Path'))
105
+ end
106
+
108
107
  let(:warnings) { instance_double(Mutant::Warnings) }
109
108
 
110
109
  let(:node) do
@@ -115,12 +114,7 @@ RSpec.describe Mutant::Subject::Method::Instance::Memoized do
115
114
  allow(warnings).to receive(:call).and_yield
116
115
  end
117
116
 
118
- describe '#prepare' do
119
-
120
- let(:context) do
121
- Mutant::Context.new(scope, double('Source Path'))
122
- end
123
-
117
+ shared_context 'memoizable scope setup' do
124
118
  let(:scope) do
125
119
  Class.new do
126
120
  include Memoizable
@@ -128,6 +122,23 @@ RSpec.describe Mutant::Subject::Method::Instance::Memoized do
128
122
  memoize :foo
129
123
  end
130
124
  end
125
+ end
126
+
127
+ shared_context 'adamantium scope setup' do
128
+ let(:scope) do
129
+ memoize_options = self.memoize_options
130
+ memoize_provider = self.memoize_provider
131
+
132
+ Class.new do
133
+ include memoize_provider
134
+ def foo; end
135
+ memoize :foo, **memoize_options
136
+ end
137
+ end
138
+ end
139
+
140
+ describe '#prepare' do
141
+ include_context 'memoizable scope setup'
131
142
 
132
143
  subject { object.prepare }
133
144
 
@@ -142,40 +153,124 @@ RSpec.describe Mutant::Subject::Method::Instance::Memoized do
142
153
  it_should_behave_like 'a command method'
143
154
  end
144
155
 
145
- describe '#mutations', mutant_expression: 'Mutant::Subject#mutations' do
156
+ describe '#mutations' do
146
157
  subject { object.mutations }
147
158
 
148
159
  let(:expected) do
149
160
  [
150
161
  Mutant::Mutation::Neutral.new(
151
162
  object,
152
- s(:begin,
153
- s(:def, :foo, s(:args)), s(:send, nil, :memoize, s(:args, s(:sym, :foo))))
163
+ s(:begin, s(:def, :foo, s(:args)), memoize_node)
154
164
  ),
155
165
  Mutant::Mutation::Evil.new(
156
166
  object,
157
- s(:begin,
158
- s(:def, :foo, s(:args), s(:send, nil, :raise)), s(:send, nil, :memoize, s(:args, s(:sym, :foo))))
167
+ s(:begin, s(:def, :foo, s(:args), s(:send, nil, :raise)), memoize_node)
159
168
  ),
160
169
  Mutant::Mutation::Evil.new(
161
170
  object,
162
- s(:begin,
163
- s(:def, :foo, s(:args), s(:zsuper)), s(:send, nil, :memoize, s(:args, s(:sym, :foo))))
171
+ s(:begin, s(:def, :foo, s(:args), s(:zsuper)), memoize_node)
164
172
  ),
165
173
  Mutant::Mutation::Evil.new(
166
174
  object,
167
- s(:begin,
168
- s(:def, :foo, s(:args), nil), s(:send, nil, :memoize, s(:args, s(:sym, :foo))))
175
+ s(:begin, s(:def, :foo, s(:args), nil), memoize_node)
169
176
  )
170
177
  ]
171
178
  end
172
179
 
173
- it { should eql(expected) }
180
+ let(:memoize_node) do
181
+ s(:send, nil, :memoize, s(:args, s(:sym, :foo), *options_node))
182
+ end
183
+
184
+ let(:options_node) { nil }
185
+
186
+ context 'when Memoizable is included in scope' do
187
+ include_context 'memoizable scope setup'
188
+
189
+ it { should eql(expected) }
190
+ end
191
+
192
+ context 'when Adamantium is included in scope' do
193
+ include_context 'adamantium scope setup'
194
+
195
+ {
196
+ Adamantium => :deep,
197
+ Adamantium::Flat => :flat
198
+ }.each do |memoize_provider, default_freezer_option|
199
+ context "as include #{memoize_provider}" do
200
+ let(:memoize_provider) { memoize_provider }
201
+ let(:default_freezer_option) { default_freezer_option }
202
+
203
+ let(:options_node) do
204
+ [s(:hash, s(:pair, s(:sym, :freezer), s(:sym, freezer_option)))]
205
+ end
206
+
207
+ context 'when no memoize options are given' do
208
+ let(:memoize_options) { Mutant::EMPTY_HASH }
209
+ let(:freezer_option) { default_freezer_option }
210
+
211
+ it { should eql(expected) }
212
+ end
213
+
214
+ context 'when memoize options are given' do
215
+ let(:memoize_options) { { freezer: freezer_option } }
216
+
217
+ %i[deep flat noop].each do |option|
218
+ context "as #{option.inspect}" do
219
+ let(:freezer_option) { option }
220
+
221
+ it { should eql(expected) }
222
+ end
223
+ end
224
+ end
225
+ end
226
+ end
227
+ end
174
228
  end
175
229
 
176
230
  describe '#source' do
177
231
  subject { object.source }
178
232
 
179
- it { should eql("def foo\nend\nmemoize(:foo)") }
233
+ context 'when Memoizable is included in scope' do
234
+ include_context 'memoizable scope setup'
235
+
236
+ let(:source) { "def foo\nend\nmemoize(:foo)" }
237
+
238
+ it { should eql(source) }
239
+ end
240
+
241
+ context 'when Adamantium is included in scope' do
242
+ include_context 'adamantium scope setup'
243
+
244
+ let(:source) do
245
+ "def foo\nend\nmemoize(:foo, { freezer: #{freezer_option.inspect} })"
246
+ end
247
+
248
+ {
249
+ Adamantium => :deep,
250
+ Adamantium::Flat => :flat
251
+ }.each do |memoize_provider, default_freezer_option|
252
+ context "as include #{memoize_provider}" do
253
+ let(:memoize_provider) { memoize_provider }
254
+
255
+ context 'when no memoize options are given' do
256
+ let(:memoize_options) { Mutant::EMPTY_HASH }
257
+ let(:freezer_option) { default_freezer_option }
258
+
259
+ it { should eql(source) }
260
+ end
261
+
262
+ context 'when memoize options are given' do
263
+ %i[deep flat noop].each do |freezer_option|
264
+ context "as #{freezer_option.inspect}" do
265
+ let(:memoize_options) { { freezer: freezer_option } }
266
+ let(:freezer_option) { freezer_option }
267
+
268
+ it { should eql(source) }
269
+ end
270
+ end
271
+ end
272
+ end
273
+ end
274
+ end
180
275
  end
181
276
  end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Mutant::Subject::Method::Metaclass do
4
+ let(:object) do
5
+ described_class.new(
6
+ context: context,
7
+ node: node,
8
+ warnings: warnings
9
+ )
10
+ end
11
+
12
+ let(:node) { s(:def, :foo, s(:args)) }
13
+ let(:warnings) { instance_double(Mutant::Warnings) }
14
+
15
+ let(:context) do
16
+ Mutant::Context.new(scope, instance_double(Pathname))
17
+ end
18
+
19
+ let(:scope) do
20
+ Class.new do
21
+ class << self
22
+ def foo; end
23
+
24
+ def name
25
+ 'Test'
26
+ end
27
+ end
28
+ end
29
+ end
30
+
31
+ describe '#expression' do
32
+ subject { object.expression }
33
+
34
+ it { should eql(parse_expression('Test.foo')) }
35
+
36
+ it_should_behave_like 'an idempotent method'
37
+ end
38
+
39
+ describe '#match_expression' do
40
+ subject { object.match_expressions }
41
+
42
+ it { should eql(%w[Test.foo Test*].map(&method(:parse_expression))) }
43
+
44
+ it_should_behave_like 'an idempotent method'
45
+ end
46
+
47
+ describe '#prepare' do
48
+
49
+ subject { object.prepare }
50
+
51
+ it 'undefines method on scope' do
52
+ expect { subject }.to change { scope.methods.include?(:foo) }.from(true).to(false)
53
+ end
54
+
55
+ it_should_behave_like 'a command method'
56
+ end
57
+
58
+ describe '#source' do
59
+ subject { object.source }
60
+
61
+ it { should eql("class << self\n def foo\n end\nend") }
62
+ end
63
+ end
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'mutant', path: '../'
4
4
  gem 'mutant-minitest', path: '../'
5
+
6
+ eval_gemfile File.expand_path('../../Gemfile.shared', __FILE__)
@@ -103,7 +103,12 @@ module TestApp
103
103
  end
104
104
  end
105
105
  end
106
+
107
+ def self.root
108
+ File.expand_path('..', __dir__)
109
+ end
106
110
  end
107
111
 
112
+ require 'test_app/metaclasses'
108
113
  require 'test_app/literal'
109
114
  $VERBOSE = original
@@ -0,0 +1,108 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TestApp
4
+ module MetaclassMethodTests
5
+ module DefinedOnSelf
6
+ class << self
7
+ def foo; end
8
+ end
9
+
10
+ # again this is a weird edge-case that's being checked for consistent
11
+ # behaviour, not something that people ought to be doing.
12
+ module InsideMetaclass
13
+ class << self
14
+ # some older versions of ruby don't have Object#singleton_class,
15
+ # this is just an implementation of that so we can grab
16
+ # InsideMetaclass.metaclass for use as the scope object
17
+ def metaclass
18
+ class << self
19
+ self
20
+ end
21
+ end
22
+
23
+ # InsideMetaclass.foo
24
+ def foo; end
25
+
26
+ class << self
27
+ # #<Class:InsideMetaclass>.foo
28
+ def foo; end
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ module DefinedOnLvar
35
+ a = self
36
+ class << a
37
+ def foo; end
38
+ end
39
+ end
40
+
41
+ module DefinedOnConstant
42
+ module InsideNamespace
43
+ class << InsideNamespace
44
+ def foo; end
45
+ end
46
+ end
47
+
48
+ module OutsideNamespace
49
+ end
50
+
51
+ class << OutsideNamespace
52
+ def foo
53
+ end
54
+ end
55
+ end
56
+
57
+ module DefinedMultipleTimes
58
+ module DifferentLines
59
+ class << self
60
+ def foo
61
+ end
62
+
63
+ def foo(_arg)
64
+ end
65
+ end
66
+ end
67
+
68
+ module SameLine
69
+ module SameScope
70
+ class << self
71
+ def foo; end; def foo(_arg); end
72
+ end
73
+ end
74
+
75
+ module DifferentScope
76
+ class << self; def foo; end; end; class << DifferentScope; def foo(_arg); end; end; class << MetaclassMethodTests; def foo; end; end
77
+ end
78
+
79
+ module DifferentName
80
+ class << self; def foo; end; def bar(_arg); end; end
81
+ end
82
+ end
83
+ end
84
+
85
+ module NotActuallyInAMetaclass
86
+ class << self
87
+ # some older versions of ruby don't have Object#singleton_class,
88
+ # this is just an implementation of that so we can grab
89
+ # InsideMetaclass.metaclass for use as the scope object
90
+ def metaclass
91
+ class << self
92
+ self
93
+ end
94
+ end
95
+
96
+ # this is a very weird construction that I do not recommend.
97
+ # to access SomeClass you have to do
98
+ # NotActuallyInAMetaclass.singleton_class::SomeClass. Very weird
99
+ # This is only here so we can test that metaclass_receiver? correctly
100
+ # returns false
101
+ class SomeClass
102
+ def foo
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
108
+ 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.9.5
4
+ version: 0.9.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-02 00:00:00.000000000 Z
11
+ date: 2020-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: abstract_type
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 2.7.0.2
159
+ version: 2.7.1
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
- version: 2.7.0.2
166
+ version: 2.7.1
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: procto
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -184,28 +184,28 @@ dependencies:
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: 0.4.6
187
+ version: 0.4.8
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
- version: 0.4.6
194
+ version: 0.4.8
195
195
  - !ruby/object:Gem::Dependency
196
- name: devtools
196
+ name: variable
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: 0.1.25
202
- type: :development
201
+ version: 0.0.1
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
- version: 0.1.25
208
+ version: 0.0.1
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: parallel
211
211
  requirement: !ruby/object:Gem::Requirement
@@ -220,6 +220,62 @@ dependencies:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
222
  version: '1.3'
223
+ - !ruby/object:Gem::Dependency
224
+ name: rspec
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - "~>"
228
+ - !ruby/object:Gem::Version
229
+ version: '3.9'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - "~>"
235
+ - !ruby/object:Gem::Version
236
+ version: '3.9'
237
+ - !ruby/object:Gem::Dependency
238
+ name: rspec-core
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - "~>"
242
+ - !ruby/object:Gem::Version
243
+ version: '3.9'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - "~>"
249
+ - !ruby/object:Gem::Version
250
+ version: '3.9'
251
+ - !ruby/object:Gem::Dependency
252
+ name: rspec-its
253
+ requirement: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - "~>"
256
+ - !ruby/object:Gem::Version
257
+ version: 1.2.0
258
+ type: :development
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - "~>"
263
+ - !ruby/object:Gem::Version
264
+ version: 1.2.0
265
+ - !ruby/object:Gem::Dependency
266
+ name: rubocop
267
+ requirement: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - "~>"
270
+ - !ruby/object:Gem::Version
271
+ version: 0.79.0
272
+ type: :development
273
+ prerelease: false
274
+ version_requirements: !ruby/object:Gem::Requirement
275
+ requirements:
276
+ - - "~>"
277
+ - !ruby/object:Gem::Version
278
+ version: 0.79.0
223
279
  description: Mutation Testing for Ruby.
224
280
  email:
225
281
  - mbj@schirp-dso.com
@@ -229,7 +285,7 @@ extensions: []
229
285
  extra_rdoc_files:
230
286
  - LICENSE
231
287
  files:
232
- - ".circleci/config.yml"
288
+ - ".github/workflows/ci.yml"
233
289
  - ".gitignore"
234
290
  - ".rspec"
235
291
  - ".rubocop.yml"
@@ -243,7 +299,6 @@ files:
243
299
  - bin/mutant
244
300
  - config/devtools.yml
245
301
  - config/reek.yml
246
- - config/rubocop.yml
247
302
  - config/yardstick.yml
248
303
  - docs/commercial-support.md
249
304
  - docs/concurrency.md
@@ -256,6 +311,7 @@ files:
256
311
  - docs/reading-reports.md
257
312
  - lib/mutant.rb
258
313
  - lib/mutant/ast.rb
314
+ - lib/mutant/ast/find_metaclass_containing.rb
259
315
  - lib/mutant/ast/meta.rb
260
316
  - lib/mutant/ast/meta/const.rb
261
317
  - lib/mutant/ast/meta/optarg.rb
@@ -269,10 +325,8 @@ files:
269
325
  - lib/mutant/ast/types.rb
270
326
  - lib/mutant/bootstrap.rb
271
327
  - lib/mutant/cli.rb
272
- - lib/mutant/color.rb
273
328
  - lib/mutant/config.rb
274
329
  - lib/mutant/context.rb
275
- - lib/mutant/diff.rb
276
330
  - lib/mutant/env.rb
277
331
  - lib/mutant/expression.rb
278
332
  - lib/mutant/expression/method.rb
@@ -295,6 +349,7 @@ files:
295
349
  - lib/mutant/matcher/filter.rb
296
350
  - lib/mutant/matcher/method.rb
297
351
  - lib/mutant/matcher/method/instance.rb
352
+ - lib/mutant/matcher/method/metaclass.rb
298
353
  - lib/mutant/matcher/method/singleton.rb
299
354
  - lib/mutant/matcher/methods.rb
300
355
  - lib/mutant/matcher/namespace.rb
@@ -354,6 +409,7 @@ files:
354
409
  - lib/mutant/mutator/node/resbody.rb
355
410
  - lib/mutant/mutator/node/rescue.rb
356
411
  - lib/mutant/mutator/node/return.rb
412
+ - lib/mutant/mutator/node/sclass.rb
357
413
  - lib/mutant/mutator/node/send.rb
358
414
  - lib/mutant/mutator/node/send/attribute_assignment.rb
359
415
  - lib/mutant/mutator/node/send/binary.rb
@@ -404,12 +460,12 @@ files:
404
460
  - lib/mutant/subject.rb
405
461
  - lib/mutant/subject/method.rb
406
462
  - lib/mutant/subject/method/instance.rb
463
+ - lib/mutant/subject/method/metaclass.rb
407
464
  - lib/mutant/subject/method/singleton.rb
408
465
  - lib/mutant/test.rb
409
466
  - lib/mutant/timer.rb
410
467
  - lib/mutant/transform.rb
411
468
  - lib/mutant/util.rb
412
- - lib/mutant/variable.rb
413
469
  - lib/mutant/version.rb
414
470
  - lib/mutant/warnings.rb
415
471
  - lib/mutant/zombifier.rb
@@ -468,6 +524,7 @@ files:
468
524
  - meta/regopt.rb
469
525
  - meta/rescue.rb
470
526
  - meta/return.rb
527
+ - meta/sclass.rb
471
528
  - meta/self.rb
472
529
  - meta/send.rb
473
530
  - meta/str.rb
@@ -480,6 +537,7 @@ files:
480
537
  - mutant-minitest.gemspec
481
538
  - mutant-rspec.gemspec
482
539
  - mutant.gemspec
540
+ - mutant.sh
483
541
  - mutant.yml
484
542
  - spec/integration/mutant/corpus_spec.rb
485
543
  - spec/integration/mutant/isolation/fork_spec.rb
@@ -488,7 +546,6 @@ files:
488
546
  - spec/integration/mutant/rspec_spec.rb
489
547
  - spec/integration/mutant/test_mutator_handles_types_spec.rb
490
548
  - spec/integrations.yml
491
- - spec/shared/base_behavior.rb
492
549
  - spec/shared/framework_integration_behavior.rb
493
550
  - spec/shared/method_matcher_behavior.rb
494
551
  - spec/spec_helper.rb
@@ -497,9 +554,8 @@ files:
497
554
  - spec/support/ice_nine_config.rb
498
555
  - spec/support/ruby_vm.rb
499
556
  - spec/support/shared_context.rb
500
- - spec/support/test_app.rb
501
- - spec/support/warnings.yml
502
557
  - spec/support/xspec.rb
558
+ - spec/unit/mutant/ast/find_metaclass_containing_spec.rb
503
559
  - spec/unit/mutant/ast/meta/optarg_spec.rb
504
560
  - spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb
505
561
  - spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb
@@ -512,7 +568,6 @@ files:
512
568
  - spec/unit/mutant/clock_monotonic_spec.rb
513
569
  - spec/unit/mutant/config_spec.rb
514
570
  - spec/unit/mutant/context_spec.rb
515
- - spec/unit/mutant/diff_spec.rb
516
571
  - spec/unit/mutant/env_spec.rb
517
572
  - spec/unit/mutant/expression/method_spec.rb
518
573
  - spec/unit/mutant/expression/methods_spec.rb
@@ -532,8 +587,10 @@ files:
532
587
  - spec/unit/mutant/matcher/config_spec.rb
533
588
  - spec/unit/mutant/matcher/filter_spec.rb
534
589
  - spec/unit/mutant/matcher/method/instance_spec.rb
590
+ - spec/unit/mutant/matcher/method/metaclass_spec.rb
535
591
  - spec/unit/mutant/matcher/method/singleton_spec.rb
536
592
  - spec/unit/mutant/matcher/methods/instance_spec.rb
593
+ - spec/unit/mutant/matcher/methods/metaclass_spec.rb
537
594
  - spec/unit/mutant/matcher/methods/singleton_spec.rb
538
595
  - spec/unit/mutant/matcher/namespace_spec.rb
539
596
  - spec/unit/mutant/matcher/null_spec.rb
@@ -582,6 +639,7 @@ files:
582
639
  - spec/unit/mutant/selector/expression_spec.rb
583
640
  - spec/unit/mutant/selector/null_spec.rb
584
641
  - spec/unit/mutant/subject/method/instance_spec.rb
642
+ - spec/unit/mutant/subject/method/metaclass_spec.rb
585
643
  - spec/unit/mutant/subject/method/singleton_spec.rb
586
644
  - spec/unit/mutant/subject_spec.rb
587
645
  - spec/unit/mutant/transform/array_spec.rb
@@ -594,7 +652,6 @@ files:
594
652
  - spec/unit/mutant/transform/primitive_spec.rb
595
653
  - spec/unit/mutant/transform/sequence_spec.rb
596
654
  - spec/unit/mutant/util/one_spec.rb
597
- - spec/unit/mutant/variable_spec.rb
598
655
  - spec/unit/mutant/warnings_spec.rb
599
656
  - spec/unit/mutant/world_spec.rb
600
657
  - spec/unit/mutant/zombifier_spec.rb
@@ -603,6 +660,7 @@ files:
603
660
  - test_app/Gemfile.rspec3.8
604
661
  - test_app/lib/test_app.rb
605
662
  - test_app/lib/test_app/literal.rb
663
+ - test_app/lib/test_app/metaclasses.rb
606
664
  - test_app/spec/spec_helper.rb
607
665
  - test_app/spec/unit/test_app/literal_spec.rb
608
666
  - test_app/test/unit/test_app/literal_test.rb
@@ -610,7 +668,7 @@ homepage: https://github.com/mbj/mutant
610
668
  licenses:
611
669
  - Nonstandard
612
670
  metadata: {}
613
- post_install_message:
671
+ post_install_message:
614
672
  rdoc_options: []
615
673
  require_paths:
616
674
  - lib
@@ -626,7 +684,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
626
684
  version: '0'
627
685
  requirements: []
628
686
  rubygems_version: 3.0.3
629
- signing_key:
687
+ signing_key:
630
688
  specification_version: 4
631
689
  summary: ''
632
690
  test_files:
@@ -636,6 +694,7 @@ test_files:
636
694
  - spec/integration/mutant/null_spec.rb
637
695
  - spec/integration/mutant/rspec_spec.rb
638
696
  - spec/integration/mutant/test_mutator_handles_types_spec.rb
697
+ - spec/unit/mutant/ast/find_metaclass_containing_spec.rb
639
698
  - spec/unit/mutant/ast/meta/optarg_spec.rb
640
699
  - spec/unit/mutant/ast/meta/send/proc_predicate_spec.rb
641
700
  - spec/unit/mutant/ast/meta/send/receiver_possible_top_level_const_predicate_spec.rb
@@ -648,7 +707,6 @@ test_files:
648
707
  - spec/unit/mutant/clock_monotonic_spec.rb
649
708
  - spec/unit/mutant/config_spec.rb
650
709
  - spec/unit/mutant/context_spec.rb
651
- - spec/unit/mutant/diff_spec.rb
652
710
  - spec/unit/mutant/env_spec.rb
653
711
  - spec/unit/mutant/expression/method_spec.rb
654
712
  - spec/unit/mutant/expression/methods_spec.rb
@@ -668,8 +726,10 @@ test_files:
668
726
  - spec/unit/mutant/matcher/config_spec.rb
669
727
  - spec/unit/mutant/matcher/filter_spec.rb
670
728
  - spec/unit/mutant/matcher/method/instance_spec.rb
729
+ - spec/unit/mutant/matcher/method/metaclass_spec.rb
671
730
  - spec/unit/mutant/matcher/method/singleton_spec.rb
672
731
  - spec/unit/mutant/matcher/methods/instance_spec.rb
732
+ - spec/unit/mutant/matcher/methods/metaclass_spec.rb
673
733
  - spec/unit/mutant/matcher/methods/singleton_spec.rb
674
734
  - spec/unit/mutant/matcher/namespace_spec.rb
675
735
  - spec/unit/mutant/matcher/null_spec.rb
@@ -718,6 +778,7 @@ test_files:
718
778
  - spec/unit/mutant/selector/expression_spec.rb
719
779
  - spec/unit/mutant/selector/null_spec.rb
720
780
  - spec/unit/mutant/subject/method/instance_spec.rb
781
+ - spec/unit/mutant/subject/method/metaclass_spec.rb
721
782
  - spec/unit/mutant/subject/method/singleton_spec.rb
722
783
  - spec/unit/mutant/subject_spec.rb
723
784
  - spec/unit/mutant/transform/array_spec.rb
@@ -730,7 +791,6 @@ test_files:
730
791
  - spec/unit/mutant/transform/primitive_spec.rb
731
792
  - spec/unit/mutant/transform/sequence_spec.rb
732
793
  - spec/unit/mutant/util/one_spec.rb
733
- - spec/unit/mutant/variable_spec.rb
734
794
  - spec/unit/mutant/warnings_spec.rb
735
795
  - spec/unit/mutant/world_spec.rb
736
796
  - spec/unit/mutant/zombifier_spec.rb