}
@Test
public void testSegmentsGlobMatch() throws Exception {
String s = "syntax:glob\nbin\n.*\nTEST-*.xml";
HgIgnore hgIgnore = HgInternals.newHgIgnore(new StringReader(s), null);
Path[] toCheck = new Path[] {
Path.create("bin/org/sample/First.class"),
Path.create(".ignored-file"),
Path.create("dir/.ignored-file"),
Path.create("dir/.ignored-dir/file"),
Path.create("TEST-a.xml"),
Path.create("dir/TEST-b.xml"),
};
doAssert(hgIgnore, toCheck, null);
//
s = "syntax:glob\n.git";
hgIgnore = HgInternals.newHgIgnore(new StringReader(s), null);
Path p = Path.create(".git/aa");
errorCollector.assertTrue(p.toString(), hgIgnore.isIgnored(p));
p = Path.create("dir/.git/bb");
errorCollector.assertTrue(p.toString(), hgIgnore.isIgnored(p));
p = Path.create("dir/.gittt/cc");
errorCollector.assertTrue(p.toString(), !hgIgnore.isIgnored(p));
}