mutant 0.10.26 → 0.10.27

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05b03b60df6a63d9fa7a8b64affcaae0a804a753764b636fee625b1edc597e25
4
- data.tar.gz: b61c7b228cdffed5d67cd38ffb3cc55b00d2bace308e56f8f48e828987fa76ba
3
+ metadata.gz: 16a3840650d771f80beec47b664280e386be43b3af1dbc68e369ac738b327476
4
+ data.tar.gz: 546c9603de389adce0eb71ec46439900a5e77b8cb2f2cc49553b83a1fba09a39
5
5
  SHA512:
6
- metadata.gz: 50fbc446b2f03edb5015136920a95e3fa9dbbc55b10a530dcea755ed9bf0bb0fea2e99bc3bdf6503cc564fc4d71ea8b1fbcabe97f6959df9ec800e68c81220cb
7
- data.tar.gz: fa841fc57b3422780840b66368bbac984b42bd2cef27aee58d07b783b952cbece2fddb0d821ff489279c808db64802c254df84774fcc4a50b887ec068c455b00
6
+ metadata.gz: de7d2fd9838eae08548ec13f55734b7f2a6d7537945fc608763b416f735e3383ec23806cbd6a3e982960b1659e07dc63cdd4493314fbc81ba69f4d10f241acba
7
+ data.tar.gz: 3b2095127481513dd05efbca7abec9cca8871c5dbb44e55c60c03e69de8c2c7bb3f65fc436e42948f3923aca460e945d926646fb7605ab1a7fe4d4430b155ff4
data/lib/mutant.rb CHANGED
@@ -71,8 +71,9 @@ require 'mutant/ast/meta/optarg'
71
71
  require 'mutant/ast/meta/resbody'
72
72
  require 'mutant/parser'
73
73
  require 'mutant/isolation'
74
- require 'mutant/isolation/none'
74
+ require 'mutant/isolation/exception'
75
75
  require 'mutant/isolation/fork'
76
+ require 'mutant/isolation/none'
76
77
  require 'mutant/parallel'
77
78
  require 'mutant/parallel/driver'
78
79
  require 'mutant/parallel/source'
@@ -137,6 +138,7 @@ require 'mutant/mutator/node/define'
137
138
  require 'mutant/mutator/node/mlhs'
138
139
  require 'mutant/mutator/node/nthref'
139
140
  require 'mutant/mutator/node/masgn'
141
+ require 'mutant/mutator/node/module'
140
142
  require 'mutant/mutator/node/return'
141
143
  require 'mutant/mutator/node/block'
142
144
  require 'mutant/mutator/node/block_pass'
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mutant
4
+ # Module providing isolation
5
+ class Isolation
6
+ # Generic serializable exception data.
7
+ #
8
+ # This is required as our honored guests the Rails* ecosystem
9
+ # makes Marshal.dump on exceptions impossible.
10
+ #
11
+ # @see https://twitter.com/_m_b_j_/status/1356433184850907137
12
+ #
13
+ # for the full story and eventual reactions.
14
+ class Exception
15
+ include Anima.new(
16
+ :backtrace,
17
+ :message,
18
+ :original_class
19
+ )
20
+ end # Exception
21
+ end # Isolation
22
+ end # Mutant
@@ -133,7 +133,11 @@ module Mutant
133
133
  def load_result(result_fragments)
134
134
  @value = world.marshal.load(result_fragments.join)
135
135
  rescue ArgumentError => exception
136
- @exception = exception
136
+ @exception = Exception.new(
137
+ backtrace: exception.backtrace,
138
+ message: exception.message,
139
+ original_class: exception.class
140
+ )
137
141
  end
138
142
 
139
143
  # rubocop:disable Metrics/MethodLength
@@ -79,7 +79,6 @@ module Mutant
79
79
 
80
80
  def singleton_mutations
81
81
  mutation('nil')
82
- mutation('self')
83
82
  end
