Browse Source

Minor reformatting

Mattt Thompson 12 năm trước cách đây
mục cha
commit
789fa3ddba

+ 4 - 4
AFNetworking/AFHTTPRequestOperation.m

@@ -79,10 +79,10 @@ static dispatch_group_t http_request_operation_completion_group() {
 #pragma clang diagnostic ignored "-Warc-retain-cycles"
 #pragma clang diagnostic ignored "-Wgnu"
     self.completionBlock = ^{
-        if (self.completionGroup)
-        {
+        if (self.completionGroup) {
             dispatch_group_enter(self.completionGroup);
         }
+
         dispatch_async(http_request_operation_processing_queue(), ^{
             if (self.error) {
                 if (failure) {
@@ -110,8 +110,8 @@ static dispatch_group_t http_request_operation_completion_group() {
                     }
                 }
             }
-            if (self.completionGroup)
-            {
+
+            if (self.completionGroup) {
                 dispatch_group_leave(self.completionGroup);
             }
         });

+ 9 - 10
Tests/Tests/AFHTTPRequestOperationTests.m

@@ -279,6 +279,7 @@
 {
     __block BOOL firstBlock = NO;
     __block BOOL secondBlock = NO;
+
     NSURLRequest *request1 = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/get" relativeToURL:self.baseURL]];
     AFHTTPRequestOperation *operation1 = [[AFHTTPRequestOperation alloc] initWithRequest:request1];
     [operation1 setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
@@ -294,17 +295,15 @@
     [operation2 setResponseSerializer:[AFHTTPResponseSerializer serializer]];
     
     __block BOOL completionBlockFiredAfterOtherBlocks = NO;
-    NSArray * batchRequests = [AFURLConnectionOperation batchOfRequestOperations:@[operation1,operation2]
-                                                                   progressBlock:nil
-                                                                 completionBlock:^(NSArray *operations) {
-                                                                   if (firstBlock && secondBlock)
-                                                                   {
-                                                                       completionBlockFiredAfterOtherBlocks = YES;
-                                                                   }
-                                                                 }];
-    NSOperationQueue * queue = [NSOperationQueue new];
+    NSArray *batchRequests = [AFURLConnectionOperation batchOfRequestOperations:@[operation1, operation2] progressBlock:nil completionBlock:^(NSArray *operations) {
+        if (firstBlock && secondBlock) {
+            completionBlockFiredAfterOtherBlocks = YES;
+        }
+    }];
+
+    NSOperationQueue *queue = [[NSOperationQueue alloc] init];
     [queue addOperations:batchRequests waitUntilFinished:NO];
-    
+
     expect(completionBlockFiredAfterOtherBlocks).will.beTruthy();
 }