Fix missing newline in zshrc, add test for hishtory redact prompting, and tag TODOs with plans

This commit is contained in:
David Dworken
2022-09-22 18:22:06 -07:00
parent bd70b68ffc
commit c6d4f1ef68
4 changed files with 26 additions and 4 deletions

View File

@ -1448,6 +1448,28 @@ ls /tmp`, randomCmdUuid, randomCmdUuid)
if diff := cmp.Diff(expectedOutput, out); diff != "" {
t.Fatalf("hishtory export mismatch (-expected +got):\n%s\nout=%#v", diff, out)
}
// Record another command
tester.RunInteractiveShell(t, `echo hello`)
out = tester.RunInteractiveShell(t, `hishtory export | grep -v pipefail`)
expectedOutput = "hishtory redact --force s\necho hello\n"
if diff := cmp.Diff(expectedOutput, out); diff != "" {
t.Fatalf("hishtory export mismatch (-expected +got):\n%s\nout=%#v", diff, out)
}
// Redact it without --force
out, err := tester.RunInteractiveShellRelaxed(t, `yes | hishtory redact hello`)
shared.Check(t, err)
if out != "This will permanently delete 1 entries, are you sure? [y/N]" {
t.Fatalf("hishtory redact gave unexpected output=%#v", out)
}
// And check it was redacted
out = tester.RunInteractiveShell(t, `hishtory export | grep -v pipefail`)
expectedOutput = "hishtory redact --force s\nyes | hishtory redact hello\n"
if diff := cmp.Diff(expectedOutput, out); diff != "" {
t.Fatalf("hishtory export mismatch (-expected +got):\n%s\nout=%#v", diff, out)
}
}
func testRemoteRedaction(t *testing.T, tester shellTester) {