Browse Source

ConfigTest: Add test for parsing invalid group header

Test that an exception is raised for an invalid group header:

  [group "foo" ]
     foo = bar

i.e. where there is a space between the group subsection name
and the closing ']'.

Change-Id: I8933ae100b77634b0afb66bb8aa43d24c955799e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-5.4
David Pursehouse 6 years ago
parent
commit
dff4f6cc74
  1. 7
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java

7
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java

@ -1450,6 +1450,13 @@ public class ConfigTest {
assertEquals("xt", parseEscapedSubsection("\"x\\t\""));
}
@Test
public void testInvalidGroupHeader() throws ConfigInvalidException {
expectedEx.expect(ConfigInvalidException.class);
expectedEx.expectMessage(JGitText.get().badGroupHeader);
parse("[foo \"bar\" ]\nfoo=bar\n");
}
private static void assertValueRoundTrip(String value)
throws ConfigInvalidException {
assertValueRoundTrip(value, value);

Loading…
Cancel
Save