| @@ -638,6 +638,22 @@ public class FileUtilsTest { | |||||
| assertFalse(FILE_UTILS.isLeadingPath(new File("/foo"), new File("/bar"), true)); | assertFalse(FILE_UTILS.isLeadingPath(new File("/foo"), new File("/bar"), true)); | ||||
| } | } | ||||
| @Test | |||||
| public void isLeadingPathAndTrailingSlashesOnUnix() throws IOException { | |||||
| assumeFalse("Test doesn't run on DOS", Os.isFamily("dos")); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("/foo/"), new File("/foo/bar"), true)); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("/foo/"), new File("/foo/bar/"), true)); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("/foo/"), new File("/foo/"), true)); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("/foo/"), new File("/foo"), true)); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("/foo"), new File("/foo/"), true)); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("/foo/"), new File("/foo/bar"), false)); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("/foo/"), new File("/foo/bar/"), false)); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("/foo/"), new File("/foo/"), false)); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("/foo/"), new File("/foo"), false)); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("/foo"), new File("/foo/"), false)); | |||||
| } | |||||
| @Test | @Test | ||||
| public void isLeadingPathCanonicalVersionWorksAsExpectedOnDos() throws IOException { | public void isLeadingPathCanonicalVersionWorksAsExpectedOnDos() throws IOException { | ||||
| assumeTrue("Test only runs on DOS", Os.isFamily("dos")); | assumeTrue("Test only runs on DOS", Os.isFamily("dos")); | ||||
| @@ -648,6 +664,22 @@ public class FileUtilsTest { | |||||
| assertFalse(FILE_UTILS.isLeadingPath(new File("C:\\foo"), new File("C:\\bar"), true)); | assertFalse(FILE_UTILS.isLeadingPath(new File("C:\\foo"), new File("C:\\bar"), true)); | ||||
| } | } | ||||
| @Test | |||||
| public void isLeadingPathAndTrailingSlashesOnDos() throws IOException { | |||||
| assumeTrue("Test only runs on DOS", Os.isFamily("dos")); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("c:\\foo\\"), new File("c:\\foo\\bar"), true)); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("c:\\foo\\"), new File("c:\\foo\\bar\\"), true)); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("c:\\foo\\"), new File("c:\\foo\\"), true)); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("c:\\foo\\"), new File("c:\\foo"), true)); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("c:\\foo"), new File("c:\\foo\\"), true)); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("c:\\foo\\"), new File("c:\\foo\\bar"), false)); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("c:\\foo\\"), new File("c:\\foo\\bar\\"), false)); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("c:\\foo\\"), new File("c:\\foo\\"), false)); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("c:\\foo\\"), new File("c:\\foo"), false)); | |||||
| assertTrue(FILE_UTILS.isLeadingPath(new File("c:\\foo"), new File("c:\\foo\\"), false)); | |||||
| } | |||||
| /** | /** | ||||
| * adapt file separators to local conventions | * adapt file separators to local conventions | ||||
| */ | */ | ||||