>From the same commit.==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/PathUtilTest.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-common/src/test/java/org/apache/maven/archiva/common/utils/PathUtilTest.java Sat Aug 25 20:16:11 2007
@@ -34,9 +34,15 @@
public class PathUtilTest
extends TestCase
{
- public void testToRelative()
+ public void testToRelativeWithoutSlash()
{
assertEquals( "path/to/resource.xml", PathUtil.getRelative( "/home/user/foo/repository",
+ "/home/user/foo/repository/path/to/resource.xml" ) );
+ }
+
+ public void testToRelativeWithSlash()
+ {
+ assertEquals( "path/to/resource.xml", PathUtil.getRelative( "/home/user/foo/repository/",
"/home/user/foo/repository/path/to/resource.xml" ) );
}I thought those test names would have been sufficient. ;-) When you pass in (as argument 1) a path that has a slash at the end, with the old code, the relative path would be wrong. Example of original bug. PathUtil.getRelative("/home/user/foo/repository/", "/home/user/foo/repository/path/to/resource.xml") would have returned "ath/to/resource.xml" /* notice the missing "p" in "path"? */ - Joakim Brett Porter wrote: And/or a comment in the test case would be a good way to identify it. I need to learn to write those more. |
- Re: svn commit: r569758 - in /maven/archiva/trunk/archiva-b... Wendy Smoak
- Re: svn commit: r569758 - in /maven/archiva/trunk/arch... Brett Porter
- Re: svn commit: r569758 - in /maven/archiva/trunk/... Joakim Erdfelt
