mutant 0.12.1 → 0.12.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mutant/ast/named_children.rb +2 -2
  3. data/lib/mutant/ast/pattern/lexer.rb +6 -6
  4. data/lib/mutant/ast/pattern/parser.rb +9 -9
  5. data/lib/mutant/ast/structure.rb +1 -1
  6. data/lib/mutant/ast.rb +1 -1
  7. data/lib/mutant/bootstrap.rb +12 -12
  8. data/lib/mutant/cli/command/environment/test.rb +2 -2
  9. data/lib/mutant/cli/command/environment.rb +8 -8
  10. data/lib/mutant/cli/command/util.rb +2 -2
  11. data/lib/mutant/cli/command.rb +8 -8
  12. data/lib/mutant/cli.rb +1 -1
  13. data/lib/mutant/config.rb +6 -7
  14. data/lib/mutant/env.rb +10 -10
  15. data/lib/mutant/expression/descendants.rb +1 -1
  16. data/lib/mutant/expression/method.rb +2 -2
  17. data/lib/mutant/expression/methods.rb +2 -2
  18. data/lib/mutant/expression/parser.rb +4 -5
  19. data/lib/mutant/expression/source.rb +3 -3
  20. data/lib/mutant/integration.rb +2 -2
  21. data/lib/mutant/isolation/fork.rb +4 -4
  22. data/lib/mutant/isolation/none.rb +2 -2
  23. data/lib/mutant/matcher/descendants.rb +1 -1
  24. data/lib/mutant/matcher/method/instance.rb +3 -3
  25. data/lib/mutant/matcher/method/metaclass.rb +2 -2
  26. data/lib/mutant/matcher/method/singleton.rb +1 -1
  27. data/lib/mutant/matcher/method.rb +5 -19
  28. data/lib/mutant/matcher/methods.rb +2 -2
  29. data/lib/mutant/matcher/namespace.rb +1 -1
  30. data/lib/mutant/matcher/scope.rb +1 -1
  31. data/lib/mutant/matcher.rb +1 -1
  32. data/lib/mutant/meta/example/verification.rb +1 -1
  33. data/lib/mutant/meta/example.rb +4 -4
  34. data/lib/mutant/meta.rb +1 -1
  35. data/lib/mutant/mutation/runner/sink.rb +3 -3
  36. data/lib/mutant/mutation/runner.rb +1 -1
  37. data/lib/mutant/mutation.rb +2 -2
  38. data/lib/mutant/mutator/node/block.rb +1 -1
  39. data/lib/mutant/mutator/node/break.rb +1 -1
  40. data/lib/mutant/mutator/node/index.rb +1 -1
  41. data/lib/mutant/mutator/node/kwbegin.rb +1 -1
  42. data/lib/mutant/mutator/node/named_value/access.rb +1 -1
  43. data/lib/mutant/mutator/node/next.rb +1 -1
  44. data/lib/mutant/mutator/node/send/conditional.rb +1 -1
  45. data/lib/mutant/mutator/node/send.rb +1 -1
  46. data/lib/mutant/mutator/node/super.rb +0 -1
  47. data/lib/mutant/mutator/node/yield.rb +1 -1
  48. data/lib/mutant/mutator/node/zsuper.rb +0 -1
  49. data/lib/mutant/mutator/node.rb +5 -5
  50. data/lib/mutant/mutator/regexp.rb +2 -2
  51. data/lib/mutant/parallel/connection.rb +2 -2
  52. data/lib/mutant/parallel/pipe.rb +2 -2
  53. data/lib/mutant/parallel/worker.rb +10 -10
  54. data/lib/mutant/parallel.rb +3 -3
  55. data/lib/mutant/parser.rb +1 -1
  56. data/lib/mutant/registry.rb +1 -1
  57. data/lib/mutant/reporter/cli/format.rb +1 -1
  58. data/lib/mutant/reporter/cli/printer/isolation_result.rb +2 -2
  59. data/lib/mutant/reporter/cli/printer/status_progressive.rb +1 -1
  60. data/lib/mutant/reporter/cli/printer/test.rb +1 -1
  61. data/lib/mutant/reporter/cli/printer.rb +1 -1
  62. data/lib/mutant/reporter/cli.rb +3 -3
  63. data/lib/mutant/repository/diff.rb +6 -5
  64. data/lib/mutant/segment/recorder.rb +8 -8
  65. data/lib/mutant/subject/config.rb +1 -1
  66. data/lib/mutant/subject/method/instance.rb +1 -1
  67. data/lib/mutant/subject.rb +1 -1
  68. data/lib/mutant/test/runner/sink.rb +1 -1
  69. data/lib/mutant/test/runner.rb +1 -1
  70. data/lib/mutant/timer.rb +2 -2
  71. data/lib/mutant/transform.rb +20 -20
  72. data/lib/mutant/variable.rb +2 -2
  73. data/lib/mutant/version.rb +1 -1
  74. data/lib/mutant/world.rb +7 -7
  75. data/lib/mutant.rb +8 -8
  76. metadata +7 -6
