diff options
author | Gil <mcg@google.com> | 2018-05-24 11:00:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-24 11:00:23 -0700 |
commit | 8037a4bf79b8ae49162c2b6f099d62ec17a7f283 (patch) | |
tree | 5a15df8664abbcf3e63479fa3e7560fd8c2fbe9e /Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm | |
parent | de4fe203525072babcdec444a06e42e77f0aa714 (diff) |
Replace Objective-C assertions with C++ assertions (#1327)
* Migrate FSTFail to HARD_FAIL
* FSTCFail -> HARD_FAIL
* FSTCAssert -> HARD_ASSERT
* FSTAssert -> HARD_ASSERT
* Replace FSTAssert with NSAssert in dead Objective-C code
* Remove FSTAssert.h
Diffstat (limited to 'Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm')
-rw-r--r-- | Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm b/Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm index 3c7f46a..63c3d72 100644 --- a/Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm +++ b/Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm @@ -21,7 +21,6 @@ #import "Firestore/Source/Model/FSTMutation.h" #import "Firestore/Source/Remote/FSTSerializerBeta.h" #import "Firestore/Source/Remote/FSTStream.h" -#import "Firestore/Source/Util/FSTAssert.h" #import "Firestore/Example/Tests/Remote/FSTWatchChange+Testing.h" @@ -80,7 +79,7 @@ NS_ASSUME_NONNULL_BEGIN credentials:credentials serializer:serializer]; if (self) { - FSTAssert(datastore, @"Datastore must not be nil"); + HARD_ASSERT(datastore, "Datastore must not be nil"); _datastore = datastore; _activeTargets = [NSMutableDictionary dictionary]; } @@ -90,7 +89,7 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Overridden FSTWatchStream methods. - (void)startWithDelegate:(id<FSTWatchStreamDelegate>)delegate { - FSTAssert(!self.open, @"Trying to start already started watch stream"); + HARD_ASSERT(!self.open, "Trying to start already started watch stream"); self.open = YES; self.delegate = delegate; [self notifyStreamOpen]; @@ -148,7 +147,7 @@ NS_ASSUME_NONNULL_BEGIN // Technically removing an unknown target is valid (e.g. it could race with a // server-side removal), but we want to pay extra careful attention in tests // that we only remove targets we listened too. - FSTFail(@"Removing a non-active target"); + HARD_FAIL("Removing a non-active target"); } [self.activeTargets removeObjectForKey:targetID]; } @@ -204,7 +203,7 @@ NS_ASSUME_NONNULL_BEGIN credentials:credentials serializer:serializer]; if (self) { - FSTAssert(datastore, @"Datastore must not be nil"); + HARD_ASSERT(datastore, "Datastore must not be nil"); _datastore = datastore; _sentMutations = [NSMutableArray array]; } @@ -214,7 +213,7 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Overridden FSTWriteStream methods. - (void)startWithDelegate:(id<FSTWriteStreamDelegate>)delegate { - FSTAssert(!self.open, @"Trying to start already started write stream"); + HARD_ASSERT(!self.open, "Trying to start already started write stream"); self.open = YES; [self.sentMutations removeAllObjects]; self.delegate = delegate; @@ -258,8 +257,8 @@ NS_ASSUME_NONNULL_BEGIN * Returns the next write that was "sent to the backend", failing if there are no queued sent */ - (NSArray<FSTMutation *> *)nextSentWrite { - FSTAssert(self.sentMutations.count > 0, - @"Writes need to happen before you can call nextSentWrite."); + HARD_ASSERT(self.sentMutations.count > 0, + "Writes need to happen before you can call nextSentWrite."); NSArray<FSTMutation *> *result = [self.sentMutations objectAtIndex:0]; [self.sentMutations removeObjectAtIndex:0]; return result; @@ -292,7 +291,6 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Overridden FSTDatastore methods. - (FSTWatchStream *)createWatchStream { - // FSTAssert(self.databaseInfo, @"DatabaseInfo must not be nil"); self.watchStream = [[FSTMockWatchStream alloc] initWithDatastore:self workerDispatchQueue:self.workerDispatchQueue @@ -303,7 +301,6 @@ NS_ASSUME_NONNULL_BEGIN } - (FSTWriteStream *)createWriteStream { - // FSTAssert(self.databaseInfo, @"DatabaseInfo must not be nil"); self.writeStream = [[FSTMockWriteStream alloc] initWithDatastore:self workerDispatchQueue:self.workerDispatchQueue @@ -314,7 +311,7 @@ NS_ASSUME_NONNULL_BEGIN } - (void)authorizeAndStartRPC:(GRPCProtoCall *)rpc completion:(FSTVoidErrorBlock)completion { - FSTFail(@"FSTMockDatastore shouldn't be starting any RPCs."); + HARD_FAIL("FSTMockDatastore shouldn't be starting any RPCs."); } #pragma mark - Method exposed for tests to call. |