diff --git a/client/client_test.go b/client/client_test.go index 3e7e4db..ca60641 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -148,7 +148,6 @@ func TestParameterized(t *testing.T) { 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("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") }) } @@ -1004,16 +1003,20 @@ func testDisplayTable(t *testing.T, tester shellTester) { compareGoldens(t, out, "testDisplayTable-customColumns") // And again - tester.RunInteractiveShell(t, ` hishtory disable`) tester.RunInteractiveShell(t, `hishtory config-set displayed-columns Hostname 'Exit Code' Command`) out = hishtoryQuery(t, tester, "table") compareGoldens(t, out, "testDisplayTable-customColumns-2") // And again - tester.RunInteractiveShell(t, ` hishtory disable`) tester.RunInteractiveShell(t, `hishtory config-add displayed-columns CWD`) out = hishtoryQuery(t, tester, "table") 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) { diff --git a/client/lib/goldens/testDisplayTable-customColumns-3 b/client/lib/goldens/testDisplayTable-customColumns-3 index 0dc36a8..06da840 100644 --- a/client/lib/goldens/testDisplayTable-customColumns-3 +++ b/client/lib/goldens/testDisplayTable-customColumns-3 @@ -1,4 +1,4 @@ -caHostname Exit Code Command CWD +Hostname Exit Code Command CWD Davids-MacBook-Air.local 0 hishtory query table ~/code/hishtory localhost 3 table_cmd2 ~/foo/ localhost 2 table_cmd1 /tmp/ diff --git a/client/lib/goldens/testDisplayTable-customColumns-multiLineCommand b/client/lib/goldens/testDisplayTable-customColumns-multiLineCommand new file mode 100644 index 0000000..3a7f861 --- /dev/null +++ b/client/lib/goldens/testDisplayTable-customColumns-multiLineCommand @@ -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/