diff -r 445c96548b64 openide.filesystems/test/unit/src/org/openide/filesystems/FileObjectTestHid.java --- a/openide.filesystems/test/unit/src/org/openide/filesystems/FileObjectTestHid.java Thu Jan 13 15:26:57 2011 +0100 +++ b/openide.filesystems/test/unit/src/org/openide/filesystems/FileObjectTestHid.java Tue Jan 18 13:30:19 2011 +0100 @@ -713,6 +713,15 @@ fsAssert("findResource problem", result != null); fsAssert("findResource problem",fo1.equals(result)); } + + public void testGetPathWithDots() { + checkSetUp(); + FileObject fold1 = getTestFolder1(root); + FileObject fold2 = getTestFolder1(fold1); + + assertEquals("Is parent", fold1, fold2.getParent()); + assertEquals("No .. can be used", null, fold2.getFileObject("..")); + } public void testGetPath2() { checkSetUp(); @@ -776,6 +785,30 @@ fsAssert("findResource problem",fo1.equals(result)); } + public void testGetPathNoParent() throws IOException{ + checkSetUp(); + FileObject fold1 = getTestFolder1(root); + FileObject fold2 = getTestFolder1(fold1); + + FileObject fo1 = null; + FileObject fo2 = null; + try { + fo1 = FileUtil.createData(fold2, "a/b/c.java"); + fo2 = FileUtil.createData(fold2, "a/x/y.java"); + } catch (IOException iex) { + fsAssert("There is not possible to create folder a.b.c", + fs.isReadOnly() || fold2.isReadOnly()); + return; + } + + FileObject r1 = fo1.getParent().getParent().getFileObject("x/y.java"); + FileObject r2 = fo1.getParent().getFileObject("../x/y.java"); + FileObject r3 = fo1.getFileObject("../../x/y.java"); + assertEquals("y.java found without ..", fo2, r1); + assertNull("y.java not found with ..", r2); + assertNull("y.java not found with ../..", r3); + } + public void testGetPath5() throws IOException{ checkSetUp(); FileObject fold1 = getTestFolder1(root);