diff options
author | Jakob Borg <jakob@kastelo.net> | 2023-06-04 15:32:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-04 15:32:03 +0200 |
commit | 81a4b22d4342b187ca910a1e6f4ce0ff61b89569 (patch) | |
tree | c642f654619b91ad789b36e20b104f39e6b84aac | |
parent | f7da96fb82b543465e960ed69031311fa746e8ec (diff) |
lib/model: Improve test for unignored parent directories (#8926)
-rw-r--r-- | lib/model/model_test.go | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/model/model_test.go b/lib/model/model_test.go index f3bc24abae..a8bbddd121 100644 --- a/lib/model/model_test.go +++ b/lib/model/model_test.go @@ -2826,23 +2826,27 @@ func TestParentOfUnignored(t *testing.T) { w, fcfg, wCancel := newDefaultCfgWrapper() defer wCancel() ffs := fcfg.Filesystem(nil) - defer ffs.Remove(".stignore") - fd, err := ffs.Create("baz") - must(t, err) - fd.Close() + must(t, ffs.Mkdir("bar", 0o755)) + must(t, ffs.Mkdir("baz", 0o755)) + must(t, ffs.Mkdir("baz/quux", 0o755)) m := setupModel(t, w) defer cleanupModel(m) + m.SetIgnores("default", []string{"!quux", "*"}) m.ScanFolder("default") - m.SetIgnores("default", []string{"!quux", "*"}) + if bar, ok := m.testCurrentFolderFile("default", "bar"); !ok { + t.Error(`Directory "bar" missing in db`) + } else if !bar.IsIgnored() { + t.Error(`Directory "bar" is not ignored`) + } - if parent, ok := m.testCurrentFolderFile("default", "baz"); !ok { - t.Errorf(`Directory "baz" missing in db`) - } else if parent.IsIgnored() { - t.Errorf(`Directory "baz" is ignored`) + if baz, ok := m.testCurrentFolderFile("default", "baz"); !ok { + t.Error(`Directory "baz" missing in db`) + } else if baz.IsIgnored() { + t.Error(`Directory "baz" is ignored`) } } |