Add more nested globpath tests

This commit is contained in:
Cameron Sparr 2017-02-01 22:43:23 +00:00
parent 0c5e329212
commit c158346642
2 changed files with 11 additions and 1 deletions

View File

@ -28,7 +28,7 @@ func TestCompileAndMatch(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
matches := g1.Match() matches := g1.Match()
assert.Len(t, matches, 3) assert.Len(t, matches, 6)
matches = g2.Match() matches = g2.Match()
assert.Len(t, matches, 2) assert.Len(t, matches, 2)
matches = g3.Match() matches = g3.Match()
@ -56,6 +56,16 @@ func TestFindRootDir(t *testing.T) {
} }
} }
func TestFindNestedTextFile(t *testing.T) {
dir := getTestdataDir()
// test super asterisk
g1, err := Compile(dir + "/**.txt")
require.NoError(t, err)
matches := g1.Match()
assert.Len(t, matches, 1)
}
func getTestdataDir() string { func getTestdataDir() string {
_, filename, _, _ := runtime.Caller(1) _, filename, _, _ := runtime.Caller(1)
return strings.Replace(filename, "globpath_test.go", "testdata", 1) return strings.Replace(filename, "globpath_test.go", "testdata", 1)

View File