Class: Evilution::Runner::MutationExecutor::MutationRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/runner/mutation_executor/mutation_runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(config:, cache:, isolator:) ⇒ MutationRunner

Returns a new instance of MutationRunner.



9
10
11
12
13
# File 'lib/evilution/runner/mutation_executor/mutation_runner.rb', line 9

def initialize(config:, cache:, isolator:)
  @config = config
  @cache = cache
  @isolator = isolator
end

Instance Method Details

#call(mutation, integration:) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/evilution/runner/mutation_executor/mutation_runner.rb', line 15

def call(mutation, integration:)
  return unparseable_result(mutation) if mutation.unparseable?

  cached = @cache.fetch(mutation)
  return cached if cached

  test_command = ->(m) { integration.call(m) }
  result = @isolator.call(mutation: mutation, test_command: test_command, timeout: @config.timeout)
  @cache.store(mutation, result)
  result
end