aboutsummaryrefslogtreecommitdiff
path: root/scripts/tests
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/tests')
-rw-r--r--scripts/tests/install-lang.bats17
-rw-r--r--scripts/tests/sync-language-bundle.bats62
2 files changed, 79 insertions, 0 deletions
diff --git a/scripts/tests/install-lang.bats b/scripts/tests/install-lang.bats
index 523be99..a26c3d5 100644
--- a/scripts/tests/install-lang.bats
+++ b/scripts/tests/install-lang.bats
@@ -25,6 +25,23 @@ teardown() {
[ -d "$PROJECT/.claude/rules" ]
[ -d "$PROJECT/githooks" ]
[ -f "$PROJECT/CLAUDE.md" ]
+ # The coverage-summary script ships inside the gitignored .claude footprint.
+ [ -f "$PROJECT/.claude/scripts/coverage-summary.el" ]
+}
+
+@test "install-lang elisp: seeds the project-owned coverage Makefile fragment" {
+ run bash "$INSTALL_LANG" elisp "$PROJECT"
+
+ [ "$status" -eq 0 ]
+ [ -f "$PROJECT/coverage-makefile.txt" ]
+}
+
+@test "install-lang elisp: does not overwrite an existing fragment without FORCE" {
+ echo "MY OWN VERSION" > "$PROJECT/coverage-makefile.txt"
+ run bash "$INSTALL_LANG" elisp "$PROJECT"
+
+ [ "$status" -eq 0 ]
+ grep -qxF "MY OWN VERSION" "$PROJECT/coverage-makefile.txt"
}
@test "install-lang elisp: gitignores the full Claude tooling footprint" {
diff --git a/scripts/tests/sync-language-bundle.bats b/scripts/tests/sync-language-bundle.bats
index e641646..5e3b912 100644
--- a/scripts/tests/sync-language-bundle.bats
+++ b/scripts/tests/sync-language-bundle.bats
@@ -29,6 +29,10 @@ install_bundle() {
mkdir -p "$proj/.claude/hooks"
cp -r "$REAL_REPO/languages/$lang/claude/hooks/." "$proj/.claude/hooks/"
fi
+ if [ -d "$REAL_REPO/languages/$lang/claude/scripts" ]; then
+ mkdir -p "$proj/.claude/scripts"
+ cp -r "$REAL_REPO/languages/$lang/claude/scripts/." "$proj/.claude/scripts/"
+ fi
if [ -f "$REAL_REPO/languages/$lang/claude/settings.json" ]; then
cp "$REAL_REPO/languages/$lang/claude/settings.json" "$proj/.claude/settings.json"
fi
@@ -120,6 +124,64 @@ install_team_overlay() {
[ -x "$PROJ/.claude/hooks/validate-el.sh" ]
}
+# --- Auto-fix: .claude/scripts ---
+
+@test "sync: drifted bundle script is auto-fixed and restored" {
+ install_bundle elisp "$PROJ"
+ echo ";; junk drift" >> "$PROJ/.claude/scripts/coverage-summary.el"
+ run bash "$SCRIPT" "$PROJ"
+ [ "$status" -eq 0 ]
+ [[ "$output" == *".claude/scripts/coverage-summary.el"* ]]
+ matches_canonical ".claude/scripts/coverage-summary.el" "$REAL_REPO/languages/elisp/claude/scripts/coverage-summary.el"
+}
+
+@test "sync: missing bundle script is re-copied" {
+ install_bundle elisp "$PROJ"
+ rm "$PROJ/.claude/scripts/coverage-summary.el"
+ run bash "$SCRIPT" "$PROJ"
+ [ "$status" -eq 0 ]
+ [[ "$output" == *".claude/scripts/coverage-summary.el"* ]]
+ [ -f "$PROJ/.claude/scripts/coverage-summary.el" ]
+}
+
+# --- Project-owned: Makefile fragment via inbox ---
+
+@test "sync: coverage Makefile fragment is dropped into .ai/inbox when present" {
+ install_bundle elisp "$PROJ"
+ mkdir -p "$PROJ/.ai/inbox"
+ run bash "$SCRIPT" "$PROJ"
+ [ "$status" -eq 0 ]
+ [[ "$output" == *"inbox"* ]]
+ [ -f "$PROJ/.ai/inbox/from-rulesets-coverage-makefile.txt" ]
+ matches_canonical ".ai/inbox/from-rulesets-coverage-makefile.txt" "$REAL_REPO/languages/elisp/coverage-makefile.txt"
+}
+
+@test "sync: no .ai/inbox means no fragment drop and no empty .ai/ created" {
+ install_bundle elisp "$PROJ"
+ run bash "$SCRIPT" "$PROJ"
+ [ "$status" -eq 0 ]
+ [[ "$output" != *"inbox"* ]]
+ [ ! -d "$PROJ/.ai" ]
+}
+
+@test "sync: fragment already adopted at project root is not re-dropped" {
+ install_bundle elisp "$PROJ"
+ mkdir -p "$PROJ/.ai/inbox"
+ cp "$REAL_REPO/languages/elisp/coverage-makefile.txt" "$PROJ/coverage-makefile.txt"
+ run bash "$SCRIPT" "$PROJ"
+ [ "$status" -eq 0 ]
+ [ ! -f "$PROJ/.ai/inbox/from-rulesets-coverage-makefile.txt" ]
+}
+
+@test "sync: fragment already waiting in inbox is not duplicated" {
+ install_bundle elisp "$PROJ"
+ mkdir -p "$PROJ/.ai/inbox"
+ cp "$REAL_REPO/languages/elisp/coverage-makefile.txt" "$PROJ/.ai/inbox/from-rulesets-coverage-makefile.txt"
+ run bash "$SCRIPT" "$PROJ"
+ [ "$status" -eq 0 ]
+ [[ "$output" != *"inbox"* ]]
+}
+
# --- Surface-only: settings.json ---
@test "sync: drifted settings.json is surfaced, NOT modified, exit 3" {