QuietUnrar/Carthage/Checkouts/UnzipKit/Tests/PropertyTests.m

54 lines
1.7 KiB
Objective-C

//
// PropertyTests.m
// UnzipKit
//
// Created by Dov Frankel on 7/16/15.
// Copyright (c) 2015 Abbey Code. All rights reserved.
//
#import "UZKArchiveTestCase.h"
#import "UnzipKit.h"
@interface PropertyTests : UZKArchiveTestCase
@end
@implementation PropertyTests
- (void)testFileURL {
NSArray *testArchives = @[@"Test Archive.zip",
@"Test Archive (Password).zip"];
for (NSString *testArchiveName in testArchives) {
NSURL *testArchiveURL = self.testFileURLs[testArchiveName];
UZKArchive *archive = [[UZKArchive alloc] initWithURL:testArchiveURL error:nil];
NSURL *resolvedURL = archive.fileURL.URLByResolvingSymlinksInPath;
XCTAssertNotNil(resolvedURL, @"Nil URL returned for valid archive");
XCTAssertTrue([testArchiveURL isEqual:resolvedURL], @"Resolved URL doesn't match original");
}
}
- (void)testFilename {
NSArray *testArchives = @[@"Test Archive.zip",
@"Test Archive (Password).zip"];
for (NSString *testArchiveName in testArchives) {
NSURL *testArchiveURL = self.testFileURLs[testArchiveName];
UZKArchive *archive = [[UZKArchive alloc] initWithURL:testArchiveURL error:nil];
NSString *resolvedFilename = archive.filename;
XCTAssertNotNil(resolvedFilename, @"Nil filename returned for valid archive");
// Testing by suffix, since the original points to /private/var, but the resolved one
// points straight to /var. They're equivalent, but not character-for-character equal
XCTAssertTrue([resolvedFilename hasSuffix:testArchiveURL.path],
@"Resolved filename doesn't match original");
}
}
@end