X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=main_test.go;h=35845371f6878e7a44c0de11ad58b8390da48916;hb=d946c291618d93e4ab4ad898c1ae317fbe2256e3;hp=145abe91dfe5b8a0c53989e90133856feeeea528;hpb=999fa3508eab3bba561202b91c520aaa5893bf11;p=nsscash%2Fnsscash.git diff --git a/main_test.go b/main_test.go index 145abe9..3584537 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) } } @@ -890,7 +888,7 @@ password = "%[6]s" err = mainFetch(configPath) mustBeErrorWithSubstring(t, err, "file[0].username/passsword in use and unsafe permissions "+ - "-rw-r--r-- on \"testdata/config.toml\"") + "-rw-r--r-- on \""+configPath+"\"") mustNotExist(t, statePath, groupPath, plainPath) mustBeOld(t, passwdPath)