diff options
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java index d30c1911de..69926f915d 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java @@ -214,6 +214,20 @@ public class ConfigTest { } @Test + public void testReadUserConfigWithInvalidCharactersStripped() { + final MockSystemReader mockSystemReader = new MockSystemReader(); + final Config localConfig = new Config(mockSystemReader.openUserConfig( + null, FS.DETECTED)); + + localConfig.setString("user", null, "name", "foo<bar"); + localConfig.setString("user", null, "email", "baz>\nqux@example.com"); + + UserConfig userConfig = localConfig.get(UserConfig.KEY); + assertEquals("foobar", userConfig.getAuthorName()); + assertEquals("bazqux@example.com", userConfig.getAuthorEmail()); + } + + @Test public void testReadBoolean_TrueFalse1() throws ConfigInvalidException { final Config c = parse("[s]\na = true\nb = false\n"); assertEquals("true", c.getString("s", null, "a")); |