]> ruderich.org/simon Gitweb - nsscash/nsscash.git/commitdiff
nsscash: main_test: use time.Since()
authorSimon Ruderich <simon@ruderich.org>
Sun, 15 Dec 2019 14:52:49 +0000 (15:52 +0100)
committerSimon Ruderich <simon@ruderich.org>
Sun, 15 Dec 2019 14:52:49 +0000 (15:52 +0100)
main_test.go

index 145abe91dfe5b8a0c53989e90133856feeeea528..ffb176f05d5df5dab6b430d75eee9c186eef1226 100644 (file)
@@ -166,8 +166,7 @@ func mustBeOld(t *testing.T, paths ...string) {
                }
 
                mtime := i.ModTime()
                }
 
                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)
                }
        }
                        t.Errorf("%q was recently modified", p)
                }
        }
@@ -182,8 +181,7 @@ func mustBeNew(t *testing.T, paths ...string) {
                }
 
                mtime := i.ModTime()
                }
 
                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)
                }
        }
                        t.Errorf("%q was not recently modified", p)
                }
        }