Permalink
Browse files

Readded and fixed DTZipArchive Unit tests

  • Loading branch information...
1 parent 4be845d commit 9654078fdd527126edd484b4e25528f872a7cf20 @gugmaster gugmaster committed Mar 4, 2013
Showing with 15 additions and 13 deletions.
  1. +2 −0 DTFoundation.xcodeproj/project.pbxproj
  2. +13 −13 Test/Source/DTZipArchiveTest.m
@@ -267,6 +267,7 @@
C0494DA5BB16F9A0E8533152 /* DTZipArchivePKZip.m in Sources */ = {isa = PBXBuildFile; fileRef = C0494776E02407791E96C641 /* DTZipArchivePKZip.m */; };
C0494E3EAE5FD2F61970FE00 /* Rene in Resources */ = {isa = PBXBuildFile; fileRef = C0494D374C86170585303054 /* Rene */; };
E2262E82163846AB00BFDAD7 /* DTFoundation.h in Headers */ = {isa = PBXBuildFile; fileRef = A70B4CC51486621B00873A4A /* DTFoundation.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ FA08F96016E4EEAF00BDF822 /* DTZipArchiveTest.m in Sources */ = {isa = PBXBuildFile; fileRef = C0494E27A3F90498A211E228 /* DTZipArchiveTest.m */; };
FA2A29291609F7330023CDD7 /* DTVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = A70B4CC81486621B00873A4A /* DTVersion.m */; };
FA8D11DF16C4FC5B006CBAB4 /* UIView+DTDebug.h in Headers */ = {isa = PBXBuildFile; fileRef = FA8D11DD16C4FC5B006CBAB4 /* UIView+DTDebug.h */; };
FA8D11E016C4FC5B006CBAB4 /* UIView+DTDebug.h in Headers */ = {isa = PBXBuildFile; fileRef = FA8D11DD16C4FC5B006CBAB4 /* UIView+DTDebug.h */; };
@@ -1540,6 +1541,7 @@
FAB172AF163027C700B44EDC /* NSDictionaryDTErrorTest.m in Sources */,
A70D56A6162FDECF00120A98 /* DTScriptingTest.m in Sources */,
A77D5C0216E4B1D300A45C28 /* DTBase64CodingTest.m in Sources */,
+ FA08F96016E4EEAF00BDF822 /* DTZipArchiveTest.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -20,7 +20,7 @@ - (void)testPKZip
NSBundle *testBundle = [NSBundle bundleForClass:[self class]];
NSString *sampleZipPath = [testBundle pathForResource:@"sample" ofType:@"zip"];
- DTZipArchive *zipArchive = [[DTZipArchive alloc] initWithFileAtPath:sampleZipPath];
+ DTZipArchive *zipArchive = [DTZipArchive archiveAtPath:sampleZipPath];
__block NSUInteger iteration = 0;
@@ -31,12 +31,12 @@ - (void)testPKZip
{
case 0:
{
- STAssertTrue([fileName isEqualToString:@"zipFiles/"], @"node uncompressed is not as expected");
+ STAssertTrue([fileName isEqualToString:@"zipFiles"], @"node uncompressed is not as expected");
break;
}
case 1:
{
- STAssertTrue([fileName isEqualToString:@"zipFiles/plist/"], @"node uncompressed is not as expected");
+ STAssertTrue([fileName isEqualToString:@"zipFiles/plist"], @"node uncompressed is not as expected");
break;
}
case 2:
@@ -54,12 +54,12 @@ - (void)testPKZip
}
case 6:
{
- STAssertTrue([fileName isEqualToString:@"zipFiles/text/"], @"node uncompressed is not as expected");
+ STAssertTrue([fileName isEqualToString:@"zipFiles/text"], @"node uncompressed is not as expected");
break;
}
case 7:
{
- STAssertTrue([fileName isEqualToString:@"zipFiles/text/Andere/"], @"node uncompressed is not as expected");
+ STAssertTrue([fileName isEqualToString:@"zipFiles/text/Andere"], @"node uncompressed is not as expected");
break;
}
case 8:
@@ -96,7 +96,7 @@ - (void)testPKZip
}
case 12:
{
- STAssertTrue([fileName isEqualToString:@"zipFiles/text/test/"], @"node uncompressed is not as expected");
+ STAssertTrue([fileName isEqualToString:@"zipFiles/text/test"], @"node uncompressed is not as expected");
break;
}
case 13:
@@ -128,7 +128,7 @@ - (void)testPKZipStop
NSBundle *testBundle = [NSBundle bundleForClass:[self class]];
NSString *sampleZipPath = [testBundle pathForResource:@"sample" ofType:@"zip"];
- DTZipArchive *zipArchive = [[DTZipArchive alloc] initWithFileAtPath:sampleZipPath];
+ DTZipArchive *zipArchive = [DTZipArchive archiveAtPath:sampleZipPath];
__block NSUInteger iteration = 0;
@@ -138,7 +138,7 @@ - (void)testPKZipStop
{
case 0:
{
- STAssertTrue([fileName isEqualToString:@"zipFiles/"], @"node uncompressed is not as expected");
+ STAssertTrue([fileName isEqualToString:@"zipFiles"], @"node uncompressed is not as expected");
// explicit stop -> no other iterations have to follow!
NSLog(@"Now stopping uncompressing with DTZipArchive");
@@ -163,7 +163,7 @@ - (void)testUnncompressingPKZipArchiveToTargetPath
NSBundle *testBundle = [NSBundle bundleForClass:[self class]];
NSString *sampleZipPath = [testBundle pathForResource:@"sample" ofType:@"zip"];
- DTZipArchive *zipArchive = [[DTZipArchive alloc] initWithFileAtPath:sampleZipPath];
+ DTZipArchive *zipArchive = [DTZipArchive archiveAtPath:sampleZipPath];
[zipArchive uncompressToPath:[testBundle bundlePath] completion:^(NSError *error) {
@@ -259,7 +259,7 @@ - (void)testUncompressingPKZipWithInvalidTargetPath
NSBundle *testBundle = [NSBundle bundleForClass:[self class]];
NSString *sampleZipPath = [testBundle pathForResource:@"sample" ofType:@"zip"];
- DTZipArchive *zipArchive = [[DTZipArchive alloc] initWithFileAtPath:sampleZipPath];
+ DTZipArchive *zipArchive = [DTZipArchive archiveAtPath:sampleZipPath];
@@ -280,7 +280,7 @@ - (void)testGZip
NSBundle *testBundle = [NSBundle bundleForClass:[self class]];
NSString *sampleZipPath = [testBundle pathForResource:@"gzip_sample.txt" ofType:@"gz"];
- DTZipArchive *zipArchive = [[DTZipArchive alloc] initWithFileAtPath:sampleZipPath];
+ DTZipArchive *zipArchive = [DTZipArchive archiveAtPath:sampleZipPath];
[zipArchive enumerateUncompressedFilesAsDataUsingBlock:^(NSString *fileName, NSData *data, BOOL *stop) {
@@ -299,7 +299,7 @@ - (void)testUncompressingGZipToTargetPath
NSBundle *testBundle = [NSBundle bundleForClass:[self class]];
NSString *sampleZipPath = [testBundle pathForResource:@"gzip_sample.txt" ofType:@"gz"];
- DTZipArchive *zipArchive = [[DTZipArchive alloc] initWithFileAtPath:sampleZipPath];
+ DTZipArchive *zipArchive = [DTZipArchive archiveAtPath:sampleZipPath];
[zipArchive uncompressToPath:[testBundle bundlePath] completion:^(NSError *error) {
@@ -326,7 +326,7 @@ - (void)testUncompressingGzipWithInvalidTargetPath
NSBundle *testBundle = [NSBundle bundleForClass:[self class]];
NSString *sampleZipPath = [testBundle pathForResource:@"gzip_sample.txt" ofType:@"gz"];
- DTZipArchive *zipArchive = [[DTZipArchive alloc] initWithFileAtPath:sampleZipPath];
+ DTZipArchive *zipArchive = [DTZipArchive archiveAtPath:sampleZipPath];
[zipArchive uncompressToPath:@"ILLEGAL PATH!!!" completion:^(NSError *error) {

0 comments on commit 9654078

Please sign in to comment.