Implement pre-saving feature to ensure that long-running/non-terminating commands are saved in hishtory

This commit is contained in:
David Dworken
2023-08-27 14:24:59 -07:00
parent a79d401058
commit 25ec191f1a
9 changed files with 190 additions and 40 deletions

View File

@ -318,12 +318,12 @@ func TestAddToDbIfNew(t *testing.T) {
}
func TestParseCrossPlatformInt(t *testing.T) {
res, err := parseCrossPlatformInt("123")
res, err := ParseCrossPlatformInt("123")
testutils.Check(t, err)
if res != 123 {
t.Fatalf("failed to parse cross platform int %d", res)
}
res, err = parseCrossPlatformInt("123N")
res, err = ParseCrossPlatformInt("123N")
testutils.Check(t, err)
if res != 123 {
t.Fatalf("failed to parse cross platform int %d", res)
@ -493,6 +493,11 @@ func TestParseTimeGenerously(t *testing.T) {
if ts.Year() != 2006 || ts.Month() != time.January || ts.Day() != 2 || ts.Hour() != 0 || ts.Minute() != 0 || ts.Second() != 0 {
t.Fatalf("parsed time incorrectly: %d", ts.Unix())
}
ts, err = parseTimeGenerously("1693163976")
testutils.Check(t, err)
if ts.Year() != 2023 || ts.Month() != time.August || ts.Day() != 27 || ts.Hour() != 12 || ts.Minute() != 19 || ts.Second() != 36 {
t.Fatalf("parsed time incorrectly: %d %s", ts.Unix(), ts.GoString())
}
}
func TestUnescape(t *testing.T) {