Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Unreleased

### Fixed
- Coverage counts every line of a multi-line statement as covered once the statement has run, not only the line Bash reported it on. An array literal written one element per line used to cost one uncovered line per element — and on Bash 3.2, where the assignment is reported on its closing `)`, the hit was discarded outright and the whole array read as uncovered. Multi-line strings and heredoc bodies had the same gap; a multi-line `$( )` is left alone, since its interior lines are commands that are tracked in their own right (#1338)
- Coverage propagates execution counts across multiline array literals, quoted strings, heredocs and backslash continuations, including when Bash 3.x records an array assignment on its closing `)`. Commands inside command and process substitutions remain individually tracked, even within quotes or arrays (#1338)

## [0.50.1](https://github.com/TypedDevs/bashunit/compare/0.50.0...0.50.1) - 2026-08-22

Expand Down
11 changes: 6 additions & 5 deletions docs/coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,8 @@ commands=( # covered
Every line still counts toward the denominator, so a multi-line statement that
never runs reports as several uncovered lines, exactly as it did before.

A multi-line command substitution is deliberately **not** treated this way:
Commands inside a multi-line command or process substitution are tracked
individually, including substitutions inside a quoted string or array:

```bash
result=$(
Expand All @@ -456,10 +457,10 @@ result=$(
)
```

`compute_a` and `compute_b` are commands in their own right and are tracked
individually, so crediting them from the line that opened the substitution
would report lines that never ran. (Before Bash 4 the tracer does not reach a
subshell at all see [Subshell Behavior](#subshell-behavior).)
Crediting `compute_a` and `compute_b` from the line that opened the substitution
would report lines that never ran. Multiline literals inside the substitution
still receive coverage from their own execution. (Before Bash 4 the tracer does
not reach a subshell at all; see [Subshell Behavior](#subshell-behavior).)

## Branch Coverage

Expand Down
Loading
Loading