summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2015-02-02 21:21:09 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2015-02-02 21:23:31 +0100
commitd2e0bfa56844642435c9ba81d488aa0da9b22b36 (patch)
tree6209e877cb53f18d42f9a5f47d4fe3c794a442d3
parent7f139b8eeebda7bf31ab895f6d8965f5c0161caa (diff)
downloadjgit-d2e0bfa56844642435c9ba81d488aa0da9b22b36.tar.gz
jgit-d2e0bfa56844642435c9ba81d488aa0da9b22b36.zip
Fix FileUtils.testRelativize_mixedCase which failed on Mac OS X
HFS is case insensitive hence expecting it to return the result for case sensitive filesystem doesn't work. Change-Id: I292eab78e50711529a0412f9a54e174a3ac16109 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtilTest.java27
1 files changed, 8 insertions, 19 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtilTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtilTest.java
index d4be25c0cd..0d7d31b3ad 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtilTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/FileUtilTest.java
@@ -450,31 +450,20 @@ public class FileUtilTest {
@Test
public void testRelativize_mixedCase() {
SystemReader systemReader = SystemReader.getInstance();
- String oldOSName = null;
String base = toOSPathString("C:\\git\\jgit");
String other = toOSPathString("C:\\Git\\test\\d\\f.txt");
- String expectedWindows = toOSPathString("..\\test\\d\\f.txt");
- String expectedUnix = toOSPathString("..\\..\\Git\\test\\d\\f.txt");
+ String expectedCaseInsensitive = toOSPathString("..\\test\\d\\f.txt");
+ String expectedCaseSensitive = toOSPathString("..\\..\\Git\\test\\d\\f.txt");
- if (!systemReader.isWindows()) {
+ if (systemReader.isWindows()) {
String actual = FileUtils.relativize(base, other);
- assertEquals(expectedUnix, actual);
-
- // FS_POSIX#isCaseSensitive will return "false" for mac OS X.
- // Use this to test both behaviors.
- oldOSName = System.getProperty("os.name");
- try {
- System.setProperty("os.name", "Mac OS X");
-
- actual = FileUtils.relativize(base, other);
- assertEquals(expectedWindows, actual);
- } finally {
- if (oldOSName != null)
- System.setProperty("os.name", oldOSName);
- }
+ assertEquals(expectedCaseInsensitive, actual);
+ } else if (systemReader.isMacOS()) {
+ String actual = FileUtils.relativize(base, other);
+ assertEquals(expectedCaseInsensitive, actual);
} else {
String actual = FileUtils.relativize(base, other);
- assertEquals(expectedWindows, actual);
+ assertEquals(expectedCaseSensitive, actual);
}
}