Skip to content

Commit 3ee3916

Browse files
committed
fix: src/coverage.sh
1 parent 50272bd commit 3ee3916

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
### Fixed
1212
- Coverage now excludes control flow keywords (`then`, `else`, `fi`, `do`, `done`, `esac`, `;;`, case patterns) from line tracking
13+
- Coverage HTML report now correctly handles namespaced functions with colons (e.g., `bashunit::assert::equals`)
1314

1415
## [0.31.0](https://github.com/TypedDevs/bashunit/compare/0.30.0...0.31.0) - 2025-12-19
1516

src/coverage.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ function bashunit::coverage::extract_functions() {
479479

480480
# Function ended
481481
if [[ $brace_count -le 0 ]]; then
482-
echo "${current_fn}:${fn_start}:${lineno}"
482+
echo "${current_fn}|${fn_start}|${lineno}"
483483
in_function=0
484484
current_fn=""
485485
brace_count=0
@@ -489,7 +489,7 @@ function bashunit::coverage::extract_functions() {
489489

490490
# Handle unclosed function (shouldn't happen in valid code)
491491
if [[ $in_function -eq 1 && -n "$current_fn" ]]; then
492-
echo "${current_fn}:${fn_start}:${lineno}"
492+
echo "${current_fn}|${fn_start}|${lineno}"
493493
fi
494494
}
495495

@@ -1450,10 +1450,10 @@ EOF
14501450
while IFS= read -r fn_entry; do
14511451
[[ -z "$fn_entry" ]] && continue
14521452
local fn_name fn_start fn_end
1453-
fn_name="${fn_entry%%:*}"
1454-
local rest="${fn_entry#*:}"
1455-
fn_start="${rest%%:*}"
1456-
fn_end="${rest#*:}"
1453+
fn_name="${fn_entry%%|*}"
1454+
local rest="${fn_entry#*|}"
1455+
fn_start="${rest%%|*}"
1456+
fn_end="${rest#*|}"
14571457

14581458
# Calculate function coverage using pre-loaded hits data
14591459
local fn_executable=0

0 commit comments

Comments
 (0)