Fix tests

This commit is contained in:
James Mills 2023-03-18 17:40:46 +10:00
parent 3e4215b694
commit 5b82d79c90
No known key found for this signature in database
GPG Key ID: AC4C014F1440EBD6
5 changed files with 11 additions and 6 deletions

View File

@ -4,6 +4,7 @@ package main
import (
"bytes"
"context"
"errors"
"fmt"
"io"
"io/ioutil"
@ -520,7 +521,9 @@ func buildAll(ctx context.Context, watch bool) error {
filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
// rebuild if changes to .zs/ or .zsignore
if (filepath.Base(path) == ZSIGNORE || filepath.Dir(path) == ZSDIR) && info.ModTime().After(lastModified) {
Ignore = ParseIgnoreFile(path)
if filepath.Base(path) == ZSIGNORE {
Ignore = ParseIgnoreFile(path)
}
// reset lastModified to 0 so everything rebuidls
lastModified = time.Unix(0, 0)
return nil
@ -623,7 +626,9 @@ func init() {
func ParseIgnoreFile(fn string) *ignore.GitIgnore {
obj, err := ignore.CompileIgnoreFile(ZSIGNORE)
if err != nil {
log.WithError(err).Warnf("error parsing .zsignore: %s (using defaults)s", fn)
if !errors.Is(err, os.ErrNotExist) {
log.WithError(err).Warnf("error parsing .zsignore: %s (using defaults)s", fn)
}
return ignore.CompileIgnoreLines(DefaultIgnore)
}

View File

@ -2,7 +2,7 @@
<head>
<title>Hello World</title>
</head>
<body><h1 id="hello-world">Hello World</h1>
<body><h1 id="hello-world">Hello World <a class="anchor" href="#hello-world"></a></h1>
<p>Hello World!</p>
</body>
</html>

View File

@ -1,5 +1,5 @@
<html>
<body><h1 id="simple">Simple</h1>
<body><h1 id="simple">Simple <a class="anchor" href="#simple"></a></h1>
<p>Simple page</p>
</body>
</html>

View File

@ -1,5 +1,5 @@
<html>
<body><h1 id="simple">Simple</h1>
<body><h1 id="simple">Simple <a class="anchor" href="#simple"></a></h1>
<p>Simple page</p>
</body>
</html>

View File

@ -2,7 +2,7 @@
<head>
<title>Simple</title>
</head>
<body><h1 id="simple">Simple</h1>
<body><h1 id="simple">Simple <a class="anchor" href="#simple"></a></h1>
<p>Simple page</p>
</body>
</html>