commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject cvs commit: jakarta-commons/io/src/test/org/apache/commons/io FilenameUtilsTestCase.java
Date Fri, 12 Mar 2004 21:59:19 GMT
jeremias    2004/03/12 13:59:19

  Modified:    io/src/test/org/apache/commons/io FilenameUtilsTestCase.java
  Log:
  Bugzilla #27612
  Fix for catPath not handling Windows-style path separators.
  Submitted by: Maarten Coene <Maarten.Coene.at.qmedit.com>
  
  Revision  Changes    Path
  1.7       +11 -3     jakarta-commons/io/src/test/org/apache/commons/io/FilenameUtilsTestCase.java
  
  Index: FilenameUtilsTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/io/src/test/org/apache/commons/io/FilenameUtilsTestCase.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FilenameUtilsTestCase.java	12 Mar 2004 21:44:47 -0000	1.6
  +++ FilenameUtilsTestCase.java	12 Mar 2004 21:59:19 -0000	1.7
  @@ -107,8 +107,16 @@
           // Is this acceptable?
           //assertEquals("", FilenameUtils.catPath("a", "b"));
   
  -        assertEquals("/a/c", FilenameUtils.catPath("/a/b", "c"));
  -        assertEquals("/a/d", FilenameUtils.catPath("/a/b/c", "../d"));
  +        assertEquals("/a" + File.separator + "c", FilenameUtils.catPath("/a/b", "c"));
  +        assertEquals("/a" + File.separator + "d", FilenameUtils.catPath("/a/b/c", "../d"));
  +        assertEquals("C:\\a" + File.separator + "c", FilenameUtils.catPath("C:\\a\\b",
"c"));
  +        assertEquals("C:\\a" + File.separator + "d", FilenameUtils.catPath("C:\\a\\b\\c",
"../d"));
  +    }
  +
  +    public void testIndexOfLastPathSeparator() {
  +        assertEquals(-1, FilenameUtils.indexOfLastPathSeparator("noseperator.inthispath"));
  +        assertEquals(3, FilenameUtils.indexOfLastPathSeparator("a/b/c"));
  +        assertEquals(3, FilenameUtils.indexOfLastPathSeparator("a\\b\\c"));
       }
   
       // resolveFile
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message