Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adds a specific test for multiple cancellation/completion handlers.

  • Loading branch information...
commit 090a129d0fac3c28f8e73671d44130478557c8d4 1 parent f4cbbb4
@robrix authored
Showing with 34 additions and 0 deletions.
  1. +34 −0 RXFuturesTests/RXFutureTests.m
View
34 RXFuturesTests/RXFutureTests.m
@@ -115,6 +115,23 @@ -(void)testDoesNotCallCancellationHandlersOnCompletion {
RXAssertEquals(result, 0);
}
+-(void)testCallsMultipleCancellationHandlersOnCancellation {
+ RXSynchronously(^(RXSynchronousCompletionBlock doneA) {
+ RXSynchronously(^(RXSynchronousCompletionBlock doneB) {
+ [future onCancel:^{
+ self.result += 2;
+ doneA();
+ }];
+ [future onCancel:^{
+ self.result += 2;
+ doneB();
+ }];
+ [future cancel];
+ });
+ });
+ RXAssertEquals(result, 4);
+}
+
-(void)testCallsCompletionHandlersOnCompletion {
RXSynchronously(^(RXSynchronousCompletionBlock done) {
@@ -147,4 +164,21 @@ -(void)testDoesNotCallCompletionHandlersOnCancellation {
RXAssertEquals(result, 0);
}
+-(void)testCallsMultipleCompletionHandlersOnCompletion {
+ RXSynchronously(^(RXSynchronousCompletionBlock doneA) {
+ RXSynchronously(^(RXSynchronousCompletionBlock doneB) {
+ [future onComplete:^{
+ self.result += 4;
+ doneA();
+ }];
+ [future onComplete:^{
+ self.result += 4;
+ doneB();
+ }];
+ [future complete];
+ });
+ });
+ RXAssertEquals(result, 8);
+}
+
@end
Please sign in to comment.
Something went wrong with that request. Please try again.