mirror of
https://github.com/ddworken/hishtory.git
synced 2025-08-18 18:58:54 +02:00
Add support for quotes around colons when searching (#162)
This commit is contained in:
@@ -1923,7 +1923,27 @@ func testTui_search(t *testing.T, onlineStatus OnlineStatus) {
|
||||
}))
|
||||
testutils.CompareGoldens(t, out, "TestTui-SearchBackslash")
|
||||
|
||||
// TODO: Add a test for the behavior when quoting something containing a colon
|
||||
// Add another entry for testing quoting a colon
|
||||
require.NoError(t, db.Create(testutils.MakeFakeHistoryEntry("foo:bar")).Error)
|
||||
out = tester.RunInteractiveShell(t, `hishtory export`)
|
||||
testutils.CompareGoldens(t, out, "TestTui-ExportWithEvenMoreEntries")
|
||||
|
||||
// And check that we can quote colons
|
||||
out = stripTuiCommandPrefix(t, captureTerminalOutput(t, tester, []string{
|
||||
"hishtory SPACE tquery ENTER",
|
||||
"foo:bar",
|
||||
}))
|
||||
testutils.CompareGoldens(t, out, "TestTui-SearchColonError")
|
||||
out = stripTuiCommandPrefix(t, captureTerminalOutput(t, tester, []string{
|
||||
"hishtory SPACE tquery ENTER",
|
||||
"foo\\\\:bar",
|
||||
}))
|
||||
testutils.CompareGoldens(t, out, "TestTui-SearchColonEscaped")
|
||||
out = stripTuiCommandPrefix(t, captureTerminalOutput(t, tester, []string{
|
||||
"hishtory SPACE tquery ENTER",
|
||||
"'\"'foo:bar'\"'",
|
||||
}))
|
||||
testutils.CompareGoldens(t, out, "TestTui-SearchColonDoubleQuoted")
|
||||
}
|
||||
|
||||
func testTui_general(t *testing.T, onlineStatus OnlineStatus) {
|
||||
|
Reference in New Issue
Block a user