@Test public void testQuotesAndParen() throws InvalidPatternException { List<String> result; SpecialistGlobExpander special = new SpecialistGlobExpander(true, PhraseTreatment.INTERIOR_EXPANDABLE, PhraseTreatment.INTERIOR_NOT_EXPANDABLE); result = special.expand("\"{hello,goodbye}{1-2,({3-4}),(\")}\""); assertEquals(8, result.size()); assertTrue(result.contains("\"goodbye2\"")); assertTrue(result.contains("\"hello({3-4})\"")); assertTrue(result.contains("\"goodbye(\")\"")); }
@Test public void testBasic() throws InvalidPatternException { assertTrue(WildcardGlobs.isGlobMatched("a?{ex,in}", "akin")); assertTrue(WildcardGlobs.isGlobMatched("a?{ex,in}", "alex")); assertFalse(WildcardGlobs.isGlobMatched("a?{ex,in}", "appin")); }
@Test public void testEmpty() throws InvalidPatternException { assertTrue(WildcardGlobs.isGlobMatched("a{,?}{,b}", "a")); assertTrue(WildcardGlobs.isGlobMatched("a{,?}{,b}", "ab")); assertTrue(WildcardGlobs.isGlobMatched("a{,?}{,b}", "ac")); assertTrue(WildcardGlobs.isGlobMatched("a{,?}{,b}", "acb")); assertFalse(WildcardGlobs.isGlobMatched("a{,?}{,b}", "abc")); assertFalse(WildcardGlobs.isGlobMatched("a{,?}{,b}", "accb")); }
@Test public void testNumLeadZero() throws InvalidPatternException { assertTrue(newGlobExpander().isGlobMatchedNumeric("a{01-03,05}", "a01")); assertTrue(newGlobExpander().isGlobMatchedNumeric("a{ 01 - 03 , 05 }", "a01")); assertTrue(newGlobExpander().isGlobMatchedNumeric("a{ 01 - 03 , 05 }", "a02")); assertTrue(newGlobExpander().isGlobMatchedNumeric("a{ 01 - 03 , 05 }", "a03")); assertTrue(newGlobExpander().isGlobMatchedNumeric("a{ 01 - 03 , 05 }", "a 05 ")); assertTrue(newGlobExpander().isGlobMatchedNumeric("a{01-03,05}", "a05")); assertFalse(newGlobExpander().isGlobMatchedNumeric("a{01-03,05}", "a04")); assertFalse(newGlobExpander().isGlobMatchedNumeric("a{01-03,05}", "a3")); }
@Test public void testNum() throws InvalidPatternException { assertTrue(newGlobExpander().isGlobMatchedNumeric("{1-3}", "1")); assertTrue(newGlobExpander().isGlobMatchedNumeric("a{1-3}", "a1")); assertTrue(newGlobExpander().isGlobMatchedNumeric("a{1-3,5}", "a1")); assertTrue(newGlobExpander().isGlobMatchedNumeric("a{1-3,5}", "a3")); assertTrue(newGlobExpander().isGlobMatchedNumeric("a{1-3,5}", "a5")); assertFalse(newGlobExpander().isGlobMatchedNumeric("a{1-3,5}", "a4")); assertFalse(newGlobExpander().isGlobMatchedNumeric("a{1-3,5}", "a01")); }