mirror of
https://github.com/ddworken/hishtory.git
synced 2024-12-27 01:08:53 +01:00
Add test for quoting dashes
This commit is contained in:
parent
df2be5cfe2
commit
7550310167
@ -2114,6 +2114,14 @@ func testTui_search(t *testing.T, onlineStatus OnlineStatus) {
|
||||
"'\"'foo:bar'\"'",
|
||||
}))
|
||||
testutils.CompareGoldens(t, out, "TestTui-SearchColonDoubleQuoted")
|
||||
|
||||
// And check that we can quote dashes
|
||||
require.NoError(t, db.Create(testutils.MakeFakeHistoryEntry("foo --bar")).Error)
|
||||
out = stripTuiCommandPrefix(t, captureTerminalOutput(t, tester, []string{
|
||||
"hishtory SPACE tquery ENTER",
|
||||
"'\"'--bar'\"'",
|
||||
}))
|
||||
testutils.CompareGoldens(t, out, "TestTui-SearchQuoteDash")
|
||||
}
|
||||
|
||||
func testTui_general(t *testing.T, onlineStatus OnlineStatus) {
|
||||
|
@ -995,9 +995,7 @@ func splitEscaped(query string, separator rune, maxSplit int) []string {
|
||||
token = append(token, runeQuery[i])
|
||||
}
|
||||
}
|
||||
if string(token) != "" {
|
||||
tokens = append(tokens, string(token))
|
||||
}
|
||||
tokens = append(tokens, string(token))
|
||||
return tokens
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user