public void TestGlobPartialMatchShouldMatchFolder(string pattern, string[] folders, bool expected) { var glob = new GlobMatcher(pattern, GlobMatcher.DefaultOptions | GlobMatcherOptions.AllowDotMatch); foreach (var file in folders) { var match = glob.Match(file, true); Assert.Equal(expected, match); } }
public void TestGlobMatchWithDotMatchShouldMatchDotFiles(string pattern, string[] files, bool expected) { var glob = new GlobMatcher(pattern, GlobMatcher.DefaultOptions | GlobMatcherOptions.AllowDotMatch); foreach (var file in files) { var match = glob.Match(file); Assert.Equal(expected, match); } }
public void TestGlobMatchWithoutDotMatchShouldMatchNonDotFiles(string pattern, string[] files, bool expected) { var glob = new GlobMatcher(pattern); foreach (var file in files) { var match = glob.Match(file); Assert.Equal(expected, match); } }
private SitemapElementOptions GetMatchingOptions(SitemapOptions options, string sourcePath) { if (options.FileOptions != null) { // As the latter one overrides the former one, match the pattern from latter to former for (var i = options.FileOptions.Count - 1; i >= 0; i--) { var item = options.FileOptions[i]; var glob = new GlobMatcher(item.Key); if (glob.Match(sourcePath)) { return(item.Value); } } } return(options); }
public void TestGlobPartialMatchShouldMatchFolder(string pattern, string[] folders, bool expected) { var glob = new GlobMatcher(pattern, GlobMatcher.DefaultOptions | GlobMatcherOptions.AllowDotMatch); foreach (var file in folders) { var match = glob.Match(file, true); Assert.Equal(expected, match); } }
public void TestGlobMatchWithDotMatchShouldMatchDotFiles(string pattern, string[] files, bool expected) { var glob = new GlobMatcher(pattern, GlobMatcher.DefaultOptions | GlobMatcherOptions.AllowDotMatch); foreach (var file in files) { var match = glob.Match(file); Assert.Equal(expected, match); } }
public void TestGlobMatchWithoutDotMatchShouldMatchNonDotFiles(string pattern, string[] files, bool expected) { var glob = new GlobMatcher(pattern); foreach(var file in files) { var match = glob.Match(file); Assert.Equal(expected, match); } }