コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
ファイル: SitemapGenerator.cs プロジェクト: yunair/docfx
        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);
        }
コード例 #5
0
ファイル: GlobMatcherTest.cs プロジェクト: yonglehou/docfx
 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);
     }
 }
コード例 #6
0
ファイル: GlobMatcherTest.cs プロジェクト: yonglehou/docfx
 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);
     }
 }
コード例 #7
0
ファイル: GlobMatcherTest.cs プロジェクト: yonglehou/docfx
 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);
     }
 }