mirror of
https://github.com/ddworken/hishtory.git
synced 2025-01-14 10:18:19 +01:00
Fix test harness bug by swapping to splitn
This commit is contained in:
parent
49ccce74e1
commit
225c718a28
@ -2734,7 +2734,7 @@ func TestTimestampFormat(t *testing.T) {
|
||||
// And check that it is displayed in both the tui and the classic view
|
||||
out := hishtoryQuery(t, tester, "-pipefail -tablesizing")
|
||||
testutils.CompareGoldens(t, out, "TestTimestampFormat-query")
|
||||
out = captureTerminalOutput(t, tester, []string{"hishtory SPACE tquery ENTER", "-pipefail SPACE -tablesizing"})
|
||||
out = captureTerminalOutput(t, tester, []string{"hishtory SPACE tquery ENTER", "table_cmd SPACE -tquery"})
|
||||
out = stripRequiredPrefix(t, out, "hishtory tquery")
|
||||
testutils.CompareGoldens(t, out, "TestTimestampFormat-tquery")
|
||||
}
|
||||
|
25
client/testdata/TestTimestampFormat-tquery
vendored
25
client/testdata/TestTimestampFormat-tquery
vendored
@ -1,6 +1,27 @@
|
||||
Search Query: > -pipefail -tablesizing
|
||||
Search Query: > table_cmd -tquery
|
||||
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Hostname CWD Timestamp Runtime Exit Code Command │
|
||||
│──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
|
||||
│ ghaction-runner-hostname ~/work/hishtory/hishtory 2024/Sep/28 12:46 N/A 0
|
||||
│ localhost ~/foo/ 2022/Apr/16 01:03 24s 3 table_cmd2 │
|
||||
│ localhost /tmp/ 2022/Apr/16 01:03 4s 2 table_cmd1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa… │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
hiSHtory: Search your shell history • ctrl+h help
|
@ -361,7 +361,7 @@ func stripShellPrefix(out string) string {
|
||||
|
||||
func stripRequiredPrefix(t *testing.T, out, prefix string) string {
|
||||
require.Contains(t, out, prefix)
|
||||
return strings.TrimSpace(strings.Split(out, prefix)[1])
|
||||
return strings.TrimSpace(strings.SplitN(out, prefix, 2)[1])
|
||||
}
|
||||
|
||||
func stripTuiCommandPrefix(t *testing.T, out string) string {
|
||||
|
Loading…
Reference in New Issue
Block a user