84
83
 
85
84
  def regexp_mutations
@@ -67,11 +67,6 @@ module Mutant
67
67
 
68
68
  def emit_singletons
69
69
  emit_nil
70
- emit_self
71
- end
72
-
73
- def emit_self
74
- emit(N_SELF)
75
70
  end
76
71
 
77
72
  def emit_nil
@@ -17,6 +17,7 @@ module Mutant
17
17
  def dispatch
18
18
  emit_singletons
19
19
  emit_receiver_mutations { |node| !n_nil?(node) }
20
+ emit_type(N_SELF, *children.drop(1))
20
21
  emit(receiver)
21
22
  emit_send_forms
22
23
  emit_drop_mutation
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mutant
4
+ class Mutator
5
+ class Node
6
+ class Module < self
7
+ handle :module
8
+
9
+ children :klass, :body
10
+
11
+ private
12
+
13
+ def dispatch
14
+ emit_body_mutations if body
15
+ end
16
+ end # Module
17
+ end # Node
18
+ end # Mutator
19
+ end # Mutant
@@ -25,7 +25,6 @@ module Mutant
25
25
  all?: %i[any?],
26
26
  any?: %i[all?],
27
27
  at: %i[fetch key?],
28
- eql?: %i[equal?],
29
28
  fetch: %i[key?],
30
29
  flat_map: %i[map],
31
30
  gsub: %i[sub],
@@ -232,11 +231,18 @@ module Mutant
232
231
  def mutate_receiver
233
232
  return unless receiver
234
233
  emit_implicit_self
234
+ emit_explicit_self
235
235
  emit_receiver_mutations do |node|
236
236
  !n_nil?(node)
237
237
  end
238
238
  end
239
239
 
240
+ def emit_explicit_self
241
+ return if UNARY_METHOD_OPERATORS.include?(selector)
242
+
243
+ emit_receiver(N_SELF) unless n_nil?(receiver)
244
+ end
245
+
240
246
  def emit_implicit_self
241
247
  emit_receiver(nil) if n_self?(receiver) && !(
242
248
  KEYWORDS.include?(selector) ||
@@ -28,6 +28,7 @@ module Mutant
28
28
  ```
29
29
  %s
30
30
  %s
31
+ %s
31
32
  ```
32
33
  MESSAGE
33
34
 
@@ -81,7 +82,8 @@ module Mutant
81
82
 
82
83
  puts(
83
84
  EXCEPTION_ERROR_MESSAGE % [
84
- exception.inspect,
85
+ exception.original_class,
86
+ exception.message,
85
87
  exception.backtrace.join("\n")
86
88
  ]
87
89
  )
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Mutant
4
4
  # Current mutant version
5
- VERSION = '0.10.26'
5
+ VERSION = '0.10.27'
6
6
  end # Mutant
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.10.26
4
+ version: 0.10.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-16 00:00:00.000000000 Z
11
+ date: 2021-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diff-lcs
@@ -198,6 +198,7 @@ files:
198
198
  - lib/mutant/integration.rb
199
199
  - lib/mutant/integration/null.rb
200
200
  - lib/mutant/isolation.rb
201
+ - lib/mutant/isolation/exception.rb
201
202
  - lib/mutant/isolation/fork.rb
202
203
  - lib/mutant/isolation/none.rb
203
204
  - lib/mutant/license.rb
@@ -259,6 +260,7 @@ files:
259
260
  - lib/mutant/mutator/node/masgn.rb
260
261
  - lib/mutant/mutator/node/match_current_line.rb
261
262
  - lib/mutant/mutator/node/mlhs.rb
263
+ - lib/mutant/mutator/node/module.rb
262
264
  - lib/mutant/mutator/node/named_value/access.rb
263
265
  - lib/mutant/mutator/node/named_value/constant_assignment.rb
264
266
  - lib/mutant/mutator/node/named_value/variable_assignment.rb