Stop repository if the directory disappears (fixes #154)

This commit is contained in:
Jakob Borg
2014-05-04 18:20:25 +02:00
parent 482795bab0
commit f39e105101
8 changed files with 78 additions and 10 deletions

View File

@@ -27,7 +27,11 @@ func TestWalk(t *testing.T) {
BlockSize: 128 * 1024,
IgnoreFile: ".stignore",
}
files, ignores := w.Walk()
files, ignores, err := w.Walk()
if err != nil {
t.Fatal(err)
}
if l1, l2 := len(files), len(testdata); l1 != l2 {
t.Fatalf("Incorrect number of walked files %d != %d", l1, l2)
@@ -54,6 +58,30 @@ func TestWalk(t *testing.T) {
}
}
func TestWalkError(t *testing.T) {
w := Walker{
Dir: "testdata-missing",
BlockSize: 128 * 1024,
IgnoreFile: ".stignore",
}
_, _, err := w.Walk()
if err == nil {
t.Error("no error from missing directory")
}
w = Walker{
Dir: "testdata/bar",
BlockSize: 128 * 1024,
IgnoreFile: ".stignore",
}
_, _, err = w.Walk()
if err == nil {
t.Error("no error from non-directory")
}
}
func TestIgnore(t *testing.T) {
var patterns = map[string][]string{
"": {"t2"},