free_mutant/lib/mutant/isolation.rb
Markus Schirp 31bc77ee12 Change isolation interface to separate isolation errors
* Before, when code inside the isolation failed outside the tests we
  counted this as a mutation kill.
* Now we report them explicitly as not killed mutations. As they where
  not killed by the tests.
2018-12-04 14:26:23 +00:00

37 lines
709 B
Ruby

# frozen_string_literal: true
module Mutant
# Isolation mechanism
class Isolation
include AbstractType
# Isolated computation result
class Result
include AbstractType
abstract_method :value
abstract_method :error
# Test for success
#
# @return [Boolean]
def success?
instance_of?(Success)
end
class Success < self
include Concord::Public.new(:value)
end # Success
class Error < self
include Concord::Public.new(:error)
end # Error
end # Result
# Call block in isolation
#
# @return [Result]
# the blocks result
abstract_method :call
end # Isolation
end # Mutant