#!/usr/bin/env bats # # Coverage tests for scripts/lint.sh. # # lint.sh sweeps scripts/*.sh, languages/*/claude/hooks/*.sh, and # languages/*/githooks/* through check_hook (shebang present, executable bit # set). It never touched claude-templates/bin/ — the four scripts `make install` # symlinks into ~/.local/bin, so the most exposed shell in the repo was the only # shell with no gate over it (found 2026-07-24). # # These tests pin the coverage itself rather than the current cleanliness: they # plant a deliberately broken file in each swept location and assert lint.sh # complains. A location that stops being swept fails here. REPO_ROOT="$(cd "$(dirname "$BATS_TEST_FILENAME")/../.." && pwd)" LINT="$REPO_ROOT/scripts/lint.sh" teardown() { [ -n "${PLANTED:-}" ] && rm -f "$PLANTED" PLANTED="" } @test "lint: a bin/ script missing its shebang is flagged" { PLANTED="$REPO_ROOT/claude-templates/bin/zz-test-noshebang" printf 'echo hi\n' > "$PLANTED" chmod +x "$PLANTED" run bash "$LINT" [[ "$output" == *"zz-test-noshebang"* ]] || { echo "lint.sh did not report the planted bin/ script — that path is unswept" echo "$output" return 1 } } @test "lint: a bin/ script that is not executable is flagged" { PLANTED="$REPO_ROOT/claude-templates/bin/zz-test-noexec" printf '#!/usr/bin/env bash\necho hi\n' > "$PLANTED" chmod -x "$PLANTED" run bash "$LINT" [[ "$output" == *"zz-test-noexec"* ]] } @test "lint: the existing scripts/ sweep still works (guards the regression)" { PLANTED="$REPO_ROOT/scripts/zz-test-noshebang.sh" printf 'echo hi\n' > "$PLANTED" chmod +x "$PLANTED" run bash "$LINT" [[ "$output" == *"zz-test-noshebang.sh"* ]] } @test "lint: the real tree passes (no planted file)" { run bash "$LINT" [ "$status" -eq 0 ] }