mirror of
https://github.com/unclebob/crapper.git
synced 2026-11-26 18:18:49 +00:00
Resolve Swift coverage regions through each function's filenames.
llvm-cov region[5] indexes that function's filenames, not unit["files"]. On Apple LLVM 21 those orders differ, so the span covering Place.swift line 5 was stored on test_entry_point.swift and the return stayed uncovered. Proved by tests/fixtures/swift/function-filenames.json, which failed before the fix (Place.swift received (1, 1, 1) instead of (4, 5, 1)). 226 pytest tests passed. crapper worst CRAP on coverage.py is 9.0. dryer found no candidates at 0.8 in coverage.py. mutator on coverage.py: 237 killed, 0 survived, 0 uncovered. Co-authored-by: Robert C. Martin <[email protected]>
This commit is contained in:
co-authored by
Robert C. Martin
parent
127ed34454
commit
53865e4a31
@@ -25,6 +25,11 @@ def function(**kwargs):
|
||||
return Function(**defaults)
|
||||
|
||||
|
||||
def test_a_single_covered_form_is_kept():
|
||||
html = '<span title="1 out of 1 forms covered"> 4 </span>'
|
||||
assert parse_form_coverage(html) == {4: (1, 1)}
|
||||
|
||||
|
||||
def test_cloverage_form_counts_and_lcov_lines():
|
||||
html = '<span class="pc" title="1 out of 2 forms covered"> 4 (if x 1)</span>'
|
||||
assert parse_form_coverage(html) == {4: (1, 2)}
|
||||
@@ -58,6 +63,11 @@ def test_lcov_branch_records_override_line_hits():
|
||||
assert bundle.percent_for(scored) == 50.0
|
||||
|
||||
|
||||
def test_an_untaken_branch_is_not_a_hit():
|
||||
text = "SF:src/demo/app.ts\nDA:3,1\nBRDA:3,0,0,0\nend_of_record\n"
|
||||
assert parse_lcov(text)["src/demo/app.ts"].branches[3] == (0, 1)
|
||||
|
||||
|
||||
def test_a_branch_count_that_is_not_a_number_is_ignored():
|
||||
text = "SF:src/demo/app.ts\nDA:3,1\nBRDA:3,0,0,nope\nend_of_record\n"
|
||||
parsed = parse_lcov(text)["src/demo/app.ts"]
|
||||
|
||||
Reference in New Issue
Block a user