diff options
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java | 2 | ||||
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java | 23 |
2 files changed, 18 insertions, 7 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java index ab86bc2e27..aa50697172 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java @@ -368,7 +368,7 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase { + "[user]\n" + " email = A U Thor <thor@example.com> # Just an example...\n" + " name = \"A Thor \\\\ \\\"\\t \"\n" - + " defaultCheckInComment = \"a many line\\ncomment\\n to test\"\n"; + + " defaultCheckInComment = a many line\\ncomment\\n to test\n"; assertEquals(expectedStr, new String(IO.readFully(cfg), Constants.CHARSET)); } 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 44714faa70..a952db764f 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 @@ -977,14 +977,25 @@ public class ConfigTest { } @Test - public void testEscapeSpecialCharacters() throws ConfigInvalidException { + public void testNoEscapeSpecialCharacters() throws ConfigInvalidException { + assertValueRoundTrip("x\\y", "x\\\\y"); + assertValueRoundTrip("x\"y", "x\\\"y"); + assertValueRoundTrip("x\ny", "x\\ny"); + assertValueRoundTrip("x\ty", "x\\ty"); + assertValueRoundTrip("x\by", "x\\by"); + } + + @Test + public void testParseLiteralBackspace() throws ConfigInvalidException { + // This is round-tripped with an escape sequence by JGit, but C git writes + // it out as a literal backslash. + assertEquals("x\by", parseEscapedValue("x\by")); + } + + @Test + public void testEscapeCommentCharacters() throws ConfigInvalidException { assertValueRoundTrip("x#y", "\"x#y\""); assertValueRoundTrip("x;y", "\"x;y\""); - assertValueRoundTrip("x\\y", "\"x\\\\y\""); - assertValueRoundTrip("x\"y", "\"x\\\"y\""); - assertValueRoundTrip("x\ny", "\"x\\ny\""); - assertValueRoundTrip("x\ty", "\"x\\ty\""); - assertValueRoundTrip("x\by", "\"x\\by\""); } @Test |