Re-order test to make debugging easier + flip inverted !=

This commit is contained in:
David Dworken 2022-11-11 18:46:22 -08:00
parent 8a9a901b70
commit 7199a36a71
No known key found for this signature in database
2 changed files with 7 additions and 6 deletions

View File

@ -236,8 +236,13 @@ func testIntegrationWithNewDevice(t *testing.T, tester shellTester) {
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, "")
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"}
for _, item := range expected {
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)
}
}
// But not from the previous account
if strings.Contains(out, "notinthehistory") {
t.Fatalf("output contains the unexpected item: notinthehistory")
}
tester.RunInteractiveShell(t, "echo mynewercommand")
out = hishtoryQuery(t, tester, "")

View File

@ -69,7 +69,7 @@ func main() {
}
}
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...")
ctx := hctx.MakeContext()
numImported, err := lib.ImportHistory(ctx, false)