Skip to content

Commit

Permalink
New test for copy bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael5601 committed Jun 18, 2024
1 parent 7350ba7 commit d22f94c
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,31 @@ public void testCloseZipFile() throws Exception {
ensureExists(zipFile);
}

/*
* Test for a bug that breaks the opened zip file underneath the zip file that
* is closing. The zip file underneath converts to a linked file but the local
* file in the project is deleted so the linked file has no target.
*/
@Test
public void testCloseZipFileWithZipFileUnderneath() throws Exception {
IFolder firstOpenedZipFile = ZipFileSystemTestSetup.firstProject
.getFolder(ZipFileSystemTestSetup.ZIP_FILE_VIRTUAL_FOLDER_NAME);
ensureExists(firstOpenedZipFile);
String secondZipFileName = ZipFileSystemTestSetup.ZIP_FILE_VIRTUAL_FOLDER_NAME.replace(".", "New.");
ZipFileSystemTestSetup.copyZipFileIntoProject(ZipFileSystemTestSetup.firstProject, secondZipFileName);
IFile secondZipFile = ZipFileSystemTestSetup.firstProject.getFile(secondZipFileName);
ZipFileSystemTestUtil.openZipFile(secondZipFile);
IFolder secondOpenedZipFile = ZipFileSystemTestSetup.firstProject.getFolder(secondZipFileName);
ensureExists(secondOpenedZipFile);

ZipFileSystemTestUtil.closeZipFile(firstOpenedZipFile);
IFile zipFile = ZipFileSystemTestSetup.firstProject
.getFile(ZipFileSystemTestSetup.ZIP_FILE_VIRTUAL_FOLDER_NAME);
// Don't use Utility method ensureDoesNotExist because the fileStore is still
// available after closing. The fileStore is the File itself in the local file
// system that still exists after closing.
assertTrue("folder was not properly deleted: " + firstOpenedZipFile, !firstOpenedZipFile.exists());
ensureExists(zipFile);
ensureExists(secondOpenedZipFile);
}
}

0 comments on commit d22f94c

Please sign in to comment.