Class: Mutineer::Result

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

Overview

Immutable outcome of running one mutant. Seven 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.
uncapturable — the line's would-be covering test errored during capture
             (#9), so coverage was lost. Excluded from the
             denominator exactly like no_coverage, but reported
             separately: it signals a broken harness (a test that
             failed to run), not a genuine coverage gap.
ignored      — a known-equivalent mutant the user suppressed (#10), via
             an inline `# mutineer:disable-line` comment or a
             `.mutineer.yml` `ignore:` id. A pre-fork classification
             (never run); excluded from the denominator so a strong
             file can reach 100%.

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 and uncapturable are pre-fork selection results (M3/#9): both excluded from the score denominator.

subject, mutation, and id 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:, id:) so the Reporter can render survivor diffs and emit the stable id. id is the content-based MutantId (#10).

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



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

def details
  @details
end

#idObject (readonly)

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



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

def id
  @id
end

#mutationObject (readonly)

Returns the value of attribute mutation

Returns:

  • (Object)

    the current value of mutation



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

def mutation
  @mutation
end

#statusObject (readonly)

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



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

def status
  @status
end

#subjectObject (readonly)

Returns the value of attribute subject

Returns:

  • (Object)

    the current value of subject



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

def subject
  @subject
end

Class Method Details

.error(details = nil) ⇒ Mutineer::Result

Builds an error result.

Parameters:

  • details (String, nil) (defaults to: nil)

    error details.

Returns:



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

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

.ignoredMutineer::Result

Builds an ignored result.

Returns:



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

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

.killedMutineer::Result

Builds a killed result.

Returns:



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

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

.no_coverageMutineer::Result

Builds a no_coverage result.

Returns:



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

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

.skipped(details = nil) ⇒ Mutineer::Result

Builds a skipped result.

Parameters:

  • details (String, nil) (defaults to: nil)

    skip details.

Returns:



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

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

.survivedMutineer::Result

Builds a survived result.

Returns:



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

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

.timeoutMutineer::Result

Builds a timeout result.

Returns:



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

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

.uncapturableMutineer::Result

Builds an uncapturable result.

Returns:



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

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

Instance Method Details

#error?Boolean

Returns true when the status is error.

Returns:

  • (Boolean)

    true when the status is error.



81
82
# File 'lib/mutineer/result.rb', line 81

def error?        = status == :error
# @return [Boolean] true when the status is timeout.

#ignored?Boolean

Returns true when the status is ignored.

Returns:

  • (Boolean)

    true when the status is ignored.



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

def ignored?      = status == :ignored

#killed?Boolean

Returns true when the status is killed.

Returns:

  • (Boolean)

    true when the status is killed.



77
78
# File 'lib/mutineer/result.rb', line 77

def killed?       = status == :killed
# @return [Boolean] true when the status is survived.

#no_coverage?Boolean

Returns true when the status is no_coverage.

Returns:

  • (Boolean)

    true when the status is no_coverage.



87
88
# File 'lib/mutineer/result.rb', line 87

def no_coverage?  = status == :no_coverage
# @return [Boolean] true when the status is uncapturable.

#skipped?Boolean

Returns true when the status is skipped.

Returns:

  • (Boolean)

    true when the status is skipped.



85
86
# File 'lib/mutineer/result.rb', line 85

def skipped?      = status == :skipped
# @return [Boolean] true when the status is no_coverage.

#survived?Boolean

Returns true when the status is survived.

Returns:

  • (Boolean)

    true when the status is survived.



79
80
# File 'lib/mutineer/result.rb', line 79

def survived?     = status == :survived
# @return [Boolean] true when the status is error.

#timeout?Boolean

Returns true when the status is timeout.

Returns:

  • (Boolean)

    true when the status is timeout.



83
84
# File 'lib/mutineer/result.rb', line 83

def timeout?      = status == :timeout
# @return [Boolean] true when the status is skipped.

#uncapturable?Boolean

Returns true when the status is uncapturable.

Returns:

  • (Boolean)

    true when the status is uncapturable.



89
90
# File 'lib/mutineer/result.rb', line 89

def uncapturable? = status == :uncapturable
# @return [Boolean] true when the status is ignored.