Module: Evilution::Integration::TestUnit::ResultBuilder Private

Defined in:
lib/evilution/integration/test_unit/result_builder.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Shapes the result Hash that flows back to Evilution::Result::MutationResult / classify_status. Three orthogonal flavours — pass/fail/crash, no tests executed, and unresolved spec — each have their own change axis (e.g. the no-tests-ran error string evolved separately as the test-unit framework diagnostic improved). Putting them behind a single object documents the contract and lets the integration class drop them.

Class Method Summary collapse

Class Method Details

.call(passed:, command:, detector:) ⇒ Object

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.



14
15
16
17
18
19
20
21
22
# File 'lib/evilution/integration/test_unit/result_builder.rb', line 14

def call(passed:, command:, detector:)
  if passed
    { passed: true, test_command: command }
  elsif detector.only_crashes?
    crash(command, detector)
  else
    { passed: false, test_command: command }
  end
end

.crash(command, detector) ⇒ Object

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.



43
44
45
46
47
48
49
50
51
52
# File 'lib/evilution/integration/test_unit/result_builder.rb', line 43

def crash(command, detector)
  classes = detector.unique_crash_classes
  {
    passed: false,
    test_crashed: true,
    error: "test crashes: #{detector.crash_summary}",
    error_class: (classes.first if classes.length == 1),
    test_command: command
  }
end

.no_tests_ran(command) ⇒ Object

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.



24
25
26
27
28
29
30
31
32
# File 'lib/evilution/integration/test_unit/result_builder.rb', line 24

def no_tests_ran(command)
  {
    passed: false,
    error: "no Test::Unit tests executed (0 test methods ran) — the resolved " \
           "spec registered no Test::Unit suite. Check --integration/--spec.",
    error_class: "Evilution::Error",
    test_command: command
  }
end

.unresolved(mutation_file_path) ⇒ Object

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.



34
35
36
37
38
39
40
41
# File 'lib/evilution/integration/test_unit/result_builder.rb', line 34

def unresolved(mutation_file_path)
  {
    passed: false,
    unresolved: true,
    error: "no matching test resolved for #{mutation_file_path}",
    test_command: "ruby -Itest (skipped: no test resolved for #{mutation_file_path})"
  }
end