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



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

def details
  @details
end

#idObject (readonly)

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



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

def id
  @id
end

#mutationObject (readonly)

Returns the value of attribute mutation

Returns:

  • (Object)

    the current value of mutation



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

def mutation
  @mutation
end

#statusObject (readonly)

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



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

def status
  @status
end

#subjectObject (readonly)

Returns the value of attribute subject

Returns:

  • (Object)

    the current value of subject



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

def subject
  @subject
end

Class Method Details

.error(details = nil) ⇒ Object



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

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

.ignoredObject



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

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

.killedObject



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

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

.no_coverageObject



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

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

.skipped(details = nil) ⇒ Object



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

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

.survivedObject



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

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

.timeoutObject



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

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

.uncapturableObject



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

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

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


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

def error?        = status == :error

#ignored?Boolean

Returns:

  • (Boolean)


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

def ignored?      = status == :ignored

#killed?Boolean

Returns:

  • (Boolean)


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

def killed?       = status == :killed

#no_coverage?Boolean

Returns:

  • (Boolean)


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

def no_coverage?  = status == :no_coverage

#skipped?Boolean

Returns:

  • (Boolean)


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

def skipped?      = status == :skipped

#survived?Boolean

Returns:

  • (Boolean)


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

def survived?     = status == :survived

#timeout?Boolean

Returns:

  • (Boolean)


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

def timeout?      = status == :timeout

#uncapturable?Boolean

Returns:

  • (Boolean)


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

def uncapturable? = status == :uncapturable