diff options
Diffstat (limited to 'scripts/tests/ai-launcher-characterization.bats')
| -rw-r--r-- | scripts/tests/ai-launcher-characterization.bats | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/scripts/tests/ai-launcher-characterization.bats b/scripts/tests/ai-launcher-characterization.bats index f53855f..5b93ff3 100644 --- a/scripts/tests/ai-launcher-characterization.bats +++ b/scripts/tests/ai-launcher-characterization.bats @@ -120,6 +120,14 @@ _mk_repo_upstream() { [ "$output" = " (no upstream dirty)" ] } +@test "git_status_indicator: inbox-only delivery is visible but not called dirty" { + _mk_repo "$WORK/r" + mkdir -p "$WORK/r/inbox" + touch "$WORK/r/inbox/from-home.org" + run git_status_indicator "$WORK/r" + [ "$output" = " (no upstream inbox)" ] +} + @test "git_status_indicator: in-sync tracked repo reads (✓)" { _mk_repo_upstream "$WORK/r" run git_status_indicator "$WORK/r" @@ -142,6 +150,39 @@ _mk_repo_upstream() { [ "$output" = " (↓1)" ] } +@test "auto_pull_if_clean fast-forwards with an untracked inbox delivery" { + _mk_repo_upstream "$WORK/r" + git clone -q "$WORK/r.remote" "$WORK/writer" + git -C "$WORK/writer" config user.email t@example.com + git -C "$WORK/writer" config user.name tester + git -C "$WORK/writer" commit -q --allow-empty -m remote + git -C "$WORK/writer" push -q + git -C "$WORK/r" fetch -q + mkdir -p "$WORK/r/inbox" + printf 'handoff\n' >"$WORK/r/inbox/from-home.org" + + run auto_pull_if_clean "$WORK/r" + [ "$status" -eq 0 ] + [ "$(git -C "$WORK/r" rev-parse HEAD)" = "$(git -C "$WORK/r" rev-parse '@{u}')" ] + [ -f "$WORK/r/inbox/from-home.org" ] +} + +@test "auto_pull_if_clean refuses a non-inbox untracked file" { + _mk_repo_upstream "$WORK/r" + git clone -q "$WORK/r.remote" "$WORK/writer" + git -C "$WORK/writer" config user.email t@example.com + git -C "$WORK/writer" config user.name tester + git -C "$WORK/writer" commit -q --allow-empty -m remote + git -C "$WORK/writer" push -q + git -C "$WORK/r" fetch -q + printf 'scratch\n' >"$WORK/r/scratch" + before="$(git -C "$WORK/r" rev-parse HEAD)" + + run auto_pull_if_clean "$WORK/r" + [ "$status" -eq 0 ] + [ "$(git -C "$WORK/r" rev-parse HEAD)" = "$before" ] +} + # --- annotate_candidates() ---------------------------------------------------- @test "annotate_candidates: appends each candidate's status suffix" { |
