aboutsummaryrefslogtreecommitdiff
path: root/cmd/krino/history_test.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 23:07:57 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 23:07:57 +0200
commitc66a842ce4679a3ffa5504dad39b1402bea75e9f (patch)
tree9e9db5e569b9f16a4ca4e66d0a5b0f456a186ece /cmd/krino/history_test.go
parentb013e5fb87580e4cab0d85a0d2c8bb402c610413 (diff)
downloadkrino-c66a842ce4679a3ffa5504dad39b1402bea75e9f.tar.gz
krino-c66a842ce4679a3ffa5504dad39b1402bea75e9f.zip
plan 10 re-check: cut run column, damaged undo run, emptied directory cleanup, text turning binary, explain flags, interrupt docsv0.0.7
Diffstat (limited to 'cmd/krino/history_test.go')
-rw-r--r--cmd/krino/history_test.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/cmd/krino/history_test.go b/cmd/krino/history_test.go
index 7c0f810..9c409bc 100644
--- a/cmd/krino/history_test.go
+++ b/cmd/krino/history_test.go
@@ -142,11 +142,14 @@ func TestFinalizeUndoPlanMarksUnapprovedAsDeclined(t *testing.T) {
{File: "a"}, // index 0: approved
{File: "b"}, // index 1: not approved -> declined
{File: "c", Refused: "gone"}, // index 2: refused, never declined
- }}
+ }, Cleanup: []engine.UndoFile{{File: "d"}}}
out, _ := finalizeUndoPlan(up, map[int]bool{0: true}, 'c')
if len(out.Files) != 3 {
t.Fatalf("files = %+v, want all three carried through", out.Files)
}
+ if len(out.Cleanup) != 1 || out.Cleanup[0].File != "d" {
+ t.Errorf("Cleanup = %+v, want the plan's directory cleanup carried over", out.Cleanup)
+ }
if out.Files[0].Declined || out.Files[0].Refused != "" {
t.Errorf("approved file changed: %+v", out.Files[0])
}
@@ -542,6 +545,10 @@ func TestIgnoredGlobalFlagsAreRefused(t *testing.T) {
{"-v", "log"},
{"--json", "undo", "-n"},
{"-v", "undo", "-n"},
+ {"-y", "explain", dl},
+ {"-n", "explain", dl},
+ {"--json", "explain", dl},
+ {"-v", "explain", dl},
} {
if code, _, errOut := runCLI(t, args...); code != 2 || !strings.Contains(errOut, "does not take") {
t.Errorf("krino %q: exit %d, stderr %q; want 2, refused", args, code, errOut)