Author: ltheussl Date: Tue Mar 15 06:57:27 2011 New Revision: 1081675 URL: http://svn.apache.org/viewvc?rev=1081675&view=rev Log: more tests with more leading slashes
Modified: maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptorTest.java Modified: maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptorTest.java URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptorTest.java?rev=1081675&r1=1081674&r2=1081675&view=diff ============================================================================== --- maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptorTest.java (original) +++ maven/doxia/doxia-sitetools/trunk/doxia-decoration-model/src/test/java/org/apache/maven/doxia/site/decoration/inheritance/URIPathDescriptorTest.java Tue Mar 15 06:57:27 2011 @@ -66,6 +66,9 @@ public class URIPathDescriptorTest compare = new URIPathDescriptor( "file:///C:/Documents%20and%20Settings/foo/", "bar" ); assertEquals( "file:/C:/Documents%20and%20Settings/foo/bar", compare.toString() ); + compare = new URIPathDescriptor( "file:////Users/", "user" ); + assertEquals( "file:/Users/user", compare.toString() ); + compare = new URIPathDescriptor( "file:/C:/Documents%20and%20Settings/foo/", "bar" ); assertEquals( "file:/C:/Documents%20and%20Settings/foo/bar", compare.toString() ); @@ -111,6 +114,9 @@ public class URIPathDescriptorTest oldPath = new URIPathDescriptor( maven, "source/index.html?var=foo&var2=bar" ); assertEquals( expected + "/index.html?var=foo&var2=bar", oldPath.resolveLink().toString() ); + oldPath = new URIPathDescriptor( "file:////Users/", "user" ); + assertEquals( "file:/Users/user", oldPath.resolveLink().toString() ); + oldPath = new URIPathDescriptor( "file:///C:/Documents%20and%20Settings/", "source" ); // resolve() removes two slashes because authority is empty assertEquals( "file:/C:/Documents%20and%20Settings/source", oldPath.resolveLink().toString() ); @@ -156,6 +162,10 @@ public class URIPathDescriptorTest oldPath = new URIPathDescriptor( "http://jakarta.apache.org/", "banner/left" ); assertEquals( "http://jakarta.apache.org/banner/left", oldPath.rebaseLink( maven ).toString() ); + oldPath = new URIPathDescriptor( "file:////Users/", "user" ); + assertEquals( "../user", oldPath.rebaseLink( "file:////Users/target" ).toString() ); + assertEquals( "../user", oldPath.rebaseLink( "file:/Users/target" ).toString() ); + oldPath = new URIPathDescriptor( "file:///C:/Documents%20and%20Settings/", "source" ); assertEquals( "../source", oldPath.rebaseLink( "file:///C:/Documents%20and%20Settings/target" ).toString() ); @@ -192,6 +202,9 @@ public class URIPathDescriptorTest path = new URIPathDescriptor( maven, "http://maven.apache.org/index.html?var=foo&var2=bar" ); assertEquals( "index.html?var=foo&var2=bar", path.relativizeLink().toString() ); + path = new URIPathDescriptor( "file:////Users/", "index.html" ); + assertEquals( "index.html", path.relativizeLink().toString() ); + path = new URIPathDescriptor( "file:///C:/Documents%20and%20Settings/", "index.html" ); assertEquals( "index.html", path.relativizeLink().toString() );