diff --git a/client/client_test.go b/client/client_test.go index e694bae..c026e5c 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -19,8 +19,6 @@ import ( "github.com/ddworken/hishtory/shared" ) -// TODO: Change this to only start the server once for this entire file - func TestMain(m *testing.M) { defer shared.RunTestServer()() cmd := exec.Command("go", "build", "-o", "/tmp/client") @@ -246,6 +244,19 @@ echo thisisrecorded`) } } + // Add a complex command + complexCommand := "echo hello | grep complex | sed s/h/i/g; echo bar && echo \"fo 'o\"" + _, _ = RunInteractiveBashCommandsWithoutStrictMode(t, complexCommand) + + // Query for it + out = hishtoryQuery(t, "complex") + if strings.Count(out, "\n") != 2 { + t.Fatalf("hishtory query has the wrong number of lines=%d, out=%#v", strings.Count(out, "\n"), out) + } + if !strings.Contains(out, complexCommand) { + t.Fatalf("hishtory query doesn't contain the expected complex command, out=%#v", out) + } + return userSecret } @@ -574,8 +585,6 @@ echo hello2 } } -// TODO: A test that has a complex bash pipeline - func waitForBackgroundSavesToComplete(t *testing.T) { for i := 0; i < 20; i++ { cmd := exec.Command("pidof", "hishtory")