mirror of
https://github.com/ddworken/hishtory.git
synced 2025-02-02 11:39:24 +01:00
Add control-r tests for changing the displayed columns
This commit is contained in:
parent
0fbf7178c3
commit
d3c631b191
@ -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
|
||||
|
26
client/lib/goldens/testControlR-CustomColumns
Normal file
26
client/lib/goldens/testControlR-CustomColumns
Normal 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 ~/ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
└────────────────────────────────────────────────────┘
|
Loading…
Reference in New Issue
Block a user