Class: Mutant::Mutation::Runner::Sink Private

Inherits:
Object
  • Object
show all
Includes:
Parallel::Sink
Defined in:
lib/mutant/mutation/runner/sink.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

FLUSH_INTERVAL =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Minimum seconds between two session flushes

1.0

Instance Method Summary collapse

Constructor Details

#initializeundefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize object



17
18
19
20
21
22
# File 'lib/mutant/mutation/runner/sink.rb', line 17

def initialize(*)
  super
  @start           = env.world.timer.now
  @last_flush_at   = @start - FLUSH_INTERVAL
  @subject_results = {}
end

Instance Method Details

#response(response) ⇒ self

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Handle mutation finish

rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength

Parameters:

Returns:

  • (self)


49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/mutant/mutation/runner/sink.rb', line 49

def response(response)
  fail response.error if response.error

  mutation        = env.mutations.fetch(response.result.mutation_index)
  subject         = mutation.subject
  mutation_result = mutation_result(mutation, response.result)
  coverage        = coverage_result(mutation_result)

  @subject_results[subject] = Result::Subject.new(
    amount_mutations:  subject.mutations.length,
    coverage_results:  previous_coverage_results(subject).dup << coverage,
    expression_syntax: subject.expression.syntax,
    identification:    subject.identification,
    node:              subject.node,
    source:            subject.source,
    source_path:       subject.source_path.to_s,
    tests:             env.selections.fetch(subject)
  )

  flush_session unless coverage.success?

  self
end

#statusResult::Env

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Runner status

Returns:



27
28
29
30
31
32
33
# File 'lib/mutant/mutation/runner/sink.rb', line 27

def status
  Result::Env.new(
    env:,
    runtime:         env.world.timer.now - @start,
    subject_results: @subject_results.values
  )
end

#stop?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Test if scheduling stopped

Returns:

  • (Boolean)


38
39
40
# File 'lib/mutant/mutation/runner/sink.rb', line 38

def stop?
  status.stop?
end