diff options
author | zxu <zxu@google.com> | 2018-03-16 15:42:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-16 15:42:05 -0400 |
commit | 4e7296b080b9c8cea13e5e5eeee65f4312fb5e8a (patch) | |
tree | 87f175b1e1ac74632fee2ff7c52ccb9b5bc78014 /Firestore/Example/Tests/Util | |
parent | 1395c8202b236188b9e4e1bfc2a3e00244179593 (diff) |
port `DocumentKey` to non-container types of `Model/*` (#930)
* naively remove FSTPath import and source/test files.
* port FieldPath, part I
* port FieldPath, part II
* port ResourcePath, part I
* port ResourcePath, part II
* the grand commit to fix build errors
* use testutil:: helper instead of those from FSTHelpers
* fix test and lint
* use c_str in errmsg directly
* fix
* fix
* make code clean
* fix integration test I missed
* fix to avoid naming collision in preprocessor
* address changes
* address changes
* address changes
* fix: fieldMask are actually shared with different context.
* address changes
* add converter function between two DocumentKey implementations
* add unit test
* address changes
* fix lint
* using DocumentKey in model except for the container types `FSTDocumentDictionary`, `FSTDocumentKeySet`, and `FSTDocumentVersionDictionary`
* change other place w.r.t. the use of `DocumentKey` in model
* update parameter of test helpers from NSString to string_view
* revert a temporary change used in debug
* address changes
Diffstat (limited to 'Firestore/Example/Tests/Util')
-rw-r--r-- | Firestore/Example/Tests/Util/FSTHelpers.h | 4 | ||||
-rw-r--r-- | Firestore/Example/Tests/Util/FSTHelpers.mm | 11 |
2 files changed, 9 insertions, 6 deletions
diff --git a/Firestore/Example/Tests/Util/FSTHelpers.h b/Firestore/Example/Tests/Util/FSTHelpers.h index d86201b..d05c1f1 100644 --- a/Firestore/Example/Tests/Util/FSTHelpers.h +++ b/Firestore/Example/Tests/Util/FSTHelpers.h @@ -192,13 +192,13 @@ typedef int64_t FSTTestSnapshotVersion; FSTSnapshotVersion *FSTTestVersion(FSTTestSnapshotVersion version); /** A convenience method for creating docs for tests. */ -FSTDocument *FSTTestDoc(NSString *path, +FSTDocument *FSTTestDoc(const absl::string_view path, FSTTestSnapshotVersion version, NSDictionary<NSString *, id> *data, BOOL hasMutations); /** A convenience method for creating deleted docs for tests. */ -FSTDeletedDocument *FSTTestDeletedDoc(NSString *path, FSTTestSnapshotVersion version); +FSTDeletedDocument *FSTTestDeletedDoc(const absl::string_view path, FSTTestSnapshotVersion version); /** * A convenience method for creating a document reference from a path string. diff --git a/Firestore/Example/Tests/Util/FSTHelpers.mm b/Firestore/Example/Tests/Util/FSTHelpers.mm index be02002..5751739 100644 --- a/Firestore/Example/Tests/Util/FSTHelpers.mm +++ b/Firestore/Example/Tests/Util/FSTHelpers.mm @@ -43,6 +43,7 @@ #import "Firestore/Source/Util/FSTAssert.h" #include "Firestore/core/src/firebase/firestore/model/database_id.h" +#include "Firestore/core/src/firebase/firestore/model/document_key.h" #include "Firestore/core/src/firebase/firestore/model/field_value.h" #include "Firestore/core/src/firebase/firestore/model/resource_path.h" #include "Firestore/core/src/firebase/firestore/util/string_apple.h" @@ -51,6 +52,7 @@ namespace util = firebase::firestore::util; namespace testutil = firebase::firestore::testutil; using firebase::firestore::model::DatabaseId; +using firebase::firestore::model::DocumentKey; using firebase::firestore::model::FieldPath; using firebase::firestore::model::FieldValue; using firebase::firestore::model::ResourcePath; @@ -148,19 +150,20 @@ FSTSnapshotVersion *FSTTestVersion(FSTTestSnapshotVersion versionMicroseconds) { return [FSTSnapshotVersion versionWithTimestamp:timestamp]; } -FSTDocument *FSTTestDoc(NSString *path, +FSTDocument *FSTTestDoc(const absl::string_view path, FSTTestSnapshotVersion version, NSDictionary<NSString *, id> *data, BOOL hasMutations) { - FSTDocumentKey *key = FSTTestDocKey(path); + DocumentKey key = testutil::Key(path); return [FSTDocument documentWithData:FSTTestObjectValue(data) key:key version:FSTTestVersion(version) hasLocalMutations:hasMutations]; } -FSTDeletedDocument *FSTTestDeletedDoc(NSString *path, FSTTestSnapshotVersion version) { - FSTDocumentKey *key = FSTTestDocKey(path); +FSTDeletedDocument *FSTTestDeletedDoc(const absl::string_view path, + FSTTestSnapshotVersion version) { + DocumentKey key = testutil::Key(path); return [FSTDeletedDocument documentWithKey:key version:FSTTestVersion(version)]; } |