Ejemplo n.º 1
0
        public void GlobUtilCanMatchSingle()
        {
            var glob = new SolutionGen.Utils.CompositeGlob(new[] { "*.cs" }, new[] { "*.txt" });

            Assert.True(glob.IsMatch("/Path/To/File.cs"));
            Assert.False(glob.IsMatch("/Path/To/File.txt"));
        }
Ejemplo n.º 2
0
        public void GlobDirectoryInfoReturnsRelativePaths()
        {
            var dir = new DirectoryInfo(Directory.GetCurrentDirectory());

            string[] results = new SolutionGen.Utils.CompositeGlob(new[] { "*" }, new string[0]).FilterMatches(dir).ToArray();
            Assert.Contains(results, s => s[0] != '/' && s[0] != '\\');
            Assert.True(results.All(r => new FileInfo(Path.Combine(dir.FullName, r)).Exists));
        }
Ejemplo n.º 3
0
        public void GlobUtilCanMatchMultiple()
        {
            var glob = new SolutionGen.Utils.CompositeGlob(new[] { "*.cs" }, new[] { "*.txt", "**/ExcludedDir/**" });

            string[] matches = glob.FilterMatches(new[]
            {
                "/Path/To/File1.cs",
                "/Path/To/File2.cs",
                "/Path/To/File1.txt",
                "/Path/To/File2.txt",
                "/Path/To/ExcludedDir/File.cs",
            }).ToArray();

            Assert.Equal(new[] { "/Path/To/File1.cs", "/Path/To/File2.cs" }, matches);
        }