|
|
@ -45,6 +45,7 @@ |
|
|
|
package org.eclipse.jgit.fnmatch; |
|
|
|
package org.eclipse.jgit.fnmatch; |
|
|
|
|
|
|
|
|
|
|
|
import static org.junit.Assert.assertEquals; |
|
|
|
import static org.junit.Assert.assertEquals; |
|
|
|
|
|
|
|
import static org.junit.Assert.assertFalse; |
|
|
|
import static org.junit.Assert.assertTrue; |
|
|
|
import static org.junit.Assert.assertTrue; |
|
|
|
import static org.junit.Assert.fail; |
|
|
|
import static org.junit.Assert.fail; |
|
|
|
|
|
|
|
|
|
|
@ -829,22 +830,22 @@ public class FileNameMatcherTest { |
|
|
|
final String pattern = "helloworld"; |
|
|
|
final String pattern = "helloworld"; |
|
|
|
final FileNameMatcher matcher = new FileNameMatcher(pattern, null); |
|
|
|
final FileNameMatcher matcher = new FileNameMatcher(pattern, null); |
|
|
|
matcher.append("helloworld"); |
|
|
|
matcher.append("helloworld"); |
|
|
|
assertEquals(true, matcher.isMatch()); |
|
|
|
assertTrue(matcher.isMatch()); |
|
|
|
assertEquals(false, matcher.canAppendMatch()); |
|
|
|
assertFalse(matcher.canAppendMatch()); |
|
|
|
matcher.reset(); |
|
|
|
matcher.reset(); |
|
|
|
matcher.append("hello"); |
|
|
|
matcher.append("hello"); |
|
|
|
assertEquals(false, matcher.isMatch()); |
|
|
|
assertFalse(matcher.isMatch()); |
|
|
|
assertEquals(true, matcher.canAppendMatch()); |
|
|
|
assertTrue(matcher.canAppendMatch()); |
|
|
|
matcher.append("world"); |
|
|
|
matcher.append("world"); |
|
|
|
assertEquals(true, matcher.isMatch()); |
|
|
|
assertTrue(matcher.isMatch()); |
|
|
|
assertEquals(false, matcher.canAppendMatch()); |
|
|
|
assertFalse(matcher.canAppendMatch()); |
|
|
|
matcher.append("to much"); |
|
|
|
matcher.append("to much"); |
|
|
|
assertEquals(false, matcher.isMatch()); |
|
|
|
assertFalse(matcher.isMatch()); |
|
|
|
assertEquals(false, matcher.canAppendMatch()); |
|
|
|
assertFalse(matcher.canAppendMatch()); |
|
|
|
matcher.reset(); |
|
|
|
matcher.reset(); |
|
|
|
matcher.append("helloworld"); |
|
|
|
matcher.append("helloworld"); |
|
|
|
assertEquals(true, matcher.isMatch()); |
|
|
|
assertTrue(matcher.isMatch()); |
|
|
|
assertEquals(false, matcher.canAppendMatch()); |
|
|
|
assertFalse(matcher.canAppendMatch()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -853,30 +854,30 @@ public class FileNameMatcherTest { |
|
|
|
final FileNameMatcher matcher = new FileNameMatcher(pattern, null); |
|
|
|
final FileNameMatcher matcher = new FileNameMatcher(pattern, null); |
|
|
|
matcher.append("hello"); |
|
|
|
matcher.append("hello"); |
|
|
|
final FileNameMatcher childMatcher = matcher.createMatcherForSuffix(); |
|
|
|
final FileNameMatcher childMatcher = matcher.createMatcherForSuffix(); |
|
|
|
assertEquals(false, matcher.isMatch()); |
|
|
|
assertFalse(matcher.isMatch()); |
|
|
|
assertEquals(true, matcher.canAppendMatch()); |
|
|
|
assertTrue(matcher.canAppendMatch()); |
|
|
|
assertEquals(false, childMatcher.isMatch()); |
|
|
|
assertFalse(childMatcher.isMatch()); |
|
|
|
assertEquals(true, childMatcher.canAppendMatch()); |
|
|
|
assertTrue(childMatcher.canAppendMatch()); |
|
|
|
matcher.append("world"); |
|
|
|
matcher.append("world"); |
|
|
|
assertEquals(true, matcher.isMatch()); |
|
|
|
assertTrue(matcher.isMatch()); |
|
|
|
assertEquals(false, matcher.canAppendMatch()); |
|
|
|
assertFalse(matcher.canAppendMatch()); |
|
|
|
assertEquals(false, childMatcher.isMatch()); |
|
|
|
assertFalse(childMatcher.isMatch()); |
|
|
|
assertEquals(true, childMatcher.canAppendMatch()); |
|
|
|
assertTrue(childMatcher.canAppendMatch()); |
|
|
|
childMatcher.append("world"); |
|
|
|
childMatcher.append("world"); |
|
|
|
assertEquals(true, matcher.isMatch()); |
|
|
|
assertTrue(matcher.isMatch()); |
|
|
|
assertEquals(false, matcher.canAppendMatch()); |
|
|
|
assertFalse(matcher.canAppendMatch()); |
|
|
|
assertEquals(true, childMatcher.isMatch()); |
|
|
|
assertTrue(childMatcher.isMatch()); |
|
|
|
assertEquals(false, childMatcher.canAppendMatch()); |
|
|
|
assertFalse(childMatcher.canAppendMatch()); |
|
|
|
childMatcher.reset(); |
|
|
|
childMatcher.reset(); |
|
|
|
assertEquals(true, matcher.isMatch()); |
|
|
|
assertTrue(matcher.isMatch()); |
|
|
|
assertEquals(false, matcher.canAppendMatch()); |
|
|
|
assertFalse(matcher.canAppendMatch()); |
|
|
|
assertEquals(false, childMatcher.isMatch()); |
|
|
|
assertFalse(childMatcher.isMatch()); |
|
|
|
assertEquals(true, childMatcher.canAppendMatch()); |
|
|
|
assertTrue(childMatcher.canAppendMatch()); |
|
|
|
childMatcher.append("world"); |
|
|
|
childMatcher.append("world"); |
|
|
|
assertEquals(true, matcher.isMatch()); |
|
|
|
assertTrue(matcher.isMatch()); |
|
|
|
assertEquals(false, matcher.canAppendMatch()); |
|
|
|
assertFalse(matcher.canAppendMatch()); |
|
|
|
assertEquals(true, childMatcher.isMatch()); |
|
|
|
assertTrue(childMatcher.isMatch()); |
|
|
|
assertEquals(false, childMatcher.canAppendMatch()); |
|
|
|
assertFalse(childMatcher.canAppendMatch()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -885,29 +886,29 @@ public class FileNameMatcherTest { |
|
|
|
final FileNameMatcher matcher = new FileNameMatcher(pattern, null); |
|
|
|
final FileNameMatcher matcher = new FileNameMatcher(pattern, null); |
|
|
|
matcher.append("hello"); |
|
|
|
matcher.append("hello"); |
|
|
|
final FileNameMatcher copy = new FileNameMatcher(matcher); |
|
|
|
final FileNameMatcher copy = new FileNameMatcher(matcher); |
|
|
|
assertEquals(false, matcher.isMatch()); |
|
|
|
assertFalse(matcher.isMatch()); |
|
|
|
assertEquals(true, matcher.canAppendMatch()); |
|
|
|
assertTrue(matcher.canAppendMatch()); |
|
|
|
assertEquals(false, copy.isMatch()); |
|
|
|
assertFalse(copy.isMatch()); |
|
|
|
assertEquals(true, copy.canAppendMatch()); |
|
|
|
assertTrue(copy.canAppendMatch()); |
|
|
|
matcher.append("world"); |
|
|
|
matcher.append("world"); |
|
|
|
assertEquals(true, matcher.isMatch()); |
|
|
|
assertTrue(matcher.isMatch()); |
|
|
|
assertEquals(false, matcher.canAppendMatch()); |
|
|
|
assertFalse(matcher.canAppendMatch()); |
|
|
|
assertEquals(false, copy.isMatch()); |
|
|
|
assertFalse(copy.isMatch()); |
|
|
|
assertEquals(true, copy.canAppendMatch()); |
|
|
|
assertTrue(copy.canAppendMatch()); |
|
|
|
copy.append("world"); |
|
|
|
copy.append("world"); |
|
|
|
assertEquals(true, matcher.isMatch()); |
|
|
|
assertTrue(matcher.isMatch()); |
|
|
|
assertEquals(false, matcher.canAppendMatch()); |
|
|
|
assertFalse(matcher.canAppendMatch()); |
|
|
|
assertEquals(true, copy.isMatch()); |
|
|
|
assertTrue(copy.isMatch()); |
|
|
|
assertEquals(false, copy.canAppendMatch()); |
|
|
|
assertFalse(copy.canAppendMatch()); |
|
|
|
copy.reset(); |
|
|
|
copy.reset(); |
|
|
|
assertEquals(true, matcher.isMatch()); |
|
|
|
assertTrue(matcher.isMatch()); |
|
|
|
assertEquals(false, matcher.canAppendMatch()); |
|
|
|
assertFalse(matcher.canAppendMatch()); |
|
|
|
assertEquals(false, copy.isMatch()); |
|
|
|
assertFalse(copy.isMatch()); |
|
|
|
assertEquals(true, copy.canAppendMatch()); |
|
|
|
assertTrue(copy.canAppendMatch()); |
|
|
|
copy.append("helloworld"); |
|
|
|
copy.append("helloworld"); |
|
|
|
assertEquals(true, matcher.isMatch()); |
|
|
|
assertTrue(matcher.isMatch()); |
|
|
|
assertEquals(false, matcher.canAppendMatch()); |
|
|
|
assertFalse(matcher.canAppendMatch()); |
|
|
|
assertEquals(true, copy.isMatch()); |
|
|
|
assertTrue(copy.isMatch()); |
|
|
|
assertEquals(false, copy.canAppendMatch()); |
|
|
|
assertFalse(copy.canAppendMatch()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|