Add control-r tests for changing the displayed columns

This commit is contained in:
David Dworken 2022-10-27 22:11:57 -07:00
parent 0fbf7178c3
commit d3c631b191
2 changed files with 38 additions and 0 deletions

View File

@ -1869,6 +1869,18 @@ func testControlR(t *testing.T, tester shellTester, shellName string) {
}
compareGoldens(t, out, "testControlR-AdvancedSearch")
// Set some different columns to be displayed and check that the table displays those
tester.RunInteractiveShell(t, `hishtory config-set displayed-columns Hostname 'Exit Code' Command`)
out = captureTerminalOutputWithShellName(t, tester, shellName, []string{"C-R"})
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-CustomColumns")
// 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: > ls
┌────────────────────────────────────────────────────┐
│ Hostname Exit Code Command │
│────────────────────────────────────────────────────│
│ localhost 2 echo 'bar' & │
│ localhost 2 echo 'aaaaaa bbbb' │
│ localhost 2 ls ~/bar/ │
│ localhost 2 ls ~/foo/ │
│ server 127 ls ~/ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└────────────────────────────────────────────────────┘