diff options
Diffstat (limited to 'cmd/krino/history_test.go')
| -rw-r--r-- | cmd/krino/history_test.go | 16 |
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 |
