Class: SixthSense::Adapters::TestUnit
Defined Under Namespace
Classes: Parser
Constant Summary
collapse
- ASSERTION_PREFIXES =
%w[assert assert_ flunk].freeze
Instance Method Summary
collapse
#assertion_patterns, #checked_coverage_test_command, #coverage_test_command, for_path, #mutation_test_command, register, registry
Instance Method Details
#handles?(path) ⇒ Boolean
15
16
17
18
19
20
|
# File 'lib/sixth_sense/adapters/test_unit.rb', line 15
def handles?(path)
return false unless path.end_with?("_test.rb")
return false unless File.file?(path)
File.read(path).match?(/\bTest::Unit::TestCase\b/)
end
|
#map_to_sut(test_file) ⇒ Object
48
49
50
|
# File 'lib/sixth_sense/adapters/test_unit.rb', line 48
def map_to_sut(test_file)
map_to_sut_path(test_file.path)
end
|
#mutation_session(test_files:) ⇒ Object
44
45
46
|
# File 'lib/sixth_sense/adapters/test_unit.rb', line 44
def mutation_session(test_files:)
{ framework: :test_unit, test_files: test_files.map(&:path), runner: "ruby" }
end
|
#parse(path) ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/sixth_sense/adapters/test_unit.rb', line 22
def parse(path)
parsed = Prism.parse_file(path)
unless parsed.success?
messages = parsed.errors.map(&:message).join(", ")
raise Error, "failed to parse #{path}: #{messages}"
end
Model::TestFile.new(
path: path,
framework: :test_unit,
test_cases: Parser.new(path, parsed.value).test_cases,
sut_candidates: map_to_sut_path(path),
metadata: {}
)
end
|
#run_with_coverage(test_files:, isolation:) ⇒ Object
38
39
40
41
42
|
# File 'lib/sixth_sense/adapters/test_unit.rb', line 38
def run_with_coverage(test_files:, isolation:)
require_relative "../runners/coverage_runner"
Runners::CoverageRunner.new.run(test_files: test_files, isolation: isolation)
end
|