Skip to content

Commit

Permalink
Merge pull request #132 from spotify/ext
Browse files Browse the repository at this point in the history
test resources: add file extensions
  • Loading branch information
dflems authored Aug 9, 2022
2 parents 130c231 + aa56de2 commit 94c3244
Show file tree
Hide file tree
Showing 20 changed files with 74 additions and 73 deletions.
136 changes: 68 additions & 68 deletions SPTPersistentCache.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Tests/SPTPersistentCachePerformanceTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ - (void)setUp

NSBundle *bundle = [NSBundle bundleForClass:[self class]];
for (NSString *fileName in fileNames) {
NSString *filePath = [bundle pathForResource:fileName ofType:nil];
NSString *filePath = [bundle pathForResource:fileName ofType:@"dat"];
NSData *fileData = [NSData dataWithContentsOfFile:filePath];
if (!fileData) {
fileData = [NSData data];
Expand Down
9 changes: 5 additions & 4 deletions Tests/SPTPersistentCacheTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ - (void)setUp

for (NSUInteger i = 0; i < count; ++i) {
XCTAssert(kParams[i].last != YES, @"Last param element reached");
NSString *fileName = [self.thisBundle pathForResource:self.imageNames[i] ofType:nil];
NSString *fileName = [self.thisBundle pathForResource:self.imageNames[i] ofType:@"dat"];
__weak XCTestExpectation *expectation = [self expectationWithDescription:fileName];
[self putFile:fileName inCache:self.cache withKey:self.imageNames[i] ttl:kParams[i].ttl locked:kParams[i].locked expectation:expectation];
NSData *data = [NSData dataWithContentsOfFile:fileName];
Expand Down Expand Up @@ -824,7 +824,7 @@ - (void)testLockedSize

if (kParams[i].locked) {

NSString *fileName = [self.thisBundle pathForResource:self.imageNames[i] ofType:nil];
NSString *fileName = [self.thisBundle pathForResource:self.imageNames[i] ofType:@"dat"];
NSData *data = [NSData dataWithContentsOfFile:fileName];
XCTAssertNotNil(data, @"Data must be valid");
expectedSize += ([data length] + (NSUInteger)SPTPersistentCacheRecordHeaderSize);
Expand Down Expand Up @@ -1218,7 +1218,7 @@ - (void)testSerialStoreWithLockDoesntIncrementRefCount
// Index of file to put. It should be file without any problems.
const NSUInteger putIndex = 2;
NSString *key = self.imageNames[putIndex];
NSString *fileName = [self.thisBundle pathForResource:key ofType:nil];
NSString *fileName = [self.thisBundle pathForResource:key ofType:@"dat"];
NSString *path = [fileManager pathForKey:key];

// Check that image is valid just in case
Expand Down Expand Up @@ -1397,6 +1397,7 @@ - (void)testCurrentDataTimeInterval
SPTPersistentCache *cache = [self createCacheWithTimeCallback:nil expirationTime:0];

NSTimeInterval firstTimeInterval = [cache currentDateTimeInterval];
[NSThread sleepForTimeInterval:0.1]; // sleep a beat
NSTimeInterval secondTimeInterval = [cache currentDateTimeInterval];

XCTAssertGreaterThan(secondTimeInterval, firstTimeInterval);
Expand Down Expand Up @@ -2008,7 +2009,7 @@ - (void)checkUpdateTimeForFileAtPath:(NSString *)path validate:(BOOL)validate re

- (NSUInteger)dataSizeForItem:(NSString *)item
{
NSString *fileName = [self.thisBundle pathForResource:item ofType:nil];
NSString *fileName = [self.thisBundle pathForResource:item ofType:@"dat"];
NSData *data = [NSData dataWithContentsOfFile:fileName];
XCTAssertNotNil(data, @"Data must be valid");
return [data length];
Expand Down

0 comments on commit 94c3244

Please sign in to comment.