control-r tests for fish with a search atom

This commit is contained in:
David Dworken 2022-10-22 11:58:59 -07:00
parent 1c561f5cc8
commit dbccaebf85

View File

@ -1748,7 +1748,6 @@ func captureTerminalOutputWithShellName(t *testing.T, tester shellTester, overri
return strings.TrimSpace(tester.RunInteractiveShell(t, fullCommand)) return strings.TrimSpace(tester.RunInteractiveShell(t, fullCommand))
} }
// TODO: the below, but for fish
func testControlR(t *testing.T, tester shellTester, shellName string) { func testControlR(t *testing.T, tester shellTester, shellName string) {
// Setup // Setup
defer shared.BackupAndRestore(t)() defer shared.BackupAndRestore(t)()
@ -1831,13 +1830,10 @@ func testControlR(t *testing.T, tester shellTester, shellName string) {
} }
// Search using an atom // Search using an atom
if shellName != "fish" { out = captureTerminalOutputWithShellName(t, tester, shellName, []string{"C-R", "fo", "BSpace BSpace", "exit_code:2", "Enter"})
// TODO: why does this fail in fish??? if !strings.HasSuffix(out, " echo 'bar' &") {
out = captureTerminalOutputWithShellName(t, tester, shellName, []string{"C-R", "fo", "BSpace BSpace", "exit_code:127", "ENTER"})
if !strings.HasSuffix(out, " ls ~/") {
t.Fatalf("hishtory tquery returned the wrong result, out=%#v", out) t.Fatalf("hishtory tquery returned the wrong result, out=%#v", out)
} }
}
// Search and check that the table is updated // Search and check that the table is updated
out = captureTerminalOutputWithShellName(t, tester, shellName, []string{"C-R", "echo"}) out = captureTerminalOutputWithShellName(t, tester, shellName, []string{"C-R", "echo"})