diff options
author | Sven Gothel <[email protected]> | 2013-06-19 05:19:17 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-06-19 05:19:17 +0200 |
commit | 4d35974c6b87692bc1c3f6e6b7bb674a7a478053 (patch) | |
tree | f16c49bb7abfd563c834d1aae16763b3fb67266f | |
parent | b97666cf0a6d49c593d565d0eba8af92bcf5eb94 (diff) |
Fix URLCompositionTest for Bug 757 (2): If file, replace '/' in expected result w/ OS specific File.separatorChar
The JAR entry shall stay untouched, i.e. separator is platform independent '/'.
-rw-r--r-- | src/junit/com/jogamp/common/net/URLCompositionTest.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/junit/com/jogamp/common/net/URLCompositionTest.java b/src/junit/com/jogamp/common/net/URLCompositionTest.java index 4e92bc0..9380d79 100644 --- a/src/junit/com/jogamp/common/net/URLCompositionTest.java +++ b/src/junit/com/jogamp/common/net/URLCompositionTest.java @@ -120,7 +120,17 @@ public class URLCompositionTest extends JunitTracer { final URL url0 = IOUtil.toURL(uri0); final String actual = url0.toExternalForm(); System.err.println("url: "+actual); - final String expectedOS = usesFile ? expected.replace('/', File.separatorChar) : expected; + final String expectedOS; + if( usesFile ) { + final int jarSepI = expected.lastIndexOf("!"); + final int replB = 0 <= jarSepI ? jarSepI : expected.length(); + final String partA = expected.substring(0, replB).replace('/', File.separatorChar); + final String partB = expected.substring(replB); + expectedOS = partA+partB; + } else { + expectedOS = expected; + } + System.err.println("expected: "+expected+", "+expectedOS); Assert.assertEquals(expectedOS, actual); System.err.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } |