From c15834664275481c93b6d5eaf89e99dbf46b3817 Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Wed, 1 Feb 2017 22:43:23 +0000 Subject: [PATCH] Add more nested globpath tests --- internal/globpath/globpath_test.go | 12 +++++++++++- .../globpath/testdata/nested1/nested2/nested.txt | 0 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 internal/globpath/testdata/nested1/nested2/nested.txt diff --git a/internal/globpath/globpath_test.go b/internal/globpath/globpath_test.go index db72c94f4..720572411 100644 --- a/internal/globpath/globpath_test.go +++ b/internal/globpath/globpath_test.go @@ -28,7 +28,7 @@ func TestCompileAndMatch(t *testing.T) { require.NoError(t, err) matches := g1.Match() - assert.Len(t, matches, 3) + assert.Len(t, matches, 6) matches = g2.Match() assert.Len(t, matches, 2) 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 { _, filename, _, _ := runtime.Caller(1) return strings.Replace(filename, "globpath_test.go", "testdata", 1) diff --git a/internal/globpath/testdata/nested1/nested2/nested.txt b/internal/globpath/testdata/nested1/nested2/nested.txt new file mode 100644 index 000000000..e69de29bb