Add integration tests for escaping

This commit is contained in:
David Dworken 2023-02-13 22:43:55 -08:00
parent a5926af49c
commit 4b5b729328
No known key found for this signature in database

View File

@ -659,6 +659,21 @@ hishtory disable`)
if diff := cmp.Diff(expectedOutput, out); diff != "" { if diff := cmp.Diff(expectedOutput, out); diff != "" {
t.Fatalf("hishtory export mismatch (-expected +got):\n%s\nout=%#v", diff, out) t.Fatalf("hishtory export mismatch (-expected +got):\n%s\nout=%#v", diff, out)
} }
// Search using an escaped dash
out = tester.RunInteractiveShell(t, `hishtory export \\-echo`)
expectedOutput = "foo -echo\n"
if diff := cmp.Diff(expectedOutput, out); diff != "" {
t.Fatalf("hishtory export mismatch (-expected +got):\n%s\nout=%#v", diff, out)
}
// Search using a colon that doesn't match a column name
manuallySubmitHistoryEntry(t, userSecret, testutils.MakeFakeHistoryEntry("foo:bar"))
out = tester.RunInteractiveShell(t, `hishtory export foo\\:bar`)
expectedOutput = "foo:bar\n"
if diff := cmp.Diff(expectedOutput, out); diff != "" {
t.Fatalf("hishtory export mismatch (-expected +got):\n%s\nout=%#v", diff, out)
}
} }
func testUpdate(t *testing.T, tester shellTester) { func testUpdate(t *testing.T, tester shellTester) {