summaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorFlorian Zschocke <florian.zschocke@devolo.de>2019-06-10 21:32:02 +0200
committerFlorian Zschocke <florian.zschocke@devolo.de>2019-06-10 22:14:13 +0200
commit889c5cc75ef8a5b9313cf9300e35b5d68925f0bf (patch)
tree2bb2df9d732cecb506e306ecd7ae5f6eae0a5c99 /src/test/java
parenta92a8fb1a1ea61783a6a9563aa9f6c0967c76089 (diff)
downloadgitblit-889c5cc75ef8a5b9313cf9300e35b5d68925f0bf.tar.gz
gitblit-889c5cc75ef8a5b9313cf9300e35b5d68925f0bf.zip
Create unit tests for special characters in path names
Create a regression test for issue #999. Add directories with '[]' ans '()' in the name to the hello-world repository, so that they can be used in unit tests for repository paths with special characters.
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/com/gitblit/tests/JGitUtilsTest.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/test/java/com/gitblit/tests/JGitUtilsTest.java b/src/test/java/com/gitblit/tests/JGitUtilsTest.java
index 5f083555..a493884a 100644
--- a/src/test/java/com/gitblit/tests/JGitUtilsTest.java
+++ b/src/test/java/com/gitblit/tests/JGitUtilsTest.java
@@ -596,10 +596,22 @@ public class JGitUtilsTest extends GitblitUnitTest {
@Test
public void testFilesInPath2() throws Exception {
assertEquals(0, JGitUtils.getFilesInPath2(null, null, null).size());
+
Repository repository = GitBlitSuite.getHelloworldRepository();
+
List<PathModel> files = JGitUtils.getFilesInPath2(repository, null, null);
+ assertEquals(GitBlitSuite.helloworldSettings.getInteger(HelloworldKeys.files.top, 15), files.size());
+
+ files = JGitUtils.getFilesInPath2(repository, "C", null);
+ assertEquals(GitBlitSuite.helloworldSettings.getInteger(HelloworldKeys.files.C.top, 1), files.size());
+
+ files = JGitUtils.getFilesInPath2(repository, "[C++]", null);
+ assertEquals(GitBlitSuite.helloworldSettings.getInteger(HelloworldKeys.files.Cpp, 1), files.size());
+
+ files = JGitUtils.getFilesInPath2(repository, "C/C (K&R)", null);
+ assertEquals(GitBlitSuite.helloworldSettings.getInteger(HelloworldKeys.files.C.KnR, 1), files.size());
+
repository.close();
- assertTrue(files.size() > 10);
}
@Test