diff options
author | zxu <zxu@google.com> | 2018-03-15 11:31:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-15 11:31:16 -0400 |
commit | 2d9d3a868c996d38b4a8bf6d3ce55ee76af43d75 (patch) | |
tree | 864c27069d50bf6f57948e81044e36bee9c30509 /Firestore/Example/Tests/Model | |
parent | 35de3c54d543d7be16fdcae9205ffe247f2917a7 (diff) |
adding converters between DocumentKey (#900)
* 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
Diffstat (limited to 'Firestore/Example/Tests/Model')
-rw-r--r-- | Firestore/Example/Tests/Model/FSTDocumentKeyTests.mm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Firestore/Example/Tests/Model/FSTDocumentKeyTests.mm b/Firestore/Example/Tests/Model/FSTDocumentKeyTests.mm index 5992b42..5e465f7 100644 --- a/Firestore/Example/Tests/Model/FSTDocumentKeyTests.mm +++ b/Firestore/Example/Tests/Model/FSTDocumentKeyTests.mm @@ -18,8 +18,10 @@ #import <XCTest/XCTest.h> +#include "Firestore/core/src/firebase/firestore/model/document_key.h" #include "Firestore/core/src/firebase/firestore/model/resource_path.h" +using firebase::firestore::model::DocumentKey; using firebase::firestore::model::ResourcePath; NS_ASSUME_NONNULL_BEGIN @@ -56,6 +58,15 @@ NS_ASSUME_NONNULL_BEGIN XCTAssertEqual(NSOrderedDescending, [ab compare:a]); } +- (void)testConverter { + const ResourcePath path{"rooms", "firestore", "messages", "1"}; + FSTDocumentKey *objcKey = [FSTDocumentKey keyWithPath:path]; + XCTAssertEqualObjects(objcKey, (FSTDocumentKey *)(DocumentKey{objcKey})); + + DocumentKey cpp_key{path}; + XCTAssertEqual(cpp_key, DocumentKey{(FSTDocumentKey *)(cpp_key)}); +} + @end NS_ASSUME_NONNULL_END |