aboutsummaryrefslogtreecommitdiff
path: root/cmd/krino/history_test.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 15:16:55 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 15:16:55 +0200
commit0b5d0eb92c5be2f0ddb2fa73990f31e5654e57fe (patch)
tree358e331945b8206ed4a72703e3aedfe8ea7cdcdb /cmd/krino/history_test.go
parent1d3f2d1e4c59867024470d3444e12698b7ebb22e (diff)
downloadkrino-0b5d0eb92c5be2f0ddb2fa73990f31e5654e57fe.tar.gz
krino-0b5d0eb92c5be2f0ddb2fa73990f31e5654e57fe.zip
krino: 0.0.5 — keyword cache, t and d in reviewv0.0.5
Diffstat (limited to 'cmd/krino/history_test.go')
-rw-r--r--cmd/krino/history_test.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/cmd/krino/history_test.go b/cmd/krino/history_test.go
index f76ac66..5d86b6f 100644
--- a/cmd/krino/history_test.go
+++ b/cmd/krino/history_test.go
@@ -182,6 +182,22 @@ func TestReviewUndoChoosePerFile(t *testing.T) {
}
}
+// TestReviewUndoWriteStopsAsking: [w] applies what was chosen so far; undo
+// offers no [t] or [d], so those are rejected keys there.
+func TestReviewUndoWriteStopsAsking(t *testing.T) {
+ out := new(strings.Builder)
+ approved, action, err := reviewUndoFiles(strings.NewReader("ctdyw"), out, undoFiles("a", "b", "c"), palette{})
+ if err != nil {
+ t.Fatal(err)
+ }
+ if action != 'c' || !approved[0] || approved[1] || approved[2] {
+ t.Errorf("approved = %v action = %q; want only index 0", approved, action)
+ }
+ if !strings.Contains(out.String(), "'t' is not y, n, a, w or q") || strings.Contains(out.String(), "[t]") {
+ t.Errorf("undo review should reject t and not offer it:\n%s", out)
+ }
+}
+
// TestReviewUndoRefusedFileNotPrompted is spec §10: a file PlanUndo already
// refused is shown (with its reason - covered end to end by
// TestUndoRefusesChangedDestination-style flows through cmdUndo) but never