diff options
author | Jakob Unterwurzacher | 2018-08-15 12:28:29 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2018-08-15 12:28:29 +0200 |
commit | 7a02f71fc2fc8fc104ad1538f417d1e93e73cf11 (patch) | |
tree | 663a95888a011b68f22b8292dec4e891a05e81f7 /internal/fusefrontend_reverse/isexcluded_test.go | |
parent | 8989905333f1f47d90e8874a36559c48a8f5ba50 (diff) |
fusefrontend_reverse: reject excludes for the root directory ""
This is most likely a mistake by the user. Reject it.
Diffstat (limited to 'internal/fusefrontend_reverse/isexcluded_test.go')
-rw-r--r-- | internal/fusefrontend_reverse/isexcluded_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/internal/fusefrontend_reverse/isexcluded_test.go b/internal/fusefrontend_reverse/isexcluded_test.go new file mode 100644 index 0000000..fc3831a --- /dev/null +++ b/internal/fusefrontend_reverse/isexcluded_test.go @@ -0,0 +1,26 @@ +package fusefrontend_reverse + +import ( + "testing" +) + +func verifyExcluded(t *testing.T, rfs *ReverseFS, paths []string) { + for _, p := range paths { + if !rfs.isExcluded(p) { + t.Errorf("Path %q should be excluded, but is not", p) + } + } + if t.Failed() { + t.Logf("cExclude = %#v", rfs.cExclude) + } +} + +// Note: See also the integration tests in +// tests/reverse/exclude_test.go +func TestIsExcluded(t *testing.T) { + var rfs ReverseFS + // If the root directory is excluded, all files and subdirs should be excluded + // as well + rfs.cExclude = []string{""} + verifyExcluded(t, &rfs, []string{"", "foo", "foo/bar"}) +} |