Fix bug where typing 'foo:' and then hitting backspace would lead to the error still being displayed

This commit is contained in:
David Dworken
2023-02-19 22:08:38 -08:00
parent 091f37e4a2
commit b69788967f
3 changed files with 36 additions and 2 deletions

View File

@@ -1839,7 +1839,7 @@ func TestTui(t *testing.T) {
out = strings.TrimSpace(strings.Split(out, "hishtory tquery")[1])
testutils.CompareGoldens(t, out, "TestTui-InitialInvalidSearch")
// Check the output when the initial search is invalid
// Check the output when the search is invalid
out = captureTerminalOutput(t, tester, []string{
"hishtory SPACE tquery ENTER",
"ls:",
@@ -1847,6 +1847,14 @@ func TestTui(t *testing.T) {
out = strings.TrimSpace(strings.Split(out, "hishtory tquery")[1])
testutils.CompareGoldens(t, out, "TestTui-InvalidSearch")
// Check the output when the search is invalid and then edited to become valid
out = captureTerminalOutput(t, tester, []string{
"hishtory SPACE tquery ENTER",
"ls: BSpace",
})
out = strings.TrimSpace(strings.Split(out, "hishtory tquery")[1])
testutils.CompareGoldens(t, out, "TestTui-InvalidSearchBecomesValid")
// Check the output when the size is smaller
out = captureTerminalOutputWithShellNameAndDimensions(t, tester, tester.ShellName(), 100, 20, []TmuxCommand{
{Keys: "hishtory SPACE tquery ENTER"},