Exemplo n.º 1
0
        public void EmptyCollectionWhenNoFilesPresent()
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include("alpha.txt")
                           .Execute();

            scenario.AssertExact();
        }
Exemplo n.º 2
0
        public void TrailingRecursiveWildcardMatchesAllFiles()
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include("one/**")
                           .Files("one/x.txt", "two/x.txt", "one/x/y.txt")
                           .Execute();

            scenario.AssertExact("one/x.txt", "one/x/y.txt");
        }
Exemplo n.º 3
0
        public void IncompletePatternsDoNotInclude()
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include("*/*.txt")
                           .Files("one/x.txt", "two/x.txt", "x.txt")
                           .Execute();

            scenario.AssertExact("one/x.txt", "two/x.txt");
        }
Exemplo n.º 4
0
        public void StarDotStarIsSameAsStar()
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include("*.*")
                           .Files("alpha.txt", "alpha.", ".txt", ".", "alpha", "txt")
                           .Execute();

            scenario.AssertExact("alpha.txt", "alpha.", ".txt", ".", "alpha", "txt");
        }
Exemplo n.º 5
0
        public void RecursiveAloneIncludesEverything()
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include("**")
                           .Files("1/2/2/3/x", "1/2/3/y")
                           .Execute();

            scenario.AssertExact("1/2/2/3/x", "1/2/3/y");
        }
Exemplo n.º 6
0
        public void PatternMatchingWorks(string includePattern, string[] matchesExpected)
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include(includePattern)
                           .Files("alpha.txt", "beta.txt", "gamma.dat")
                           .Execute();

            scenario.AssertExact(matchesExpected);
        }
Exemplo n.º 7
0
        public void PatternBeginAndEndCantOverlap(string includePattern, string[] matchesExpected)
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include(includePattern)
                           .Files("12345678")
                           .Execute();

            scenario.AssertExact(matchesExpected);
        }
Exemplo n.º 8
0
        public void FolderNamesAreTraversed()
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include("beta/alpha.txt")
                           .Files("beta/alpha.txt")
                           .Execute();

            scenario.AssertExact("beta/alpha.txt");
        }
Exemplo n.º 9
0
        public void SlashPolarityIsIgnored(string includePattern, string filePath)
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include(includePattern)
                           .Files("one/two.txt", filePath, "three/four.txt")
                           .Execute();

            scenario.AssertExact("beta/alpha.txt");
        }
Exemplo n.º 10
0
        public void RecursiveWildcardSurroundingContainsWith()
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include("**/x/**")
                           .Files("x/1", "1/x/2", "1/x", "x", "1", "1/2")
                           .Execute();

            scenario.AssertExact("x/1", "1/x/2");
        }
Exemplo n.º 11
0
        public void MismatchedFileIsIgnored()
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include("alpha.txt")
                           .Files("omega.txt")
                           .Execute();

            scenario.AssertExact();
        }
Exemplo n.º 12
0
        public void LeadingRecursiveWildcardMatchesAllLeadingPaths()
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include("**/*.cs")
                           .Files("one/x.cs", "two/x.cs", "one/two/x.cs", "x.cs")
                           .Files("one/x.txt", "two/x.txt", "one/two/x.txt", "x.txt")
                           .Execute();

            scenario.AssertExact("one/x.cs", "two/x.cs", "one/two/x.cs", "x.cs");
        }
Exemplo n.º 13
0
        public void SequentialFoldersMayBeRequired()
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include("a/b/**/1/2/**/2/3/**")
                           .Files("1/2/2/3/x", "1/2/3/y", "a/1/2/4/2/3/b", "a/2/3/1/2/b")
                           .Files("a/b/1/2/2/3/x", "a/b/1/2/3/y", "a/b/a/1/2/4/2/3/b", "a/b/a/2/3/1/2/b")
                           .Execute();

            scenario.AssertExact("a/b/1/2/2/3/x", "a/b/a/1/2/4/2/3/b");
        }
