assertTrue(r.matches("barfoo"));
}
@Test
public void testGlob() {
Rule r = new Rule();
r.type = RuleType.GLOB;
r.dest = "/tmp";
r.pattern = "foo";
assertFalse(r.matches("bar"));
assertFalse(r.matches("foobar"));
assertFalse(r.matches("barfoo"));
assertTrue(r.matches("foo"));
r.pattern = "fo.o";
assertFalse(r.matches("foxo"));
assertFalse(r.matches("foo"));
assertTrue(r.matches("fo.o"));
r.pattern = "foo?";
assertFalse(r.matches("bar"));
assertFalse(r.matches("fooxx"));
assertFalse(r.matches("xfoox"));
assertTrue(r.matches("foo "));
assertTrue(r.matches("foox"));
assertTrue(r.matches("foo\u2605"));
r.pattern = "*foo";
assertFalse(r.matches("foobar"));
assertFalse(r.matches(" foobar"));
assertTrue(r.matches("foo"));
assertTrue(r.matches("bar foo"));
assertTrue(r.matches(" foo"));
r.pattern = "*foo*";
assertFalse(r.matches("fo"));
assertFalse(r.matches("bar"));
assertFalse(r.matches(""));
assertTrue(r.matches("foo"));
assertTrue(r.matches("bar foo baz"));
assertTrue(r.matches(" foo"));
assertTrue(r.matches(" foo&."));
r.pattern = "\\w";
assertFalse(r.matches("a"));
assertTrue(r.matches("\\w"));
r.pattern = "foo.";
assertFalse(r.matches("foo"));
assertFalse(r.matches("foox"));
assertTrue(r.matches("foo."));
r.pattern = "foo[";
assertTrue(r.matches("foo["));
assertFalse(r.matches("foox"));
assertFalse(r.matches("foo"));
r.pattern = "foo[]";
assertTrue(r.matches("foo[]"));
assertFalse(r.matches("foox"));
assertFalse(r.matches("foo"));
}