]> ruderich.org/simon Gitweb - nsscash/nsscash.git/blobdiff - main_test.go
nsscash: main_test: use time.Since()
[nsscash/nsscash.git] / main_test.go
index a5c488ee7faa929fd8fe9ad2e38b79d16af407e4..ffb176f05d5df5dab6b430d75eee9c186eef1226 100644 (file)
@@ -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) {