This PR contains all the work related to setting up this project as required to implement the [Assignment](https://repo.rock-n-code.com/rock-n-code/deep-linking-assignment/wiki/Assignment) on top, as intended. To summarise this work: - [x] created a new **Xcode** project; - [x] cloned the `Wikipedia` app and inserted it into the **Xcode** project; - [x] created the `Locations` app and also, its `Libraries` package; - [x] created the `Shared` package to share dependencies between the apps; - [x] added a `Makefile` file and implemented some **environment** and **help** commands. Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Reviewed-on: rock-n-code/deep-linking-assignment#1
33 lines
1.6 KiB
Objective-C
33 lines
1.6 KiB
Objective-C
#import "XCTestCase+WMFLocaleTesting.h"
|
|
#import "WMFAsyncTestCase.h"
|
|
|
|
@implementation XCTestCase (WMFLocaleTesting)
|
|
|
|
- (void)wmf_runParallelTestsWithLocales:(NSArray *)localeIdentifiers block:(WMFLocaleTest)block {
|
|
[self wmf_runParallelTestsWithLocales:localeIdentifiers
|
|
timeout:localeIdentifiers.count * WMFDefaultExpectationTimeout
|
|
block:block];
|
|
}
|
|
|
|
- (void)wmf_runParallelTestsWithLocales:(NSArray *)localeIdentifiers
|
|
timeout:(NSTimeInterval)timeout
|
|
block:(WMFLocaleTest)block {
|
|
NSDictionary *expectationsForLocale =
|
|
[localeIdentifiers wmf_reduce:[NSMutableDictionary dictionaryWithCapacity:localeIdentifiers.count]
|
|
withBlock:^id(NSMutableDictionary *sum, NSString *localeID) {
|
|
sum[localeID] = [self expectationWithDescription:localeID];
|
|
return sum;
|
|
}];
|
|
dispatch_queue_t concurrentBackgroundQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
|
|
dispatch_apply(localeIdentifiers.count, concurrentBackgroundQueue, ^(size_t i) {
|
|
NSString *localeID = localeIdentifiers[i];
|
|
NSLocale *locale = [NSLocale localeWithLocaleIdentifier:localeID];
|
|
block(locale, expectationsForLocale[localeID]);
|
|
});
|
|
// allow 1 sec per locale
|
|
NSLog(@"Waiting %f seconds to run a test with %lu locales...", timeout, (unsigned long)localeIdentifiers.count);
|
|
[self waitForExpectationsWithTimeout:localeIdentifiers.count handler:nil];
|
|
}
|
|
|
|
@end
|