mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-03 17:05:56 +02:00
add a test for a complex command getting recorded
This commit is contained in:
parent
5b59141c3a
commit
b9204bf649
@ -19,8 +19,6 @@ import (
|
|||||||
"github.com/ddworken/hishtory/shared"
|
"github.com/ddworken/hishtory/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: Change this to only start the server once for this entire file
|
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
defer shared.RunTestServer()()
|
defer shared.RunTestServer()()
|
||||||
cmd := exec.Command("go", "build", "-o", "/tmp/client")
|
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
|
return userSecret
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,8 +585,6 @@ echo hello2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: A test that has a complex bash pipeline
|
|
||||||
|
|
||||||
func waitForBackgroundSavesToComplete(t *testing.T) {
|
func waitForBackgroundSavesToComplete(t *testing.T) {
|
||||||
for i := 0; i < 20; i++ {
|
for i := 0; i < 20; i++ {
|
||||||
cmd := exec.Command("pidof", "hishtory")
|
cmd := exec.Command("pidof", "hishtory")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user