mirror of
https://git.mills.io/prologic/zs
synced 2024-11-28 16:26:11 +03:00
Fix tests
This commit is contained in:
parent
3e4215b694
commit
5b82d79c90
9
main.go
9
main.go
@ -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)
|
||||
}
|
||||
|
||||
|
2
testdata/extensions/.test/index.html
vendored
2
testdata/extensions/.test/index.html
vendored
@ -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>
|
||||
|
2
testdata/ignore/.test/index.html
vendored
2
testdata/ignore/.test/index.html
vendored
@ -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>
|
||||
|
2
testdata/simple/.test/index.html
vendored
2
testdata/simple/.test/index.html
vendored
@ -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>
|
||||
|
2
testdata/variables/.test/index.html
vendored
2
testdata/variables/.test/index.html
vendored
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user