mirror of
https://github.com/ddworken/hishtory.git
synced 2024-11-26 18:23:27 +01:00
Add an advanced search test for control-r
This commit is contained in:
parent
043e815716
commit
0fbf7178c3
@ -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
|
||||
|
26
client/lib/goldens/testControlR-AdvancedSearch
Normal file
26
client/lib/goldens/testControlR-AdvancedSearch
Normal 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/ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
└────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
@ -1,4 +1,4 @@
|
||||
caSearch Query: > echo
|
||||
Search Query: > echo
|
||||
|
||||
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Hostname CWD Timestamp Runtime Exit Code Command │
|
||||
|
Loading…
Reference in New Issue
Block a user