X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=main_test.go;h=ffb176f05d5df5dab6b430d75eee9c186eef1226;hb=2f775b91b1871aa2eacdb19ead52f8801ba75b29;hp=a5c488ee7faa929fd8fe9ad2e38b79d16af407e4;hpb=886b911524a2f14bd7fc76e5a7478e0cfb2fc14d;p=nsscash%2Fnsscash.git diff --git a/main_test.go b/main_test.go index a5c488e..ffb176f 100644 --- a/main_test.go +++ b/main_test.go @@ -166,8 +166,7 @@ func mustBeOld(t *testing.T, paths ...string) { } mtime := i.ModTime() - now := time.Now() - if now.Sub(mtime) < time.Hour { + if time.Since(mtime) < time.Hour { t.Errorf("%q was recently modified", p) } } @@ -182,8 +181,7 @@ func mustBeNew(t *testing.T, paths ...string) { } mtime := i.ModTime() - now := time.Now() - if now.Sub(mtime) > time.Hour { + if time.Since(mtime) > time.Hour { t.Errorf("%q was not recently modified", p) } } @@ -715,6 +713,7 @@ func fetchStateCannotRead(a args) { statePath+": permission denied") mustNotExist(t, passwdPath, plainPath, groupPath) + mustBeOld(t, statePath) } func fetchStateInvalid(a args) {