Exemplo n.º 14
0
        public void ExcludeMayEndInDirectoryName()
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include("*.cs", "*/*.cs", "*/*/*.cs")
                           .Exclude("bin", "one/two")
                           .Files("one/x.cs", "two/x.cs", "one/two/x.cs", "x.cs", "bin/x.cs", "bin/two/x.cs")
                           .Execute();

            scenario.AssertExact("one/x.cs", "two/x.cs", "x.cs");
        }
Exemplo n.º 15
0
        public void InnerRecursiveWildcardMuseStartWithAndEndWith()
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include("one/**/*.cs")
                           .Files("one/x.cs", "two/x.cs", "one/two/x.cs", "x.cs")
                           .Files("one/x.txt", "two/x.txt", "one/two/x.txt", "x.txt")
                           .Execute();

            scenario.AssertExact("one/x.cs", "one/two/x.cs");
        }
Exemplo n.º 16
0
        public void LeadingDotDotWithRecursiveCanComeThroughPattern()
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include("*.cs")
                           .Include("../2/**/*.cs")
                           .Files("1/x.cs", "1/x.txt", "2/x.cs", "2/x.txt", "2/3/x.cs", "2/3/4/z.cs", "2/3/x.txt")
                           .SubDirectory("1")
                           .Execute();

            scenario.AssertExact("x.cs", "../2/x.cs", "../2/3/x.cs", "../2/3/4/z.cs");
        }
Exemplo n.º 17
0
        public void StemMatchOnExactFile()
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include("sub/sub/three.txt")
                           .Files("root.txt", "sub/one.txt", "sub/two.txt", "sub/sub/three.txt")
                           .Execute();

            // Check the stem of the matched items
            Assert.Equal(new[] {
                new FilePatternMatch(path: "sub/sub/three.txt", stem: "three.txt"),
            }, scenario.Result.Files.ToArray());
        }
Exemplo n.º 18
0
        public void WildcardMidSegmentMatch()
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include("sub/w*.txt")
                           .Files("root.txt", "sub/woah.txt", "sub/wow.txt", "sub/blah.txt")
                           .Execute();

            // Check the stem of the matched items
            Assert.Equal(new[] {
                new FilePatternMatch(path: "sub/woah.txt", stem: "woah.txt"),
                new FilePatternMatch(path: "sub/wow.txt", stem: "wow.txt")
            }, scenario.Result.Files.ToArray());
        }
Exemplo n.º 19
0
        public void MultipleRecursiveWildcardStemMatch()
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include("sub/**/bar/**/*.txt")
                           .Files("root.txt", "sub/one.txt", "sub/two.txt", "sub/sub2/bar/baz/three.txt", "sub/sub3/sub4/bar/three.txt")
                           .Execute();

            // Check the stem of the matched items
            Assert.Equal(new[] {
                new FilePatternMatch(path: "sub/sub2/bar/baz/three.txt", stem: "sub2/bar/baz/three.txt"),
                new FilePatternMatch(path: "sub/sub3/sub4/bar/three.txt", stem: "sub3/sub4/bar/three.txt")
            }, scenario.Result.Files.ToArray());
        }
Exemplo n.º 20
0
        public void ExcludeFolderByName()
        {
            var matcher  = new Matcher();
            var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
                           .Include("*.*")
                           .Include("../sibling/**/*.*")
                           .Exclude("../sibling/exc/")
                           .Exclude("../sibling/inc/2.txt")
                           .Files("main/1.txt", "main/2.txt", "sibling/1.txt", "sibling/inc/1.txt", "sibling/inc/2.txt", "sibling/exc/1.txt", "sibling/exc/2.txt")
                           .SubDirectory("main")
                           .Execute();

            scenario.AssertExact("1.txt", "2.txt", "../sibling/1.txt", "../sibling/inc/1.txt");
        }