mutant 0.11.8 → 0.11.11

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.
@@ -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,privat,protected}_instance_methods.
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, libaries our your code.
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
 
@@ -24,7 +24,7 @@ module Mutant
24
24
  end
25
25
 
26
26
  def skip?
27
- name.to_s.start_with?(UNDERSCORE)
27
+ name.start_with?(UNDERSCORE)
28
28
  end
29
29
 
30
30
  # Mutator for optional arguments
@@ -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
@@ -26,7 +26,9 @@ module Mutant
26
26
 
27
27
  return unless body
28
28
  emit(body) unless body_has_control?
29
- emit_body_mutations
29
+ emit_body_mutations do |node|
30
+ !(n_nil?(node) && unconditional_loop?)
31
+ end
30
32
 
31
33
  mutate_body_receiver
32
34
  end
@@ -6,7 +6,7 @@ module Mutant
6
6
  # Mutator for dynamic literals
7
7
  class DynamicLiteral < self
8
8
 
9
- handle(:dstr, :dsym)
9
+ handle(:dstr, :dsym, :xstr)
10
10
 
11
11
  private
12
12
 
@@ -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
- name = Mutant::Util.one(argument.children)
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 unless group
14
+ return if children.empty?
17
15
 
18
- emit(s(:regexp_passive_group, group))
19
- emit_group_mutations
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, :group
11
+ children :name
12
12
 
13
13
  private
14
14
 
15
15
  def dispatch
16
- return unless group
16
+ return if remaining_children.empty?
17
17
 
18
- emit_group_mutations
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, 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}", group)
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 Adamantium, Anima.new(
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
@@ -25,6 +25,10 @@ module Mutant
25
25
  private_class_method :run_mutation_analysis
26
26
 
27
27
  def self.run_driver(reporter, driver)
28
+ Signal.trap('INT') do
29
+ driver.stop
30
+ end
31
+
28
32
  loop do
29
33
  status = driver.wait_timeout(reporter.delay)
30
34
  break status.payload if status.done?
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Mutant
4
4
  # Current mutant version
5
- VERSION = '0.11.8'
5
+ VERSION = '0.11.11'
6
6
  end # Mutant
data/lib/mutant/world.rb CHANGED
@@ -18,6 +18,7 @@ module Mutant
18
18
  :open3,
19
19
  :pathname,
20
20
  :process,
21
+ :random,
21
22
  :stderr,
22
23
  :stdout,
23
24
  :thread,
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.8
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-04-25 00:00:00.000000000 Z
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.2.33
395
+ rubygems_version: 3.1.6
390
396
  signing_key:
391
397
  specification_version: 4
392
398
  summary: ''