mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-20 03:47:54 +02:00
Add extra colored assertion for removing duplicate rows to debug an interesting test failure for highlighting search matches
This commit is contained in:
parent
3c33513fa3
commit
4c89010874
@ -2540,13 +2540,31 @@ echo foo`)
|
|||||||
|
|
||||||
// And change the config to filter out duplicate rows
|
// And change the config to filter out duplicate rows
|
||||||
tester.RunInteractiveShell(t, `hishtory config-set filter-duplicate-commands true`)
|
tester.RunInteractiveShell(t, `hishtory config-set filter-duplicate-commands true`)
|
||||||
|
|
||||||
|
// Check export
|
||||||
out = tester.RunInteractiveShell(t, `hishtory export -pipefail`)
|
out = tester.RunInteractiveShell(t, `hishtory export -pipefail`)
|
||||||
testutils.CompareGoldens(t, out, "testRemoveDuplicateRows-enabled-export")
|
testutils.CompareGoldens(t, out, "testRemoveDuplicateRows-enabled-export")
|
||||||
|
|
||||||
|
// Check query
|
||||||
out = tester.RunInteractiveShell(t, `hishtory query -pipefail`)
|
out = tester.RunInteractiveShell(t, `hishtory query -pipefail`)
|
||||||
testutils.CompareGoldens(t, out, "testRemoveDuplicateRows-enabled-query")
|
testutils.CompareGoldens(t, out, "testRemoveDuplicateRows-enabled-query")
|
||||||
|
|
||||||
|
// Check tquery
|
||||||
out = captureTerminalOutput(t, tester, []string{"hishtory SPACE tquery SPACE -pipefail ENTER"})
|
out = captureTerminalOutput(t, tester, []string{"hishtory SPACE tquery SPACE -pipefail ENTER"})
|
||||||
out = stripRequiredPrefix(t, out, "hishtory tquery -pipefail")
|
out = stripRequiredPrefix(t, out, "hishtory tquery -pipefail")
|
||||||
testutils.CompareGoldens(t, out, "testRemoveDuplicateRows-enabled-tquery")
|
testutils.CompareGoldens(t, out, "testRemoveDuplicateRows-enabled-tquery")
|
||||||
|
|
||||||
|
// Check scrolling with query (with colors so we can confirm it, though this part is MacOS only)
|
||||||
|
if runtime.GOOS == "darwin" {
|
||||||
|
out = captureTerminalOutputComplex(t, TmuxCaptureConfig{tester: tester, complexCommands: []TmuxCommand{
|
||||||
|
{Keys: "hishtory SPACE tquery SPACE -pipefail ENTER", ExtraDelay: 1.0},
|
||||||
|
{Keys: "Down Down"},
|
||||||
|
}, includeEscapeSequences: true})
|
||||||
|
out = stripTuiCommandPrefix(t, out)
|
||||||
|
testutils.CompareGoldens(t, out, "testRemoveDuplicateRows-enabled-tquery-scrolled")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check actually selecting it with query
|
||||||
out = captureTerminalOutputWithComplexCommands(t, tester, []TmuxCommand{
|
out = captureTerminalOutputWithComplexCommands(t, tester, []TmuxCommand{
|
||||||
{Keys: "hishtory SPACE tquery SPACE -pipefail ENTER", ExtraDelay: 1.0},
|
{Keys: "hishtory SPACE tquery SPACE -pipefail ENTER", ExtraDelay: 1.0},
|
||||||
{Keys: "Down Down"},
|
{Keys: "Down Down"},
|
||||||
@ -2554,6 +2572,7 @@ echo foo`)
|
|||||||
})
|
})
|
||||||
out = stripTuiCommandPrefix(t, out)
|
out = stripTuiCommandPrefix(t, out)
|
||||||
require.Contains(t, out, "\n")
|
require.Contains(t, out, "\n")
|
||||||
|
fmt.Printf("TODO: Debug: out=%#v", out)
|
||||||
out = strings.Split(out, "\n")[1]
|
out = strings.Split(out, "\n")[1]
|
||||||
testutils.CompareGoldens(t, out, "testRemoveDuplicateRows-enabled-tquery-select")
|
testutils.CompareGoldens(t, out, "testRemoveDuplicateRows-enabled-tquery-select")
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
-pipefail
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Search Query: > -pipefail[7m [0m[39m[49m
|
||||||
|
|
||||||
|
[90m┌───────────────────────────────────────────────────────────────────────────┐
|
||||||
|
│[39m Exit Code Command [90m│
|
||||||
|
│───────────────────────────────────────────────────────────────────────────│
|
||||||
|
│[39m 0 hishtory config-set filter-duplicate-commands true [90m│
|
||||||
|
│[39m 0 hishtory config-set displayed-columns 'Exit Code' Command [90m│
|
||||||
|
│[93m[104m 0 echo foo [90m[49m│
|
||||||
|
│[39m 0 echo baz [90m│
|
||||||
|
│[39m [90m│
|
||||||
|
│[39m [90m│
|
||||||
|
│[39m [90m│
|
||||||
|
│[39m [90m│
|
||||||
|
│[39m [90m│
|
||||||
|
│[39m [90m│
|
||||||
|
│[39m [90m│
|
||||||
|
│[39m [90m│
|
||||||
|
│[39m [90m│
|
||||||
|
│[39m [90m│
|
||||||
|
│[39m [90m│
|
||||||
|
│[39m [90m│
|
||||||
|
│[39m [90m│
|
||||||
|
│[39m [90m│
|
||||||
|
│[39m [90m│
|
||||||
|
│[39m [90m│
|
||||||
|
└───────────────────────────────────────────────────────────────────────────┘
|
||||||
|
hiSHtory: Search your shell history[39m [90m • ctrl+h[39m [90mhelp
|
Loading…
x
Reference in New Issue
Block a user