From 8bb69bfdd8201ffbd531097d95f29c8a3e88a7a6 Mon Sep 17 00:00:00 2001 From: Antoine Levy-Lambert Date: Sun, 6 Mar 2016 22:37:05 -0500 Subject: [PATCH] commit a test illustrated by the bug report 59114, that is that the "**" pattern matches the empty path, but the "*" pattern does not. --- .../ant/types/selectors/TokenizedPatternTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/TokenizedPatternTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/TokenizedPatternTest.java index fb068a350..55f7b0302 100644 --- a/src/tests/junit/org/apache/tools/ant/types/selectors/TokenizedPatternTest.java +++ b/src/tests/junit/org/apache/tools/ant/types/selectors/TokenizedPatternTest.java @@ -22,6 +22,7 @@ import java.io.File; import org.junit.Test; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; public class TokenizedPatternTest { @@ -61,4 +62,16 @@ public class TokenizedPatternTest { .withoutLastToken().matchPath(p, true)); } + @Test + /** + * this test illustrates the behavior described in bugzilla 59114 + * meaning that the pattern "**" matches the empty path + * but the pattern "*" does not + */ + public void testEmptyFolderWithStarStar() { + TokenizedPath p = TokenizedPath.EMPTY_PATH; + assertTrue(new TokenizedPattern(SelectorUtils.DEEP_TREE_MATCH).matchPath(p, true)); + assertFalse(new TokenizedPattern("*").matchPath(p, true)); + } + }