summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse
diff options
context:
space:
mode:
authorMarc Strapetz <marc.strapetz@syntevo.com>2017-11-20 18:21:22 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2017-12-04 23:38:22 +0100
commite1adfee5f52023b9716899e6b6561fef1bb1fc1c (patch)
treeb6aa8726ca366db1242eb71530b08a92152f8f74 /org.eclipse.jgit.test/tst/org/eclipse
parentf8eff40cad8cae34ebdb2f39c434f900e7a77081 (diff)
downloadjgit-e1adfee5f52023b9716899e6b6561fef1bb1fc1c.tar.gz
jgit-e1adfee5f52023b9716899e6b6561fef1bb1fc1c.zip
ConfigTest: fix on Windows
Change-Id: I37a2ef611aef97faf1b891a9660c1745435a915d Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java16
1 files changed, 12 insertions, 4 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 748848e97f..7902bb5303 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
@@ -818,7 +818,7 @@ public class ConfigTest {
@Test
public void testIncludeTooManyRecursions() throws IOException {
File config = tmp.newFile("config");
- String include = "[include]\npath=" + config.toPath() + "\n";
+ String include = "[include]\npath=" + pathToString(config) + "\n";
Files.write(config.toPath(), include.getBytes());
FileBasedConfig fbConfig = new FileBasedConfig(null, config,
FS.DETECTED);
@@ -838,8 +838,8 @@ public class ConfigTest {
File other = tmp.newFile("config.other");
String fooBar = "[foo]\nbar=true\n";
- String includeMore = "[include]\npath=" + more.toPath() + "\n";
- String includeOther = "path=" + other.toPath() + "\n";
+ String includeMore = "[include]\npath=" + pathToString(more) + "\n";
+ String includeOther = "path=" + pathToString(other) + "\n";
String fooPlus = fooBar + includeMore + includeOther;
Files.write(config.toPath(), fooPlus.getBytes());
@@ -849,12 +849,20 @@ public class ConfigTest {
String otherMore = "[other]\nmore=bar\n";
Files.write(other.toPath(), otherMore.getBytes());
- Config parsed = parse("[include]\npath=" + config.toPath() + "\n");
+ Config parsed = parse("[include]\npath=" + pathToString(config) + "\n");
assertTrue(parsed.getBoolean("foo", "bar", false));
assertEquals("bar", parsed.getString("foo", null, "more"));
assertEquals("bar", parsed.getString("other", null, "more"));
}
+ private static String pathToString(File file) {
+ final String path = file.getPath();
+ if (SystemReader.getInstance().isWindows()) {
+ return path.replace('\\', '/');
+ }
+ return path;
+ }
+
private static void assertReadLong(long exp) throws ConfigInvalidException {
assertReadLong(exp, String.valueOf(exp));
}