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