Skip to content

Commit 889c5cc

Browse files
committed
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.
1 parent a92a8fb commit 889c5cc

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

src/test/data/hello-world.git.zip

20.5 KB
Binary file not shown.

src/test/data/hello-world.properties

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,9 @@ commit.fifteen=5ebfaca
55
commit.added=192cded
66
commit.changed=b2c50ce
77
commit.deleted=8613bee10bde27a0fbaca66447cdc3f0f9483365
8-
users.byEmail=9
9-
users.byName=8
8+
users.byEmail=11
9+
users.byName=10
10+
files.top=14
11+
files.C.top=2
12+
files.C.KnR=1
13+
files.Cpp=1

src/test/java/com/gitblit/tests/JGitUtilsTest.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,10 +596,22 @@ public void testFilesInPath() throws Exception {
596596
@Test
597597
public void testFilesInPath2() throws Exception {
598598
assertEquals(0, JGitUtils.getFilesInPath2(null, null, null).size());
599+
599600
Repository repository = GitBlitSuite.getHelloworldRepository();
601+
600602
List<PathModel> files = JGitUtils.getFilesInPath2(repository, null, null);
603+
assertEquals(GitBlitSuite.helloworldSettings.getInteger(HelloworldKeys.files.top, 15), files.size());
604+
605+
files = JGitUtils.getFilesInPath2(repository, "C", null);
606+
assertEquals(GitBlitSuite.helloworldSettings.getInteger(HelloworldKeys.files.C.top, 1), files.size());
607+
608+
files = JGitUtils.getFilesInPath2(repository, "[C++]", null);
609+
assertEquals(GitBlitSuite.helloworldSettings.getInteger(HelloworldKeys.files.Cpp, 1), files.size());
610+
611+
files = JGitUtils.getFilesInPath2(repository, "C/C (K&R)", null);
612+
assertEquals(GitBlitSuite.helloworldSettings.getInteger(HelloworldKeys.files.C.KnR, 1), files.size());
613+
601614
repository.close();
602-
assertTrue(files.size() > 10);
603615
}
604616

605617
@Test

0 commit comments

Comments
 (0)