Mercurial > hg4j
diff test/org/tmatesoft/hg/test/TestIgnore.java @ 408:e732521a9eb4 smartgit3
Issue 28: support hgignore entries with syntax prefix
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 16 Mar 2012 15:06:44 +0100 |
parents | a0864b2892cd |
children | 0f5696623512 |
line wrap: on
line diff
--- a/test/org/tmatesoft/hg/test/TestIgnore.java Fri Mar 16 12:51:03 2012 +0100 +++ b/test/org/tmatesoft/hg/test/TestIgnore.java Fri Mar 16 15:06:44 2012 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 TMate Software Ltd + * Copyright (c) 2011-2012 TMate Software Ltd * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,6 +16,8 @@ */ package org.tmatesoft.hg.test; +import static org.tmatesoft.hg.util.Path.create; + import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -152,4 +154,28 @@ errorCollector.assertTrue(p.toString(), !hgIgnore.isIgnored(p)); } } + + @Test + public void testSyntaxPrefixAtLine() throws Exception { + String s = "glob:*.c\nregexp:.*\\.d"; + HgIgnore hgIgnore = HgInternals.newHgIgnore(new StringReader(s)); + Path[] toPass = new Path[] { + create("a/c"), + create("a/d"), + create("a/d.a"), + create("a/d.e"), + }; + Path[] toIgnore = new Path[] { + create("a.c"), + create("a.d"), + create("src/a.c"), + create("src/a.d"), + }; + for (Path p : toIgnore) { + errorCollector.assertTrue("Shall ignore " + p, hgIgnore.isIgnored(p)); + } + for (Path p : toPass) { + errorCollector.assertTrue("Shall pass " + p, !hgIgnore.isIgnored(p)); + } + } }