summaryrefslogtreecommitdiff
path: root/tests/claude-code/test-executing-plans-scripts.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/claude-code/test-executing-plans-scripts.sh')
-rwxr-xr-xtests/claude-code/test-executing-plans-scripts.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/claude-code/test-executing-plans-scripts.sh b/tests/claude-code/test-executing-plans-scripts.sh
index 994733b..e4e3904 100755
--- a/tests/claude-code/test-executing-plans-scripts.sh
+++ b/tests/claude-code/test-executing-plans-scripts.sh
@@ -33,6 +33,8 @@ main() {
git init -q -b main "$TEST_ROOT/repo"
local repo
repo="$(cd "$TEST_ROOT/repo" && git rev-parse --show-toplevel)"
+ # Same spelling as the scripts print (pwd), not rev-parse's C:/... on Git Bash.
+ repo="$(cd "$repo" && pwd)"
local git_id=(-c user.email=t@example.com -c user.name=t -c commit.gpgsign=false)
cat > "$repo/plan.md" <<'PLAN'
@@ -127,6 +129,31 @@ PLAN
echo " got: $out"
fi
+ # --- task-done: records a passing task whose test command prints nothing ---
+ # https://github.com/obra/superpowers/issues/2385 -- under `set -euo
+ # pipefail`, the ledger's `grep -v '^[[:space:]]*$' log | tail -n 1`
+ # exits 1 on an empty/blank log, which used to abort the whole script
+ # (silently, no ledger line) even though the test command itself passed.
+ ( cd "$repo" && echo y > work2.txt && git add work2.txt && git "${git_id[@]}" commit -qm "task 2" )
+ local head2
+ head2="$(cd "$repo" && git rev-parse HEAD)"
+ rc=0
+ out="$(cd "$repo" && "$EP_SCRIPTS/task-done" plan.md 2 "$head" -- true 2>&1)" || rc=$?
+ if [[ "$rc" -eq 0 ]]; then
+ pass "task-done exits 0 when a passing test command prints nothing"
+ else
+ fail "task-done exits 0 when a passing test command prints nothing (got rc=$rc)"
+ echo " got: $out"
+ fi
+ local expected2="Task 2: complete (commits ${head:0:7}..${head2:0:7}, tests: true → (no output))"
+ if [[ -f "$ledger" ]] && grep -qF "$expected2" "$ledger"; then
+ pass "task-done records a passing task that printed no output"
+ else
+ fail "task-done records a passing task that printed no output"
+ echo " expected: $expected2"
+ echo " ledger:"; sed 's/^/ /' "$ledger" 2>/dev/null || echo " (missing)"
+ fi
+
echo
if [[ "$FAILURES" -eq 0 ]]; then
echo "PASS"