Mercurial > hg4j
comparison 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 |
comparison
equal
deleted
inserted
replaced
407:30922c728341 | 408:e732521a9eb4 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2011 TMate Software Ltd | 2 * Copyright (c) 2011-2012 TMate Software Ltd |
3 * | 3 * |
4 * This program is free software; you can redistribute it and/or modify | 4 * This program is free software; you can redistribute it and/or modify |
5 * it under the terms of the GNU General Public License as published by | 5 * it under the terms of the GNU General Public License as published by |
6 * the Free Software Foundation; version 2 of the License. | 6 * the Free Software Foundation; version 2 of the License. |
7 * | 7 * |
13 * For information on how to redistribute this software under | 13 * For information on how to redistribute this software under |
14 * the terms of a license other than GNU General Public License | 14 * the terms of a license other than GNU General Public License |
15 * contact TMate Software at support@hg4j.com | 15 * contact TMate Software at support@hg4j.com |
16 */ | 16 */ |
17 package org.tmatesoft.hg.test; | 17 package org.tmatesoft.hg.test; |
18 | |
19 import static org.tmatesoft.hg.util.Path.create; | |
18 | 20 |
19 import java.io.BufferedReader; | 21 import java.io.BufferedReader; |
20 import java.io.File; | 22 import java.io.File; |
21 import java.io.FileReader; | 23 import java.io.FileReader; |
22 import java.io.StringReader; | 24 import java.io.StringReader; |
150 } | 152 } |
151 for (Path p : toPass) { | 153 for (Path p : toPass) { |
152 errorCollector.assertTrue(p.toString(), !hgIgnore.isIgnored(p)); | 154 errorCollector.assertTrue(p.toString(), !hgIgnore.isIgnored(p)); |
153 } | 155 } |
154 } | 156 } |
157 | |
158 @Test | |
159 public void testSyntaxPrefixAtLine() throws Exception { | |
160 String s = "glob:*.c\nregexp:.*\\.d"; | |
161 HgIgnore hgIgnore = HgInternals.newHgIgnore(new StringReader(s)); | |
162 Path[] toPass = new Path[] { | |
163 create("a/c"), | |
164 create("a/d"), | |
165 create("a/d.a"), | |
166 create("a/d.e"), | |
167 }; | |
168 Path[] toIgnore = new Path[] { | |
169 create("a.c"), | |
170 create("a.d"), | |
171 create("src/a.c"), | |
172 create("src/a.d"), | |
173 }; | |
174 for (Path p : toIgnore) { | |
175 errorCollector.assertTrue("Shall ignore " + p, hgIgnore.isIgnored(p)); | |
176 } | |
177 for (Path p : toPass) { | |
178 errorCollector.assertTrue("Shall pass " + p, !hgIgnore.isIgnored(p)); | |
179 } | |
180 } | |
155 } | 181 } |