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)
| 29 | // isShellPatternMatch closure of the checker would not end up using the |
| 30 | // intended "*.jpg" pattern. |
| 31 | func 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 | |
| 44 | func TestIsIgnoredFile(t *testing.T) { |
| 45 | old := osutilHomeDir |
nothing calls this directly
no test coverage detected