From 0588dd0a9f7a86a7a854da444a9a27d2eabb2a66 Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Mon, 31 Jan 2022 08:58:17 +0100 Subject: [test] Fix ConfigTest for Windows Escape paths when writing them to a config file to ensure they work with backslashes and unusual characters. Bug: 550111 Change-Id: Iedc5c0f2c0c02ac6cadf43cdae0f0d19578aed91 Signed-off-by: Thomas Wolf --- .../tst/org/eclipse/jgit/lib/ConfigTest.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'org.eclipse.jgit.test/tst') 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 9b82c2afd6..a85a4f49b6 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 @@ -1488,7 +1488,8 @@ public class ConfigTest { String expectedTemplatePath = tempFile.getPath(); Config config = parse( - "[commit]\n\ttemplate = " + expectedTemplatePath + "\n"); + "[commit]\n\ttemplate = " + + Config.escapeValue(expectedTemplatePath) + "\n"); String templatePath = config.get(CommitConfig.KEY) .getCommitTemplatePath(); @@ -1537,7 +1538,8 @@ public class ConfigTest { JGitTestUtil.write(tempFile, templateContent); String expectedTemplatePath = tempFile.getPath(); config = parse("[i18n]\n\tcommitEncoding = utf-8\n" - + "[commit]\n\ttemplate = " + expectedTemplatePath + "\n"); + + "[commit]\n\ttemplate = " + + Config.escapeValue(expectedTemplatePath) + "\n"); assertEquals(templateContent, config.get(CommitConfig.KEY).getCommitTemplateContent(repo)); String commitEncoding = config.get(CommitConfig.KEY) @@ -1556,7 +1558,8 @@ public class ConfigTest { String templateContent = "content of the template"; JGitTestUtil.write(tempFile, templateContent); config = parse("[i18n]\n\tcommitEncoding = invalidEcoding\n" - + "[commit]\n\ttemplate = " + tempFile.getPath() + "\n"); + + "[commit]\n\ttemplate = " + + Config.escapeValue(tempFile.getPath()) + "\n"); config.get(CommitConfig.KEY).getCommitTemplateContent(repo); } @@ -1570,7 +1573,7 @@ public class ConfigTest { String templateContent = "content of the template"; JGitTestUtil.write(tempFile, templateContent); // commit message encoding - String expectedTemplatePath = "/nonExistingTemplate"; + String expectedTemplatePath = "~/nonExistingTemplate"; config = parse("[commit]\n\ttemplate = " + expectedTemplatePath + "\n"); String templatePath = config.get(CommitConfig.KEY) .getCommitTemplatePath(); -- cgit v1.2.3