Last active
August 29, 2015 13:57
Revisions
-
drance revised this gist
Mar 18, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ test(semaphore); while(dispatch_semaphore_wait(semaphore, DISPATCH_TIME_NOW)) { [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:interval]]; } } -
drance revised this gist
Mar 18, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ NSAssert((test != NULL), @"Passed a NULL test block"); test(semaphore); while(dispatch_semaphore_wait(semaphore, DISPATCH_TIME_NOW)) { [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:1]]; } } -
drance revised this gist
Mar 18, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ - (void)sleepRunLoopForInterval:(NSTimeInterval)interval whileRunningAsynchronousTest:(void (^)(dispatch_semaphore_t semaphore))test { dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); NSAssert((test != NULL), @"Passed a NULL test block"); -
drance revised this gist
Mar 18, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ - (void)testAsynchronousStuff { [self sleepRunLoopForInterval:1.0 whileRunningAsynchronousTest:^(dispatch_semaphore_t semaphore) { [self thatAPIWeNeedToTestWithCompletion:^{ STAssertTrue(something, @"Noes"); dispatch_semaphore_signal(semaphore); }]; @@ -20,7 +20,7 @@ - (void)testMoreAsynchronousStuff { [self sleepRunLoopForInterval:0.2 whileRunningAsynchronousTest:^(dispatch_semaphore_t semaphore) { [self thatOtherAPIWeNeedToTestWithCompletion:^(id result){ STAssertNotNil(result, @"Noes"); dispatch_semaphore_signal(semaphore); }] -
drance created this gist
Mar 18, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ - (void)sleepRunLoopForInterval:(NSTimeInterval) interval whileRunningAsynchronousTest:(void (^)(dispatch_semaphore_t semaphore))test { dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); NSAssert((test != NULL), @"Passed a NULL test block"); test(semaphore); while (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_NOW)) { [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:1]]; } } - (void)testAsynchronousStuff { [self sleepRunLoopForInterval:1.0 whileRunningAsynchronousTest:^(dispatch_semaphore_t semaphore) { [self runThatThingWeNeedToTestWithCompletion:^{ STAssertTrue(something, @"Noes"); dispatch_semaphore_signal(semaphore); }]; }]; } - (void)testMoreAsynchronousStuff { [self sleepRunLoopForInterval:0.2 whileRunningAsynchronousTest:^(dispatch_semaphore_t semaphore) { [self runThatOtherThingWeNeedToTestWithCompletion:^(id result){ STAssertNotNil(result, @"Noes"); dispatch_semaphore_signal(semaphore); }] } }