lib/ignore: Add directory separator to glob.Compile call
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3674 LGTM: calmh
This commit is contained in:
@@ -737,3 +737,35 @@ func TestIssue3639(t *testing.T) {
|
||||
t.Error("Should not match 'foo'")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIssue3674(t *testing.T) {
|
||||
stignore := `
|
||||
a*b
|
||||
a**c
|
||||
`
|
||||
|
||||
testcases := []struct {
|
||||
file string
|
||||
matches bool
|
||||
}{
|
||||
{"ab", true},
|
||||
{"asdfb", true},
|
||||
{"ac", true},
|
||||
{"asdfc", true},
|
||||
{"as/db", false},
|
||||
{"as/dc", true},
|
||||
}
|
||||
|
||||
pats := New(true)
|
||||
err := pats.Parse(bytes.NewBufferString(stignore), ".stignore")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
for _, tc := range testcases {
|
||||
res := pats.Match(tc.file).IsIgnored()
|
||||
if res != tc.matches {
|
||||
t.Errorf("Matches(%q) == %v, expected %v", tc.file, res, tc.matches)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user