Skip to content

Commit 71aff09

Browse files
committed
Updated test to perform a full roundtrip on the updated archive's data
1 parent ab3a0a8 commit 71aff09

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

Tests/WriteDataTests.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,8 @@ class WriteDataTests: UZKArchiveTestCase {
482482
// Update a file from the archive with overwrite=YES
483483
let externalVolumeZipURL = NSURL(fileURLWithPath: mountPoint).URLByAppendingPathComponent(tempZipFileURL.lastPathComponent!)
484484
let archive = try! UZKArchive(URL: externalVolumeZipURL)
485-
let newTextData = "This is the new text".dataUsingEncoding(NSUTF8StringEncoding)
485+
let newText = "This is the new text"
486+
let newTextData = newText.dataUsingEncoding(NSUTF8StringEncoding)
486487
var writeSuccessful = true
487488
do {
488489
try archive.writeData(newTextData!, filePath: textFileName, fileDate: nil,
@@ -494,6 +495,12 @@ class WriteDataTests: UZKArchiveTestCase {
494495
}
495496

496497
XCTAssertTrue(writeSuccessful, "Failed to update archive on external volume")
498+
499+
let archivedFileData = try! archive.extractDataFromFile(textFileName, progress: nil)
500+
XCTAssertNotNil(archivedFileData, "No data extracted from file in archive on external volume")
501+
502+
let archivedText = NSString(data: archivedFileData, encoding: NSUTF8StringEncoding)!
503+
XCTAssertEqual(archivedText, newText, "Incorrect text extracted from archive on external volume")
497504
}
498505

499506
func createAndMountDMG(path dmgURL: NSURL, source: NSURL) -> String? {

0 commit comments

Comments
 (0)