mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-19 19:37:59 +02:00
Add a timestamp test that I believe will fail for macos
This commit is contained in:
parent
3553897101
commit
38b91f933c
@ -121,6 +121,7 @@ func TestParameterized(t *testing.T) {
|
|||||||
t.Run("testIntegrationWithNewDevice/"+tester.ShellName(), func(t *testing.T) { testIntegrationWithNewDevice(t, tester) })
|
t.Run("testIntegrationWithNewDevice/"+tester.ShellName(), func(t *testing.T) { testIntegrationWithNewDevice(t, tester) })
|
||||||
t.Run("testHishtoryBackgroundSaving/"+tester.ShellName(), func(t *testing.T) { testHishtoryBackgroundSaving(t, tester) })
|
t.Run("testHishtoryBackgroundSaving/"+tester.ShellName(), func(t *testing.T) { testHishtoryBackgroundSaving(t, tester) })
|
||||||
t.Run("testDisplayTable/"+tester.ShellName(), func(t *testing.T) { testDisplayTable(t, tester) })
|
t.Run("testDisplayTable/"+tester.ShellName(), func(t *testing.T) { testDisplayTable(t, tester) })
|
||||||
|
t.Run("testTimestampsAreReasonablyCorrect/"+tester.ShellName(), func(t *testing.T) { testTimestampsAreReasonablyCorrect(t, tester) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -750,6 +751,28 @@ func manuallySubmitHistoryEntry(t *testing.T, userSecret string, entry data.Hist
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testTimestampsAreReasonablyCorrect(t *testing.T, tester shellTester) {
|
||||||
|
// Setup
|
||||||
|
defer shared.BackupAndRestore(t)()
|
||||||
|
installHishtory(t, tester, "")
|
||||||
|
|
||||||
|
// Record a command
|
||||||
|
out := tester.RunInteractiveShell(t, "echo hello")
|
||||||
|
if out != "hello\n" {
|
||||||
|
t.Fatalf("running echo hello had unexpected out=%#v", out)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Query for it and check that the timestamp that gets recorded looks reasonable
|
||||||
|
out = hishtoryQuery(t, tester, "echo hello")
|
||||||
|
if strings.Count(out, "\n") != 2 {
|
||||||
|
t.Fatalf("hishtory query has unexpected number of lines: out=%#v", out)
|
||||||
|
}
|
||||||
|
expectedDate := time.Now().Format("Jan 2 2006")
|
||||||
|
if !strings.Contains(out, expectedDate) {
|
||||||
|
t.Fatalf("hishtory query has an incorrect date: out=%#v", out)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func testHishtoryBackgroundSaving(t *testing.T, tester shellTester) {
|
func testHishtoryBackgroundSaving(t *testing.T, tester shellTester) {
|
||||||
// Setup
|
// Setup
|
||||||
defer shared.BackupAndRestore(t)()
|
defer shared.BackupAndRestore(t)()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user