diff --git a/SSZipArchive.xcodeproj/project.pbxproj b/SSZipArchive.xcodeproj/project.pbxproj index 5378ea2..324a44a 100644 --- a/SSZipArchive.xcodeproj/project.pbxproj +++ b/SSZipArchive.xcodeproj/project.pbxproj @@ -45,6 +45,7 @@ 3D18E4CA1B236A7500627171 /* 5.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 3D18E4C21B236A7500627171 /* 5.m4a */; }; 3D18E4CB1B236A7500627171 /* 6.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 3D18E4C31B236A7500627171 /* 6.m4a */; }; 3D18E4CC1B236A7500627171 /* 7.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 3D18E4C41B236A7500627171 /* 7.m4a */; }; + 3D18E4CE1B236C2A00627171 /* hello.zip in Resources */ = {isa = PBXBuildFile; fileRef = 3D18E4CD1B236C2A00627171 /* hello.zip */; }; A5CD0D3A1AD3490700E7F209 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A5CD0D391AD3490700E7F209 /* Default-568h@2x.png */; }; /* End PBXBuildFile section */ @@ -101,6 +102,7 @@ 3D18E4C21B236A7500627171 /* 5.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; name = 5.m4a; path = Tests/Multi_Zip_Test/5.m4a; sourceTree = SOURCE_ROOT; }; 3D18E4C31B236A7500627171 /* 6.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; name = 6.m4a; path = Tests/Multi_Zip_Test/6.m4a; sourceTree = SOURCE_ROOT; }; 3D18E4C41B236A7500627171 /* 7.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; name = 7.m4a; path = Tests/Multi_Zip_Test/7.m4a; sourceTree = SOURCE_ROOT; }; + 3D18E4CD1B236C2A00627171 /* hello.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = hello.zip; sourceTree = ""; }; A5CD0D391AD3490700E7F209 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -204,6 +206,7 @@ 21CC41EF17DB7D3500201DDC /* Fixtures */ = { isa = PBXGroup; children = ( + 3D18E4CD1B236C2A00627171 /* hello.zip */, 011F4B95182D71B700DE704F /* RelativeSymbolicLink.zip */, 21CC41F017DB7D3500201DDC /* IncorrectHeaders.zip */, 21CC41F117DB7D3500201DDC /* PermissionsTestApp.app */, @@ -335,6 +338,7 @@ 3D18E4C61B236A7500627171 /* 1.m4a in Resources */, 3D18E4CA1B236A7500627171 /* 5.m4a in Resources */, 011F4B96182D71B700DE704F /* RelativeSymbolicLink.zip in Resources */, + 3D18E4CE1B236C2A00627171 /* hello.zip in Resources */, A5CD0D3A1AD3490700E7F209 /* Default-568h@2x.png in Resources */, 3D18E4C81B236A7500627171 /* 3.m4a in Resources */, 3D18E4C71B236A7500627171 /* 2.m4a in Resources */, diff --git a/Tests/Fixtures/hello.zip b/Tests/Fixtures/hello.zip new file mode 100644 index 0000000..91b07fd Binary files /dev/null and b/Tests/Fixtures/hello.zip differ diff --git a/Tests/SSZipArchiveTests.m b/Tests/SSZipArchiveTests.m index cda32d0..620d9ee 100644 --- a/Tests/SSZipArchiveTests.m +++ b/Tests/SSZipArchiveTests.m @@ -73,20 +73,7 @@ // TODO: Make sure the files are actually unzipped. They are, but the test should be better. XCTAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:archivePath], @"Archive created"); } -- (void)testSmallZipping { - // use extracted files from [-testUnzipping] - NSString *inputPath = [self _cachesPath:@"Regular"]; - NSArray *inputPaths = @[[inputPath stringByAppendingPathComponent:@"Readme.markdown"], - [inputPath stringByAppendingPathComponent:@"LICENSE"]]; - - NSString *outputPath = [self _cachesPath:@"Zipped"]; - - NSString *archivePath = [outputPath stringByAppendingPathComponent:@"CreatedArchive.zip"]; - [SSZipArchive createZipFileAtPath:archivePath withFilesAtPaths:inputPaths]; - - // TODO: Make sure the files are actually unzipped. They are, but the test should be better. - XCTAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:archivePath], @"Archive created"); -} + - (void)testDirectoryZipping { // use Unicode as folder (has a file in root and a file in subfolder) @@ -142,7 +129,19 @@ testPath = [outputPath stringByAppendingPathComponent:@"LICENSE"]; XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"LICENSE unzipped"); } - +- (void)testSmallFileUnzipping { + NSString *zipPath = [[NSBundle mainBundle] pathForResource:@"hello" ofType:@"zip"]; + NSString *outputPath = [self _cachesPath:@"Regular"]; + + [SSZipArchive unzipFileAtPath:zipPath toDestination:outputPath delegate:self]; + + NSFileManager *fileManager = [NSFileManager defaultManager]; + NSString *testPath = [outputPath stringByAppendingPathComponent:@"Readme.markdown"]; + XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"Readme unzipped"); + + testPath = [outputPath stringByAppendingPathComponent:@"LICENSE"]; + XCTAssertTrue([fileManager fileExistsAtPath:testPath], @"LICENSE unzipped"); +} - (void)testUnzippingProgress { NSString *zipPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestArchive" ofType:@"zip"]; NSString *outputPath = [self _cachesPath:@"Progress"];