Class: Mutineer::Result

Inherits:
Data
  • Object
show all
Defined in:
lib/mutineer/result.rb

Overview

Immutable outcome of running one mutant. Six distinct states:

killed      — a test failed/errored, so the mutation was caught.
survived    — every test passed, so the mutation went undetected.
error       — the child crashed (unhandled exception): exit status 2.
timeout     — the parent SIGKILLed a child that overran its wall clock.
skipped     — the mutated source failed to re-parse (invalid); no fork.
no_coverage — no test exercises the mutated line; not run, not scored.

error and skipped are deliberately distinct: skipped is a pre-fork validity failure (counted separately by the reporter), error is a runtime crash. Never conflate them via details string parsing. no_coverage is a pre-fork selection result (M3): excluded from the score denominator.

subject and mutation are nil when the Result is built by Isolation/Runner (which only know the outcome); the orchestrator attaches them afterwards via result.with(subject:, mutation:) so the Reporter can render survivor diffs.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#detailsObject (readonly)

Returns the value of attribute details

Returns:

  • (Object)

    the current value of details



20
21
22
# File 'lib/mutineer/result.rb', line 20

def details
  @details
end

#mutationObject (readonly)

Returns the value of attribute mutation

Returns:

  • (Object)

    the current value of mutation



20
21
22
# File 'lib/mutineer/result.rb', line 20

def mutation
  @mutation
end

#statusObject (readonly)

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



20
21
22
# File 'lib/mutineer/result.rb', line 20

def status
  @status
end

#subjectObject (readonly)

Returns the value of attribute subject

Returns:

  • (Object)

    the current value of subject



20
21
22
# File 'lib/mutineer/result.rb', line 20

def subject
  @subject
end

Class Method Details

.error(details = nil) ⇒ Object



23
# File 'lib/mutineer/result.rb', line 23

def self.error(details = nil) = new(status: :error, details: details, subject: nil, mutation: nil)

.killedObject



21
# File 'lib/mutineer/result.rb', line 21

def self.killed               = new(status: :killed, details: nil, subject: nil, mutation: nil)

.no_coverageObject



26
# File 'lib/mutineer/result.rb', line 26

def self.no_coverage          = new(status: :no_coverage, details: nil, subject: nil, mutation: nil)

.skipped(details = nil) ⇒ Object



25
# File 'lib/mutineer/result.rb', line 25

def self.skipped(details = nil) = new(status: :skipped, details: details, subject: nil, mutation: nil)

.survivedObject



22
# File 'lib/mutineer/result.rb', line 22

def self.survived             = new(status: :survived, details: nil, subject: nil, mutation: nil)

.timeoutObject



24
# File 'lib/mutineer/result.rb', line 24

def self.timeout              = new(status: :timeout, details: nil, subject: nil, mutation: nil)

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


30
# File 'lib/mutineer/result.rb', line 30

def error?       = status == :error

#killed?Boolean

Returns:

  • (Boolean)


28
# File 'lib/mutineer/result.rb', line 28

def killed?      = status == :killed

#no_coverage?Boolean

Returns:

  • (Boolean)


33
# File 'lib/mutineer/result.rb', line 33

def no_coverage? = status == :no_coverage

#skipped?Boolean

Returns:

  • (Boolean)


32
# File 'lib/mutineer/result.rb', line 32

def skipped?     = status == :skipped

#survived?Boolean

Returns:

  • (Boolean)


29
# File 'lib/mutineer/result.rb', line 29

def survived?    = status == :survived

#timeout?Boolean

Returns:

  • (Boolean)


31
# File 'lib/mutineer/result.rb', line 31

def timeout?     = status == :timeout