mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-25 14:32:14 +02:00
Add a test for multi-line history entries
This commit is contained in:
parent
f9098d87d5
commit
043e815716
@ -148,7 +148,6 @@ func TestParameterized(t *testing.T) {
|
|||||||
t.Run("testConfigGetSet/"+tester.ShellName(), func(t *testing.T) { testConfigGetSet(t, tester) })
|
t.Run("testConfigGetSet/"+tester.ShellName(), func(t *testing.T) { testConfigGetSet(t, tester) })
|
||||||
t.Run("testControlR/"+tester.ShellName(), func(t *testing.T) { testControlR(t, tester, tester.ShellName()) })
|
t.Run("testControlR/"+tester.ShellName(), func(t *testing.T) { testControlR(t, tester, tester.ShellName()) })
|
||||||
t.Run("testHandleUpgradedFeatures/"+tester.ShellName(), func(t *testing.T) { testHandleUpgradedFeatures(t, tester) })
|
t.Run("testHandleUpgradedFeatures/"+tester.ShellName(), func(t *testing.T) { testHandleUpgradedFeatures(t, tester) })
|
||||||
// TODO: Add a test for multi-line history entries
|
|
||||||
}
|
}
|
||||||
t.Run("testControlR/fish", func(t *testing.T) { testControlR(t, bashTester{}, "fish") })
|
t.Run("testControlR/fish", func(t *testing.T) { testControlR(t, bashTester{}, "fish") })
|
||||||
}
|
}
|
||||||
@ -1004,16 +1003,20 @@ func testDisplayTable(t *testing.T, tester shellTester) {
|
|||||||
compareGoldens(t, out, "testDisplayTable-customColumns")
|
compareGoldens(t, out, "testDisplayTable-customColumns")
|
||||||
|
|
||||||
// And again
|
// And again
|
||||||
tester.RunInteractiveShell(t, ` hishtory disable`)
|
|
||||||
tester.RunInteractiveShell(t, `hishtory config-set displayed-columns Hostname 'Exit Code' Command`)
|
tester.RunInteractiveShell(t, `hishtory config-set displayed-columns Hostname 'Exit Code' Command`)
|
||||||
out = hishtoryQuery(t, tester, "table")
|
out = hishtoryQuery(t, tester, "table")
|
||||||
compareGoldens(t, out, "testDisplayTable-customColumns-2")
|
compareGoldens(t, out, "testDisplayTable-customColumns-2")
|
||||||
|
|
||||||
// And again
|
// And again
|
||||||
tester.RunInteractiveShell(t, ` hishtory disable`)
|
|
||||||
tester.RunInteractiveShell(t, `hishtory config-add displayed-columns CWD`)
|
tester.RunInteractiveShell(t, `hishtory config-add displayed-columns CWD`)
|
||||||
out = hishtoryQuery(t, tester, "table")
|
out = hishtoryQuery(t, tester, "table")
|
||||||
compareGoldens(t, out, "testDisplayTable-customColumns-3")
|
compareGoldens(t, out, "testDisplayTable-customColumns-3")
|
||||||
|
|
||||||
|
// Test displaying a command with multiple lines
|
||||||
|
entry3 := testutils.MakeFakeHistoryEntry("while :\ndo\nls /table/\ndone")
|
||||||
|
manuallySubmitHistoryEntry(t, userSecret, entry3)
|
||||||
|
out = hishtoryQuery(t, tester, "table")
|
||||||
|
compareGoldens(t, out, "testDisplayTable-customColumns-multiLineCommand")
|
||||||
}
|
}
|
||||||
|
|
||||||
func testRequestAndReceiveDbDump(t *testing.T, tester shellTester) {
|
func testRequestAndReceiveDbDump(t *testing.T, tester shellTester) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
caHostname Exit Code Command CWD
|
Hostname Exit Code Command CWD
|
||||||
Davids-MacBook-Air.local 0 hishtory query table ~/code/hishtory
|
Davids-MacBook-Air.local 0 hishtory query table ~/code/hishtory
|
||||||
localhost 3 table_cmd2 ~/foo/
|
localhost 3 table_cmd2 ~/foo/
|
||||||
localhost 2 table_cmd1 /tmp/
|
localhost 2 table_cmd1 /tmp/
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
Hostname Exit Code Command CWD
|
||||||
|
Davids-MacBook-Air.local 0 hishtory query table ~/code/hishtory
|
||||||
|
localhost 2 while : /tmp/
|
||||||
|
do
|
||||||
|
ls /table/
|
||||||
|
done
|
||||||
|
localhost 3 table_cmd2 ~/foo/
|
||||||
|
localhost 2 table_cmd1 /tmp/
|
Loading…
x
Reference in New Issue
Block a user