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 +4 -4
- data/lib/mutant.rb +3 -1
- data/lib/mutant/isolation/exception.rb +22 -0
- data/lib/mutant/isolation/fork.rb +5 -1
- data/lib/mutant/meta/example/dsl.rb +0 -1
- data/lib/mutant/mutator/node.rb +0 -5
- data/lib/mutant/mutator/node/index.rb +1 -0
- data/lib/mutant/mutator/node/module.rb +19 -0
- data/lib/mutant/mutator/node/send.rb +7 -1
- data/lib/mutant/reporter/cli/printer/isolation_result.rb +3 -1
- data/lib/mutant/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16a3840650d771f80beec47b664280e386be43b3af1dbc68e369ac738b327476
|
4
|
+
data.tar.gz: 546c9603de389adce0eb71ec46439900a5e77b8cb2f2cc49553b83a1fba09a39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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/
|
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 =
|
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
|
data/lib/mutant/mutator/node.rb
CHANGED
@@ -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.
|
85
|
+
exception.original_class,
|
86
|
+
exception.message,
|
85
87
|
exception.backtrace.join("\n")
|
86
88
|
]
|
87
89
|
)
|
data/lib/mutant/version.rb
CHANGED
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.
|
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-
|
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
|