]> source.dussan.org Git - gitblit.git/commitdiff
Create unit tests for special characters in path names
authorFlorian Zschocke <florian.zschocke@devolo.de>
Mon, 10 Jun 2019 19:32:02 +0000 (21:32 +0200)
committerFlorian Zschocke <florian.zschocke@devolo.de>
Mon, 10 Jun 2019 20:14:13 +0000 (22:14 +0200)
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.

src/test/data/hello-world.git.zip
src/test/data/hello-world.properties
src/test/java/com/gitblit/tests/JGitUtilsTest.java

index e1057a6b5c0aa562d9cbe431d55096d007f2819c..ef378f236bc6d762835c1e1563105297701a71e5 100644 (file)
Binary files a/src/test/data/hello-world.git.zip and b/src/test/data/hello-world.git.zip differ
index 99ed126b01575cabf5faac761e46c9560be79e52..7828a8ce405af1a282ba509f33ebc8fb81e995b8 100644 (file)
@@ -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
index 5f0835554b6129b6bc6ed46c08f39cea0285a038..a493884a0368455631284cce49831340f6b1edeb 100644 (file)
@@ -596,10 +596,22 @@ public class JGitUtilsTest extends GitblitUnitTest {
        @Test\r
        public void testFilesInPath2() throws Exception {\r
                assertEquals(0, JGitUtils.getFilesInPath2(null, null, null).size());\r
+\r
                Repository repository = GitBlitSuite.getHelloworldRepository();\r
+\r
                List<PathModel> files = JGitUtils.getFilesInPath2(repository, null, null);\r
+               assertEquals(GitBlitSuite.helloworldSettings.getInteger(HelloworldKeys.files.top, 15), files.size());\r
+\r
+               files = JGitUtils.getFilesInPath2(repository, "C", null);\r
+               assertEquals(GitBlitSuite.helloworldSettings.getInteger(HelloworldKeys.files.C.top, 1), files.size());\r
+\r
+               files = JGitUtils.getFilesInPath2(repository, "[C++]", null);\r
+               assertEquals(GitBlitSuite.helloworldSettings.getInteger(HelloworldKeys.files.Cpp, 1), files.size());\r
+\r
+               files = JGitUtils.getFilesInPath2(repository, "C/C (K&R)", null);\r
+               assertEquals(GitBlitSuite.helloworldSettings.getInteger(HelloworldKeys.files.C.KnR, 1), files.size());\r
+\r
                repository.close();\r
-               assertTrue(files.size() > 10);\r
        }\r
 \r
        @Test\r