diff options
author | Adam Cozzette <acozzette@google.com> | 2018-03-13 16:37:29 -0700 |
---|---|---|
committer | Adam Cozzette <acozzette@google.com> | 2018-03-13 16:37:29 -0700 |
commit | 0400cca3236de1ca303af38bf81eab332d042b7c (patch) | |
tree | a8a9b19853f64567c96750a1c7d253926471daa5 /src/google/protobuf/util/type_resolver_util_test.cc | |
parent | 96b535cc2f4f7b7e22a1b8622149f7c26a5a3f63 (diff) | |
download | protobuf-0400cca3236de1ca303af38bf81eab332d042b7c.tar.gz protobuf-0400cca3236de1ca303af38bf81eab332d042b7c.tar.bz2 protobuf-0400cca3236de1ca303af38bf81eab332d042b7c.zip |
Integrated internal changes from Google
Diffstat (limited to 'src/google/protobuf/util/type_resolver_util_test.cc')
-rw-r--r-- | src/google/protobuf/util/type_resolver_util_test.cc | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/google/protobuf/util/type_resolver_util_test.cc b/src/google/protobuf/util/type_resolver_util_test.cc index 8a0bf652..9dea17ae 100644 --- a/src/google/protobuf/util/type_resolver_util_test.cc +++ b/src/google/protobuf/util/type_resolver_util_test.cc @@ -32,9 +32,6 @@ #include <limits> #include <memory> -#ifndef _SHARED_PTR_H -#include <google/protobuf/stubs/shared_ptr.h> -#endif #include <string> #include <vector> @@ -153,7 +150,7 @@ class DescriptorPoolTypeResolverTest : public testing::Test { } protected: - google::protobuf::scoped_ptr<TypeResolver> resolver_; + std::unique_ptr<TypeResolver> resolver_; }; TEST_F(DescriptorPoolTypeResolverTest, TestAllTypes) { @@ -193,6 +190,13 @@ TEST_F(DescriptorPoolTypeResolverTest, TestAllTypes) { Field::TYPE_BYTES, "optional_bytes", 15)); EXPECT_TRUE(HasField(type, Field::CARDINALITY_OPTIONAL, + Field::TYPE_GROUP, "optionalgroup", 16)); + + EXPECT_TRUE(CheckFieldTypeUrl( + type, "optionalgroup", + GetTypeUrl<protobuf_unittest::TestAllTypes::OptionalGroup>())); + + EXPECT_TRUE(HasField(type, Field::CARDINALITY_OPTIONAL, Field::TYPE_MESSAGE, "optional_nested_message", 18)); EXPECT_TRUE(HasField(type, Field::CARDINALITY_OPTIONAL, Field::TYPE_MESSAGE, "optional_foreign_message", 19)); @@ -249,6 +253,13 @@ TEST_F(DescriptorPoolTypeResolverTest, TestAllTypes) { Field::TYPE_BYTES, "repeated_bytes", 45)); EXPECT_TRUE(HasField(type, Field::CARDINALITY_REPEATED, + Field::TYPE_GROUP, "repeatedgroup", 46)); + + EXPECT_TRUE(CheckFieldTypeUrl( + type, "repeatedgroup", + GetTypeUrl<protobuf_unittest::TestAllTypes::RepeatedGroup>())); + + EXPECT_TRUE(HasField(type, Field::CARDINALITY_REPEATED, Field::TYPE_MESSAGE, "repeated_nested_message", 48)); EXPECT_TRUE(HasField(type, Field::CARDINALITY_REPEATED, Field::TYPE_MESSAGE, "repeated_foreign_message", 49)); @@ -271,13 +282,6 @@ TEST_F(DescriptorPoolTypeResolverTest, TestAllTypes) { EXPECT_TRUE(CheckFieldTypeUrl( type, "repeated_foreign_enum", GetTypeUrl("protobuf_unittest.ForeignEnum"))); - - // Groups are discarded when converting to Type. - const Descriptor* descriptor = protobuf_unittest::TestAllTypes::descriptor(); - EXPECT_TRUE(descriptor->FindFieldByName("optionalgroup") != NULL); - EXPECT_TRUE(descriptor->FindFieldByName("repeatedgroup") != NULL); - ASSERT_FALSE(HasField(type, "optionalgroup")); - ASSERT_FALSE(HasField(type, "repeatedgroup")); } TEST_F(DescriptorPoolTypeResolverTest, TestPackedField) { |