summaryrefslogtreecommitdiffstats
path: root/src/test
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
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')
-rw-r--r--src/test/data/hello-world.git.zipbin55129 -> 76158 bytes
-rw-r--r--src/test/data/hello-world.properties8
-rw-r--r--src/test/java/com/gitblit/tests/JGitUtilsTest.java14
3 files changed, 19 insertions, 3 deletions
diff --git a/src/test/data/hello-world.git.zip b/src/test/data/hello-world.git.zip
index e1057a6b..ef378f23 100644
--- a/src/test/data/hello-world.git.zip
+++ b/src/test/data/hello-world.git.zip
Binary files differ
diff --git a/src/test/data/hello-world.properties b/src/test/data/hello-world.properties
index 99ed126b..7828a8ce 100644
--- a/src/test/data/hello-world.properties
+++ b/src/test/data/hello-world.properties
@@ -5,5 +5,9 @@ commit.fifteen=5ebfaca
commit.added=192cded
commit.changed=b2c50ce
commit.deleted=8613bee10bde27a0fbaca66447cdc3f0f9483365
-users.byEmail=9
-users.byName=8
+users.byEmail=11
+users.byName=10
+files.top=14
+files.C.top=2
+files.C.KnR=1
+files.Cpp=1 \ No newline at end of file
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