Skip to content

Commit 6fc3fa3

Browse files
committed
docs(coverage): document branch coverage MVP
Adds the BRDA/BRF/BRH entry to the changelog and a "Branch Coverage Scope" section to docs/coverage.md spelling out the limitations (no-executable-line arms, implicit-else omission, compound conditional folding, untracked short-circuit and loop-entry decisions).
1 parent 6a41181 commit 6fc3fa3

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- npm registry distribution: `npm install -g bashunit` (#244)
1111
- `bashunit::env::supports_color` and `bashunit::io::clear_screen` helpers (#247)
1212
- LCOV reports now include `FN`, `FNDA`, `FNF` and `FNH` function records, consumed by `genhtml`, Codecov and Coveralls
13+
- LCOV reports now include `BRDA`, `BRF` and `BRH` branch records for `if`/`elif`/`else` chains and `case` patterns (see `adrs/adr-007-branch-coverage-mvp.md`)
1314
- `BASHUNIT_COVERAGE_SHOW_FUNCTIONS=true` adds a per-function coverage block to the text report
1415
- `BASHUNIT_COVERAGE_SHOW_UNCOVERED=true` adds an "Uncovered Lines" block to the text report, with consecutive line numbers compressed into ranges
1516

docs/coverage.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,3 +368,14 @@ Due to Bash's process model, hits produced inside a subshell are written to the
368368
- Functions invoked from `$( ... )`: the call site and surrounding lines are hit, but the function body lines are lost when called inside a subshell.
369369

370370
These contracts are pinned by `tests/unit/coverage_subshell_test.sh`.
371+
372+
### Branch Coverage Scope
373+
374+
The LCOV report includes `BRDA`/`BRF`/`BRH` records for `if`/`elif`/`else` chains and `case` patterns. An arm is reported as taken iff at least one executable line inside its range was hit. Known limitations:
375+
376+
- An arm whose body has no executable lines (e.g. only comments or braces) registers as not-taken even when the conditional fired.
377+
- Implicit `else` (an `if`/`elif` chain without an explicit `else`) reports only the explicit arms; the synthetic fall-through outcome is omitted.
378+
- Compound conditionals (`if A && B`) are reported as a single binary decision, not per sub-expression.
379+
- `&&`/`||` short-circuit branches outside `if` and loop-entry decisions (`while`/`until`) are not tracked.
380+
381+
See `adrs/adr-007-branch-coverage-mvp.md` for the full design rationale.

0 commit comments

Comments
 (0)