Class: Mutant::Killer

Inherits:
Object
  • Object
show all
Includes:
AbstractType, Adamantium::Flat
Defined in:
lib/mutant/killer.rb,
lib/mutant/killer/rspec.rb,
lib/mutant/killer/forked.rb,
lib/mutant/killer/static.rb,
lib/mutant/killer/forking.rb

Overview

Abstract base class for mutant killers

Direct Known Subclasses

Forked, Forking, Rspec, Static

Defined Under Namespace

Classes: Forked, Forking, Rspec, Static

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(strategy, mutation) ⇒ undefined

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 killer object

Parameters:



34
35
36
37
# File 'lib/mutant/killer.rb', line 34

def initialize(strategy, mutation)
  @strategy, @mutation = strategy, mutation
  @killed = run
end

Instance Attribute Details

#mutationMutation (readonly)

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.

Return mutation to kill

Returns:



23
24
25
# File 'lib/mutant/killer.rb', line 23

def mutation
  @mutation
end

#strategyStrategy (readonly)

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.

Return strategy

Returns:



15
16
17
# File 'lib/mutant/killer.rb', line 15

def strategy
  @strategy
end

Instance Method Details

#killed?true, false

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 mutant was killed

Returns:

  • (true)

    if mutant was killed

  • (false)

    otherwise



64
65
66
# File 'lib/mutant/killer.rb', line 64

def killed?
  @killed
end

#mutation_sourceString

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.

Return mutated source

Returns:

  • (String)


74
75
76
# File 'lib/mutant/killer.rb', line 74

def mutation_source
  mutation.source
end

#success?true, false

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 for kill failure

Returns:

  • (true)

    when killer succeeded

  • (false)

    otherwise



49
50
51
# File 'lib/mutant/killer.rb', line 49

def success?
  mutation.success?(self)
end