mutant 0.11.8 → 0.11.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mutant/ast/meta/optarg.rb +1 -1
- data/lib/mutant/ast/pattern/lexer.rb +171 -0
- data/lib/mutant/ast/pattern/parser.rb +194 -0
- data/lib/mutant/ast/pattern/source.rb +39 -0
- data/lib/mutant/ast/pattern/token.rb +15 -0
- data/lib/mutant/ast/pattern.rb +125 -0
- data/lib/mutant/ast/structure.rb +890 -0
- data/lib/mutant/matcher/methods.rb +2 -2
- data/lib/mutant/mutator/node/argument.rb +1 -1
- data/lib/mutant/mutator/node/arguments.rb +8 -0
- data/lib/mutant/mutator/node/block.rb +3 -1
- data/lib/mutant/mutator/node/dynamic_literal.rb +1 -1
- data/lib/mutant/mutator/node/procarg_zero.rb +1 -5
- data/lib/mutant/mutator/node/regexp/capture_group.rb +3 -5
- data/lib/mutant/mutator/node/regexp/named_group.rb +5 -5
- data/lib/mutant/parallel/driver.rb +18 -2
- data/lib/mutant/runner.rb +4 -0
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/world.rb +1 -0
- data/lib/mutant.rb +7 -0
- metadata +9 -3
@@ -85,9 +85,9 @@ module Mutant
|
|
85
85
|
|
86
86
|
MESSAGE = <<~'MESSAGE'
|
87
87
|
Caught an exception while accessing a method with
|
88
|
-
#instance_method that is part of #{public,
|
88
|
+
#instance_method that is part of #{public,private,protected}_instance_methods.
|
89
89
|
|
90
|
-
This is a bug in your ruby implementation its stdlib,
|
90
|
+
This is a bug in your ruby implementation, its stdlib, your dependencies, or your code.
|
91
91
|
|
92
92
|
Mutant will ignore this method:
|
93
93
|
|
@@ -16,6 +16,7 @@ module Mutant
|
|
16
16
|
emit_argument_presence
|
17
17
|
emit_argument_mutations
|
18
18
|
emit_mlhs_expansion
|
19
|
+
emit_procarg0_removal
|
19
20
|
end
|
20
21
|
|
21
22
|
def emit_argument_presence
|
@@ -75,6 +76,13 @@ module Mutant
|
|
75
76
|
end
|
76
77
|
end
|
77
78
|
|
79
|
+
def emit_procarg0_removal
|
80
|
+
return unless children.one? && n_procarg0?((procarg0 = Mutant::Util.one(children)))
|
81
|
+
|
82
|
+
arguments = procarg0.children
|
83
|
+
emit_type(*arguments) if arguments.count > 1
|
84
|
+
end
|
85
|
+
|
78
86
|
end # Arguments
|
79
87
|
end # Node
|
80
88
|
end # Mutator
|
@@ -7,14 +7,10 @@ module Mutant
|
|
7
7
|
|
8
8
|
handle :procarg0
|
9
9
|
|
10
|
-
children :argument
|
11
|
-
|
12
10
|
private
|
13
11
|
|
14
12
|
def dispatch
|
15
|
-
|
16
|
-
|
17
|
-
emit_type(s(:arg, :"_#{name}")) unless name.to_s.start_with?('_')
|
13
|
+
children.each_index(&method(:mutate_child))
|
18
14
|
end
|
19
15
|
end # ProcargZero
|
20
16
|
end # Node
|
@@ -8,15 +8,13 @@ module Mutant
|
|
8
8
|
class CaptureGroup < Node
|
9
9
|
handle(:regexp_capture_group)
|
10
10
|
|
11
|
-
children :group
|
12
|
-
|
13
11
|
private
|
14
12
|
|
15
13
|
def dispatch
|
16
|
-
return
|
14
|
+
return if children.empty?
|
17
15
|
|
18
|
-
emit(s(:regexp_passive_group,
|
19
|
-
|
16
|
+
emit(s(:regexp_passive_group, *children))
|
17
|
+
children.each_index(&method(:mutate_child))
|
20
18
|
end
|
21
19
|
end # EndOfLineAnchor
|
22
20
|
end # Regexp
|
@@ -8,25 +8,25 @@ module Mutant
|
|
8
8
|
class NamedGroup < Node
|
9
9
|
handle(:regexp_named_group)
|
10
10
|
|
11
|
-
children :name
|
11
|
+
children :name
|
12
12
|
|
13
13
|
private
|
14
14
|
|
15
15
|
def dispatch
|
16
|
-
return
|
16
|
+
return if remaining_children.empty?
|
17
17
|
|
18
|
-
|
18
|
+
remaining_children_indices.each(&method(:mutate_child))
|
19
19
|
|
20
20
|
# Allows unused captures to be kept and named if they are explicitly prefixed with an
|
21
21
|
# underscore, like we allow with unused local variables.
|
22
22
|
return if name_underscored?
|
23
23
|
|
24
|
-
emit(s(:regexp_passive_group,
|
24
|
+
emit(s(:regexp_passive_group, *remaining_children))
|
25
25
|
emit_name_underscore_mutation
|
26
26
|
end
|
27
27
|
|
28
28
|
def emit_name_underscore_mutation
|
29
|
-
emit_type("_#{name}",
|
29
|
+
emit_type("_#{name}", *remaining_children)
|
30
30
|
end
|
31
31
|
|
32
32
|
def name_underscored?
|
@@ -4,7 +4,7 @@ module Mutant
|
|
4
4
|
module Parallel
|
5
5
|
# Driver for parallelized execution
|
6
6
|
class Driver
|
7
|
-
include
|
7
|
+
include Anima.new(
|
8
8
|
:threads,
|
9
9
|
:var_active_jobs,
|
10
10
|
:var_final,
|
@@ -16,6 +16,11 @@ module Mutant
|
|
16
16
|
|
17
17
|
private(*anima.attribute_names)
|
18
18
|
|
19
|
+
def initialize(**attributes)
|
20
|
+
@alive = true
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
19
24
|
# Wait for computation to finish, with timeout
|
20
25
|
#
|
21
26
|
# @param [Float] timeout
|
@@ -23,11 +28,22 @@ module Mutant
|
|
23
28
|
# @return [Variable::Result<Sink#status>]
|
24
29
|
# current status
|
25
30
|
def wait_timeout(timeout)
|
26
|
-
var_final.take_timeout(timeout)
|
31
|
+
var_final.take_timeout(timeout) if @alive
|
27
32
|
|
28
33
|
finalize(status)
|
29
34
|
end
|
30
35
|
|
36
|
+
# Stop parallel computation
|
37
|
+
#
|
38
|
+
# This will cause all work to be immediately stopped.
|
39
|
+
#
|
40
|
+
# @return [self]
|
41
|
+
def stop
|
42
|
+
@alive = false
|
43
|
+
threads.each(&:kill)
|
44
|
+
self
|
45
|
+
end
|
46
|
+
|
31
47
|
private
|
32
48
|
|
33
49
|
def finalize(status)
|
data/lib/mutant/runner.rb
CHANGED
data/lib/mutant/version.rb
CHANGED
data/lib/mutant/world.rb
CHANGED
data/lib/mutant.rb
CHANGED
@@ -76,6 +76,12 @@ require 'mutant/ast/meta/const'
|
|
76
76
|
require 'mutant/ast/meta/symbol'
|
77
77
|
require 'mutant/ast/meta/optarg'
|
78
78
|
require 'mutant/ast/meta/resbody'
|
79
|
+
require 'mutant/ast/pattern'
|
80
|
+
require 'mutant/ast/pattern/lexer'
|
81
|
+
require 'mutant/ast/pattern/parser'
|
82
|
+
require 'mutant/ast/pattern/source'
|
83
|
+
require 'mutant/ast/pattern/token'
|
84
|
+
require 'mutant/ast/structure'
|
79
85
|
require 'mutant/parser'
|
80
86
|
require 'mutant/isolation'
|
81
87
|
require 'mutant/isolation/exception'
|
@@ -256,6 +262,7 @@ module Mutant
|
|
256
262
|
open3: Open3,
|
257
263
|
pathname: Pathname,
|
258
264
|
process: Process,
|
265
|
+
random: Random,
|
259
266
|
stderr: $stderr,
|
260
267
|
stdout: $stdout,
|
261
268
|
thread: Thread,
|
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.11.
|
4
|
+
version: 0.11.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diff-lcs
|
@@ -179,6 +179,11 @@ files:
|
|
179
179
|
- lib/mutant/ast/named_children.rb
|
180
180
|
- lib/mutant/ast/node_predicates.rb
|
181
181
|
- lib/mutant/ast/nodes.rb
|
182
|
+
- lib/mutant/ast/pattern.rb
|
183
|
+
- lib/mutant/ast/pattern/lexer.rb
|
184
|
+
- lib/mutant/ast/pattern/parser.rb
|
185
|
+
- lib/mutant/ast/pattern/source.rb
|
186
|
+
- lib/mutant/ast/pattern/token.rb
|
182
187
|
- lib/mutant/ast/regexp.rb
|
183
188
|
- lib/mutant/ast/regexp/transformer.rb
|
184
189
|
- lib/mutant/ast/regexp/transformer/direct.rb
|
@@ -189,6 +194,7 @@ files:
|
|
189
194
|
- lib/mutant/ast/regexp/transformer/root.rb
|
190
195
|
- lib/mutant/ast/regexp/transformer/text.rb
|
191
196
|
- lib/mutant/ast/sexp.rb
|
197
|
+
- lib/mutant/ast/structure.rb
|
192
198
|
- lib/mutant/ast/types.rb
|
193
199
|
- lib/mutant/bootstrap.rb
|
194
200
|
- lib/mutant/cli.rb
|
@@ -386,7 +392,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
386
392
|
- !ruby/object:Gem::Version
|
387
393
|
version: '0'
|
388
394
|
requirements: []
|
389
|
-
rubygems_version: 3.
|
395
|
+
rubygems_version: 3.1.6
|
390
396
|
signing_key:
|
391
397
|
specification_version: 4
|
392
398
|
summary: ''
|