mirror of
https://github.com/ddworken/hishtory.git
synced 2024-12-25 16:28:53 +01:00
Re-order test to make debugging easier + flip inverted !=
This commit is contained in:
parent
8a9a901b70
commit
7199a36a71
@ -236,8 +236,13 @@ func testIntegrationWithNewDevice(t *testing.T, tester shellTester) {
|
|||||||
t.Fatalf("Failed to re-init with the user secret: %v", out)
|
t.Fatalf("Failed to re-init with the user secret: %v", out)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Querying should show the history from the previous run
|
// Querying shouldn't show the entry from the previous account
|
||||||
out = hishtoryQuery(t, tester, "")
|
out = hishtoryQuery(t, tester, "")
|
||||||
|
if strings.Contains(out, "notinthehistory") {
|
||||||
|
t.Fatalf("output contains the unexpected item: notinthehistory: \n%s", out)
|
||||||
|
}
|
||||||
|
|
||||||
|
// And it should show the history from the previous run on this account
|
||||||
expected = []string{"echo thisisrecorded", "echo mynewcommand", "hishtory enable", "echo bar", "echo foo", "ls /foo", "ls /bar", "ls /a"}
|
expected = []string{"echo thisisrecorded", "echo mynewcommand", "hishtory enable", "echo bar", "echo foo", "ls /foo", "ls /bar", "ls /a"}
|
||||||
for _, item := range expected {
|
for _, item := range expected {
|
||||||
if !strings.Contains(out, item) {
|
if !strings.Contains(out, item) {
|
||||||
@ -247,10 +252,6 @@ func testIntegrationWithNewDevice(t *testing.T, tester shellTester) {
|
|||||||
t.Fatalf("output has %#v in it multiple times! out=%#v", item, out)
|
t.Fatalf("output has %#v in it multiple times! out=%#v", item, out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// But not from the previous account
|
|
||||||
if strings.Contains(out, "notinthehistory") {
|
|
||||||
t.Fatalf("output contains the unexpected item: notinthehistory")
|
|
||||||
}
|
|
||||||
|
|
||||||
tester.RunInteractiveShell(t, "echo mynewercommand")
|
tester.RunInteractiveShell(t, "echo mynewercommand")
|
||||||
out = hishtoryQuery(t, tester, "")
|
out = hishtoryQuery(t, tester, "")
|
||||||
|
@ -69,7 +69,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
lib.CheckFatalError(lib.Setup(os.Args))
|
lib.CheckFatalError(lib.Setup(os.Args))
|
||||||
if os.Getenv("HISHTORY_SKIP_INIT_IMPORT") != "" {
|
if os.Getenv("HISHTORY_SKIP_INIT_IMPORT") == "" {
|
||||||
fmt.Println("Importing existing shell history...")
|
fmt.Println("Importing existing shell history...")
|
||||||
ctx := hctx.MakeContext()
|
ctx := hctx.MakeContext()
|
||||||
numImported, err := lib.ImportHistory(ctx, false)
|
numImported, err := lib.ImportHistory(ctx, false)
|
||||||
|
Loading…
Reference in New Issue
Block a user