Close the 3 real remaining coverage gaps
- vault_index.sh: grep fallback for frontmatter tag extraction when rg is unavailable (had this for vault_search.sh/vault_backlinks.sh, not vault_index.sh). - git_cmd.bats: registered repo path that's a file, not a directory (had the obsidian equivalent, not git-manager's). - git_cmd.bats: missing python3 in resolve_repo_path (previously only tested via setup.sh/vault_index.sh, not git_cmd.sh's own _lib.sh). 76 tests now (was 73). kcov: 87.84% (260/296 lines), up from 86.15% -- both target files (vault_index.sh, git-manager _lib.sh) now at 100%. Remaining gap is entirely kcov's inability to trace multi-line python3/awk/jq blocks and bash 'case pattern) ;;' no-op branches, confirmed by checking hit counts on the surrounding lines -- not further closeable by adding tests.
This commit is contained in:
@@ -109,6 +109,23 @@ setup() {
|
|||||||
[[ "$output" == *"== Repo: $REPO =="* ]]
|
[[ "$output" == *"== Repo: $REPO =="* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "a registered path that is a file, not a directory, errors" {
|
||||||
|
FILE_PATH="$BATS_TEST_TMPDIR/not-a-dir"
|
||||||
|
echo "just a file" > "$FILE_PATH"
|
||||||
|
write_git_manager_config "$CONFIG_FILE" "plain=$FILE_PATH"
|
||||||
|
run "$SCRIPT" status --repo plain
|
||||||
|
[ "$status" -eq 1 ]
|
||||||
|
[[ "$output" == *"is not a directory"* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "missing python3 fails with a clear error instead of a silent crash" {
|
||||||
|
write_git_manager_config "$CONFIG_FILE" "myrepo=$REPO"
|
||||||
|
hide_command python3
|
||||||
|
run "$SCRIPT" status --repo myrepo
|
||||||
|
[ "$status" -eq 1 ]
|
||||||
|
[[ "$output" == *"python3 is required"* ]]
|
||||||
|
}
|
||||||
|
|
||||||
# --- -- passthrough ---
|
# --- -- passthrough ---
|
||||||
|
|
||||||
@test "args after -- reach git unmodified" {
|
@test "args after -- reach git unmodified" {
|
||||||
|
|||||||
@@ -34,6 +34,15 @@ setup() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "grep fallback still extracts tags when rg is unavailable" {
|
||||||
|
hide_command rg
|
||||||
|
run "$SCRIPT" v
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
for tag in dns homelab networking overview; do
|
||||||
|
[[ "$output" == *"$tag"* ]]
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
@test "a note matching *overview* is flagged as a possible MOC file" {
|
@test "a note matching *overview* is flagged as a possible MOC file" {
|
||||||
run "$SCRIPT" v
|
run "$SCRIPT" v
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|||||||
Reference in New Issue
Block a user