Skip to content

Commit 299bcec

Browse files
committed
Fix build warning
1 parent 8c84642 commit 299bcec

File tree

1 file changed

+30
-36
lines changed

1 file changed

+30
-36
lines changed

FirebaseDatabase/Tests/Integration/FEventTests.m

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -362,42 +362,36 @@ - (void)testOnceValueFiresExactlyOnce {
362362
}
363363

364364
- (void)testOnceChildAddedFiresExactlyOnce {
365-
__block int badCount = 0;
366-
367-
// for(int i = 0; i < 100; i++) {
368-
369-
FIRDatabaseReference* path = [FTestHelpers getRandomNode];
370-
__block BOOL firstCall = YES;
371-
372-
__block BOOL done = NO;
373-
374-
[path observeSingleEventOfType:FIRDataEventTypeChildAdded
375-
withBlock:^(FIRDataSnapshot* snapshot) {
376-
XCTAssertTrue(firstCall, @"Properly saw first call");
377-
firstCall = NO;
378-
XCTAssertEqualObjects(@42, [snapshot value], @"Properly saw node value");
379-
XCTAssertEqualObjects(@"foo", [snapshot key],
380-
@"Properly saw the first node");
381-
if (![[snapshot value] isEqual:@42]) {
382-
exit(-1);
383-
badCount = badCount + 1;
384-
}
385-
386-
done = YES;
387-
}];
388-
389-
[[path child:@"foo"] setValue:@42];
390-
[[path child:@"bar"] setValue:@84]; // XXX FIXME sometimes this event fires first
391-
[[path child:@"foo"] setValue:@168];
392-
393-
// [path setValue:nil withCompletionBlock:^(BOOL status) { done = YES; }];
394-
[self waitUntil:^BOOL {
395-
return done;
396-
}];
397-
398-
// }
399-
400-
NSLog(@"BADCOUNT: %d", badCount);
365+
for(int i = 0; i < 100; i++) {
366+
367+
FIRDatabaseReference* path = [FTestHelpers getRandomNode];
368+
__block BOOL firstCall = YES;
369+
370+
__block BOOL done = NO;
371+
372+
[path observeSingleEventOfType:FIRDataEventTypeChildAdded
373+
withBlock:^(FIRDataSnapshot* snapshot) {
374+
XCTAssertTrue(firstCall, @"Properly saw first call");
375+
firstCall = NO;
376+
XCTAssertEqualObjects(@42, [snapshot value], @"Properly saw node value");
377+
XCTAssertEqualObjects(@"foo", [snapshot key],
378+
@"Properly saw the first node");
379+
if (![[snapshot value] isEqual:@42]) {
380+
exit(-1);
381+
}
382+
383+
done = YES;
384+
}];
385+
386+
[[path child:@"foo"] setValue:@42];
387+
[[path child:@"bar"] setValue:@84]; // XXX FIXME sometimes this event fires first
388+
[[path child:@"foo"] setValue:@168];
389+
390+
// [path setValue:nil withCompletionBlock:^(BOOL status) { done = YES; }];
391+
[self waitUntil:^BOOL {
392+
return done;
393+
}];
394+
}
401395
}
402396

403397
- (void)testOnceValueFiresExactlyOnceEvenIfThereIsASetInsideCallback {

0 commit comments

Comments
 (0)