lib/ignore: Additional test case (#5672)

This commit is contained in:
Jakob Borg 2019-04-28 22:20:11 +02:00 committed by Audrius Butkevicius
parent 5da41f75fa
commit 2984d40641

View File

@ -1054,3 +1054,28 @@ func TestIssue5009(t *testing.T) {
t.Error("skipIgnoredDirs should not be true with includes")
}
}
func TestSpecialChars(t *testing.T) {
pats := New(fs.NewFilesystem(fs.FilesystemTypeBasic, "."), WithCache(true))
stignore := `(?i)/#recycle
(?i)/#nosync
(?i)/$Recycle.bin
(?i)/$RECYCLE.BIN
(?i)/System Volume Information`
if err := pats.Parse(bytes.NewBufferString(stignore), ".stignore"); err != nil {
t.Fatal(err)
}
cases := []string{
"#nosync",
"$RECYCLE.BIN",
filepath.FromSlash("$RECYCLE.BIN/S-1-5-18/desktop.ini"),
}
for _, c := range cases {
if !pats.Match(c).IsIgnored() {
t.Errorf("%q should be ignored", c)
}
}
}