-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue with glob pattern not matching when single wildcard used in a segment, and followed by additional segments. Also increased test coverage so that Match and IsMatch are inlign.
- Loading branch information
Showing
7 changed files
with
83 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace DotNet.Globbing.Tests | ||
{ | ||
public class OtherGlobLibraryTests | ||
{ | ||
|
||
[Theory] | ||
[InlineData("literal", "literal")] | ||
[InlineData("a/literal", "a/literal")] | ||
[InlineData("path/*atstand", "path/fooatstand")] | ||
[InlineData("path/hats*nd", "path/hatsforstand")] | ||
[InlineData("path/?atstand", "path/hatstand")] | ||
[InlineData("path/?atstand?", "path/hatstands")] | ||
[InlineData("p?th/*a[bcd]", "pAth/fooooac")] | ||
[InlineData("p?th/*a[bcd]b[e-g]a[1-4]", "pAth/fooooacbfa2")] | ||
[InlineData("p?th/*a[bcd]b[e-g]a[1-4][!wxyz]", "pAth/fooooacbfa2v")] | ||
[InlineData("p?th/*a[bcd]b[e-g]a[1-4][!wxyz][!a-c][!1-3].*", "pAth/fooooacbfa2vd4.txt")] | ||
[InlineData("path/**/somefile.txt", "path/foo/bar/baz/somefile.txt")] | ||
[InlineData("p?th/*a[bcd]b[e-g]a[1-4][!wxyz][!a-c][!1-3].*", "pGth/yGKNY6acbea3rm8.")] | ||
[InlineData("/**/file.*", "/folder/file.csv")] | ||
//[InlineData("/**/file.*", "/file.txt")] | ||
//[InlineData("**/file.*", "/file.txt")] | ||
//[InlineData("/**/file.*", "/file.txt")] | ||
//[InlineData("/**/f~le.*", "/f~le.txt")] | ||
public void Glob_IsMatch(string pattern, params string[] testStrings) | ||
{ | ||
// This is a different glob library, I am seeing if it matches the same patterns as my library. | ||
// The tests above commented out show it has some limitations, that I have addressed in this library. | ||
var glob = new global::Glob.Glob(pattern); | ||
foreach (var testString in testStrings) | ||
{ | ||
var match = glob.IsMatch(testString); | ||
Assert.True(match); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters