mirror of
https://github.com/ddworken/hishtory.git
synced 2024-11-23 08:45:16 +01:00
Updated tests, and maybe they'll pass on actions
This commit is contained in:
parent
9f1b258a7f
commit
807933b548
@ -257,8 +257,17 @@ func TestAdvancedQuery(t *testing.T) {
|
||||
// Install hishtory
|
||||
userSecret := installHishtory(t, "")
|
||||
|
||||
// An empty hishtory query
|
||||
out := RunInteractiveBashCommands(t, `hishtory query`)
|
||||
if strings.Count(out, "\n") != 3 {
|
||||
t.Fatalf("hishtory query has unexpected out %#v", out)
|
||||
}
|
||||
if strings.Count(out, "/tmp/client install") != 1 {
|
||||
t.Fatalf("hishtory query has unexpected out %#v", out)
|
||||
}
|
||||
|
||||
// Run some commands we can query for
|
||||
_, _ = RunInteractiveBashCommandsWithoutStrictMode(t, `
|
||||
_, err := RunInteractiveBashCommandsWithoutStrictMode(t, `
|
||||
set -m
|
||||
echo nevershouldappear
|
||||
notacommand
|
||||
@ -266,9 +275,12 @@ func TestAdvancedQuery(t *testing.T) {
|
||||
echo querybydir
|
||||
hishtory disable
|
||||
`)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// Query based on cwd
|
||||
out := RunInteractiveBashCommands(t, `hishtory query cwd:/tmp`)
|
||||
out = RunInteractiveBashCommands(t, `hishtory query cwd:/tmp`)
|
||||
if !strings.Contains(out, "echo querybydir") {
|
||||
t.Fatalf("hishtory query doesn't contain result matching cwd:/tmp, out=%#v", out)
|
||||
}
|
||||
@ -384,7 +396,7 @@ func TestAdvancedQuery(t *testing.T) {
|
||||
if strings.Contains(out, "echo") {
|
||||
t.Fatalf("hishtory query contains unexpected result, out=%#v", out)
|
||||
}
|
||||
if strings.Count(out, "\n") != 7 {
|
||||
if strings.Count(out, "\n") != 9 {
|
||||
t.Fatalf("hishtory query has the wrong number of lines=%d, out=%#v", strings.Count(out, "\n"), out)
|
||||
}
|
||||
|
||||
@ -409,7 +421,7 @@ func TestAdvancedQuery(t *testing.T) {
|
||||
if strings.Contains(out, "echo") {
|
||||
t.Fatalf("hishtory query contains unexpected result, out=%#v", out)
|
||||
}
|
||||
if strings.Count(out, "\n") != 7 {
|
||||
if strings.Count(out, "\n") != 9 {
|
||||
t.Fatalf("hishtory query has the wrong number of lines=%d, out=%#v", strings.Count(out, "\n"), out)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user