MCPcopy
hub / github.com/perkeep/perkeep / TestIgnoreMultiPattern

Function TestIgnoreMultiPattern

pkg/client/ignored_test.go:31–42  ·  view source on GitHub ↗

this test demonstrates why http://camlistore.org/r/2296 was needed for matching to correctly work when the checker has more than one pattern of the same kind. Before the fix, this test would fail because the first isShellPatternMatch closure of the checker would not end up using the intended "*.jpg"

(t *testing.T)

Source from the content-addressed store, hash-verified

29// isShellPatternMatch closure of the checker would not end up using the
30// intended "*.jpg" pattern.
31func TestIgnoreMultiPattern(t *testing.T) {
32 ignoredShellPattern := []string{
33 "*.jpg",
34 "*.png",
35 "*.gif",
36 }
37 ignoreChecker := newIgnoreChecker(ignoredShellPattern)
38 toIgnore := "/home/foo/Downloads/pony.jpg"
39 if !ignoreChecker(toIgnore) {
40 t.Errorf("Failed to ignore %v with %q among multiple shell patterns in ignore list.", toIgnore, ignoredShellPattern[0])
41 }
42}
43
44func TestIsIgnoredFile(t *testing.T) {
45 old := osutilHomeDir

Callers

nothing calls this directly

Calls 1

newIgnoreCheckerFunction · 0.85

Tested by

no test coverage detected