@@ -35,7 +35,7 @@ module Mutant
35
35
  .instance_variable_get(:@memoized_methods)
36
36
  .delete(name)
37
37
 
38
- super()
38
+ super
39
39
  end
40
40
 
41
41
  private
@@ -14,7 +14,7 @@ module Mutant
14
14
  [neutral_mutation].concat(
15
15
  Mutator::Node.mutate(
16
16
  config: config.mutation,
17
- node: node
17
+ node:
18
18
  ).map do |mutant|
19
19
  Mutation::Evil.new(subject: self, node: wrap_node(mutant))
20
20
  end
@@ -20,7 +20,7 @@ module Mutant
20
20
  # @return [Result::Env]
21
21
  def status
22
22
  Result::TestEnv.new(
23
- env: env,
23
+ env:,
24
24
  runtime: env.world.timer.now - @start,
25
25
  test_results: @test_results.sort_by!(&:job_index)
26
26
  )
@@ -45,7 +45,7 @@ module Mutant
45
45
  jobs: env.config.jobs,
46
46
  on_process_start: env.method(:emit_test_worker_process_start),
47
47
  process_name: 'mutant-test-runner-process',
48
- sink: Sink.new(env: env),
48
+ sink: Sink.new(env:),
49
49
  source: Parallel::Source::Array.new(jobs: env.integration.all_tests.each_index.to_a),
50
50
  thread_name: 'mutant-test-runner-thread',
51
51
  timeout: nil
data/lib/mutant/timer.rb CHANGED
@@ -24,7 +24,7 @@ module Mutant
24
24
  include Anima.new(:timer, :allowed_time)
25
25
 
26
26
  def initialize(*arguments)
27
- super(*arguments)
27
+ super
28
28
  @start_at = timer.now
29
29
  end
30
30
 
@@ -49,7 +49,7 @@ module Mutant
49
49
  #
50
50
  # @return [Status]
51
51
  def status
52
- Status.new(time_left: time_left)
52
+ Status.new(time_left:)
53
53
  end
54
54
 
55
55
  # Probe the time left
@@ -35,7 +35,7 @@ module Mutant
35
35
  #
36
36
  # @return [String]
37
37
  def compact_message
38
- COMPACT % { path: path, message: trace.last.message }
38
+ COMPACT % { path:, message: trace.last.message }
39
39
  end
40
40
  memoize :compact_message
41
41
 
@@ -77,7 +77,7 @@ module Mutant
77
77
  include Anima.new(:block, :name)
78
78
 
79
79
  def self.capture(name, &block)
80
- new(block: block, name: name)
80
+ new(block:, name:)
81
81
  end
82
82
 
83
83
  def call(input)
@@ -86,8 +86,8 @@ module Mutant
86
86
  .lmap do |message|
87
87
  Error.new(
88
88
  cause: nil,
89
- input: input,
90
- message: message,
89
+ input:,
90
+ message:,
91
91
  transform: self
92
92
  )
93
93
  end
@@ -102,9 +102,9 @@ module Mutant
102
102
 
103
103
  def error(cause: nil, input:, message: nil)
104
104
  Error.new(
105
- cause: cause,
106
- input: input,
107
- message: message,
105
+ cause:,
106
+ input:,
107
+ message:,
108
108
  transform: self
109
109
  )
110
110
  end
@@ -139,10 +139,10 @@ module Mutant
139
139
  # @return [Error]
140
140
  def self.wrap(cause, index)
141
141
  Error.new(
142
- cause: cause,
142
+ cause:,
143
143
  input: cause.input,
144
144
  message: nil,
145
- transform: new(index: index, transform: cause.transform)
145
+ transform: new(index:, transform: cause.transform)
146
146
  )
147
147
  end
148
148
 
@@ -159,7 +159,7 @@ module Mutant
159
159
  #
160
160
  # @return [Array<String>]
161
161
  def slug
162
- '%<index>d' % { index: index }
162
+ '%<index>d' % { index: }
163
163
  end
164
164
  memoize :slug
165
165
  end # Index
@@ -183,7 +183,7 @@ module Mutant
183
183
  else
184
184
  failure(
185
185
  error(
186
- input: input,
186
+ input:,
187
187
  message: MESSAGE % { actual: input.class, expected: primitive }
188
188
  )
189
189
  )
@@ -219,7 +219,7 @@ module Mutant
219
219
  failure(
220
220
  error(
221
221
  message: MESSAGE % { actual: input.inspect },
222
- input: input
222
+ input:
223
223
  )
224
224
  )
225
225
  end
@@ -258,8 +258,8 @@ module Mutant
258
258
  return failure(
259
259
  error(
260
260
  cause: Index.wrap(error, index),
261
- message: MESSAGE % { index: index },
262
- input: input
261
+ message: MESSAGE % { index: },
262
+ input:
263
263
  )
264
264
  )
265
265
  end.from_right
@@ -310,7 +310,7 @@ module Mutant
310
310
  # @return [Either<Error, Object>]
311
311
  def call(input)
312
312
  transform.call(input).lmap do |error|
313
- error(cause: error, input: input)
313
+ error(cause: error, input:)
314
314
  end
315
315
  end
316
316
  end # Key
@@ -365,7 +365,7 @@ module Mutant
365
365
 
366
366
  def coerce_key(key, input)
367
367
  key.call(input.fetch(key.value)).lmap do |error|
368
- error(input: input, cause: error)
368
+ error(input:, cause: error)
369
369
  end
370
370
  end
371
371
 
@@ -380,8 +380,8 @@ module Mutant
380
380
  else
381
381
  failure(
382
382
  error(
383
- input: input,
384
- message: KEY_MESSAGE % { missing: missing, unexpected: unexpected }
383
+ input:,
384
+ message: KEY_MESSAGE % { missing:, unexpected: }
385
385
  )
386
386
  )
387
387
  end
@@ -413,7 +413,7 @@ module Mutant
413
413
 
414
414
  steps.each_with_index do |step, index|
415
415
  current = step.call(current).from_right do |error|
416
- return failure(error(cause: Index.wrap(error, index), input: input))
416
+ return failure(error(cause: Index.wrap(error, index), input:))
417
417
  end
418
418
  end
419
419
 
@@ -447,7 +447,7 @@ module Mutant
447
447
  def call(input)
448
448
  Either
449
449
  .wrap_error(error_class) { block.call(input) }
450
- .lmap { |exception| error(input: input, message: exception.to_s) }
450
+ .lmap { |exception| error(input:, message: exception.to_s) }
451
451
  end
452
452
  end # Exception
453
453
 
@@ -163,8 +163,8 @@ module Mutant
163
163
  # Execute block under mutex
164
164
  #
165
165
  # @return [self]
166
- def synchronize(&block)
167
- @mutex.synchronize(&block)
166
+ def synchronize(&)
167
+ @mutex.synchronize(&)
168
168
  end
169
169
 
170
170
  # Wait for block predicate
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Mutant
4
4
  # Current mutant version
5
- VERSION = '0.12.1'
5
+ VERSION = '0.12.3'
6
6
  end # Mutant
data/lib/mutant/world.rb CHANGED
@@ -53,9 +53,9 @@ module Mutant
53
53
 
54
54
  (process_status.success? ? Either::Right : Either::Left).new(
55
55
  CommandStatus.new(
56
- process_status: process_status,
57
- stderr: stderr,
58
- stdout: stdout
56
+ process_status:,
57
+ stderr:,
58
+ stdout:
59
59
  )
60
60
  )
61
61
  end
@@ -79,16 +79,16 @@ module Mutant
79
79
  def deadline(allowed_time)
80
80
  if allowed_time
81
81
  Timer::Deadline.new(
82
- allowed_time: allowed_time,
83
- timer: timer
82
+ allowed_time:,
83
+ timer:
84
84
  )
85
85
  else
86
86
  Timer::Deadline::None.new
87
87
  end
88
88
  end
89
89
 
90
- def record(name, &block)
91
- recorder.record(name, &block)
90
+ def record(name, &)
91
+ recorder.record(name, &)
92
92
  end
93
93
 
94
94
  def process_warmup
data/lib/mutant.rb CHANGED
@@ -291,22 +291,22 @@ module Mutant
291
291
  boot_segments = boot_events.map do |name, timestamp_start, timestamp_end|
292
292
  Segment.new(
293
293
  id: gen_id.call,
294
- name: name,
294
+ name:,
295
295
  parent_id: library_segment.id,
296
- timestamp_end: timestamp_end,
297
- timestamp_start: timestamp_start
296
+ timestamp_end:,
297
+ timestamp_start:
298
298
  )
299
299
  end
300
300
 
301
301
  timer = Timer.new(process: Process)
302
302
 
303
303
  recorder = Segment::Recorder.new(
304
- gen_id: gen_id,
304
+ gen_id:,
305
305
  root_id: (executable_segment || library_segment).id,
306
306
  parent_id: library_segment.id,
307
- recording_start: recording_start,
307
+ recording_start:,
308
308
  segments: [*executable_segment, library_segment, *boot_segments],
309
- timer: timer
309
+ timer:
310
310
  )
311
311
 
312
312
  WORLD = World.new(
@@ -325,13 +325,13 @@ module Mutant
325
325
  pathname: Pathname,
326
326
  process: Process,
327
327
  random: Random,
328
- recorder: recorder,
328
+ recorder:,
329
329
  stderr: $stderr,
330
330
  stdout: $stdout,
331
331
  tempfile: Tempfile,
332
332
  thread: Thread,
333
333
  time: Time,
334
- timer: timer
334
+ timer:
335
335
  )
336
336
 
337
337
  # Reopen class to initialize constant to avoid dep circle
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.12.1
4
+ version: 0.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-12 00:00:00.000000000 Z
11
+ date: 2024-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diff-lcs
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.6.9
75
+ version: 0.6.14
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.6.9
82
+ version: 0.6.14
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -346,6 +346,7 @@ licenses:
346
346
  - Nonstandard
347
347
  metadata:
348
348
  rubygems_mfa_required: 'true'
349
+ source_code_uri: https://github.com/mbj/mutant
349
350
  post_install_message:
350
351
  rdoc_options: []
351
352
  require_paths:
@@ -354,14 +355,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
354
355
  requirements:
355
356
  - - ">="
356
357
  - !ruby/object:Gem::Version
357
- version: '3.0'
358
+ version: '3.1'
358
359
  required_rubygems_version: !ruby/object:Gem::Requirement
359
360
  requirements:
360
361
  - - ">="
361
362
  - !ruby/object:Gem::Version
362
363
  version: '0'
363
364
  requirements: []
364
- rubygems_version: 3.5.3
365
+ rubygems_version: 3.3.26
365
366
  signing_key:
366
367
  specification_version: 4
367
368
  summary: ''