mirror of
https://git.mills.io/prologic/zs
synced 2024-11-25 06:46: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 (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"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 {
|
filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
|
||||||
// rebuild if changes to .zs/ or .zsignore
|
// rebuild if changes to .zs/ or .zsignore
|
||||||
if (filepath.Base(path) == ZSIGNORE || filepath.Dir(path) == ZSDIR) && info.ModTime().After(lastModified) {
|
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
|
// reset lastModified to 0 so everything rebuidls
|
||||||
lastModified = time.Unix(0, 0)
|
lastModified = time.Unix(0, 0)
|
||||||
return nil
|
return nil
|
||||||
@ -623,7 +626,9 @@ func init() {
|
|||||||
func ParseIgnoreFile(fn string) *ignore.GitIgnore {
|
func ParseIgnoreFile(fn string) *ignore.GitIgnore {
|
||||||
obj, err := ignore.CompileIgnoreFile(ZSIGNORE)
|
obj, err := ignore.CompileIgnoreFile(ZSIGNORE)
|
||||||
if err != nil {
|
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)
|
return ignore.CompileIgnoreLines(DefaultIgnore)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
testdata/extensions/.test/index.html
vendored
2
testdata/extensions/.test/index.html
vendored
@ -2,7 +2,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>Hello World</title>
|
<title>Hello World</title>
|
||||||
</head>
|
</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>
|
<p>Hello World!</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
2
testdata/ignore/.test/index.html
vendored
2
testdata/ignore/.test/index.html
vendored
@ -1,5 +1,5 @@
|
|||||||
<html>
|
<html>
|
||||||
<body><h1 id="simple">Simple</h1>
|
<body><h1 id="simple">Simple <a class="anchor" href="#simple">¶</a></h1>
|
||||||
<p>Simple page</p>
|
<p>Simple page</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
2
testdata/simple/.test/index.html
vendored
2
testdata/simple/.test/index.html
vendored
@ -1,5 +1,5 @@
|
|||||||
<html>
|
<html>
|
||||||
<body><h1 id="simple">Simple</h1>
|
<body><h1 id="simple">Simple <a class="anchor" href="#simple">¶</a></h1>
|
||||||
<p>Simple page</p>
|
<p>Simple page</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
2
testdata/variables/.test/index.html
vendored
2
testdata/variables/.test/index.html
vendored
@ -2,7 +2,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>Simple</title>
|
<title>Simple</title>
|
||||||
</head>
|
</head>
|
||||||
<body><h1 id="simple">Simple</h1>
|
<body><h1 id="simple">Simple <a class="anchor" href="#simple">¶</a></h1>
|
||||||
<p>Simple page</p>
|
<p>Simple page</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user