lib/ignore: Additional test case (#5672)
This commit is contained in:
parent
5da41f75fa
commit
2984d40641
@ -1054,3 +1054,28 @@ func TestIssue5009(t *testing.T) {
|
|||||||
t.Error("skipIgnoredDirs should not be true with includes")
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user