Add an advanced search test for control-r

This commit is contained in:
David Dworken 2022-10-27 22:07:11 -07:00
parent 043e815716
commit 0fbf7178c3
3 changed files with 38 additions and 1 deletions

View File

@ -1858,6 +1858,17 @@ func testControlR(t *testing.T, tester shellTester, shellName string) {
}
compareGoldens(t, out, "testControlR-Search")
// An advanced search and check that the table is updated
out = captureTerminalOutputWithShellName(t, tester, shellName, []string{"C-R", "cwd:/tmp/ SPACE ls"})
out = strings.TrimSpace(out)
if tester.ShellName() == "bash" {
if !strings.Contains(out, "\n\n\n") {
t.Fatalf("failed to find separator in %#v", out)
}
out = strings.TrimSpace(strings.Split(out, "\n\n\n")[1])
}
compareGoldens(t, out, "testControlR-AdvancedSearch")
// Disable control-r
_, _ = tester.RunInteractiveShellRelaxed(t, `hishtory config-set enable-control-r false`)
// And it shouldn't pop up

View File

@ -0,0 +1,26 @@
Search Query: > cwd:/tmp/ ls
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Hostname CWD Timestamp Runtime Exit Code Command │
│────────────────────────────────────────────────────────────────────────────────────────────────────────│
│ localhost /tmp/ Oct 17 2022 21:43:26 PDT 3s 2 ls ~/bar/ │
│ localhost /tmp/ Oct 17 2022 21:43:21 PDT 3s 2 ls ~/foo/ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└────────────────────────────────────────────────────────────────────────────────────────────────────────┘

View File

@ -1,4 +1,4 @@
caSearch Query: > echo
Search Query: > echo
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Hostname CWD Timestamp Runtime Exit Code Command │