diff options
author | kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2009-04-25 02:53:47 +0000 |
---|---|---|
committer | kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2009-04-25 02:53:47 +0000 |
commit | d37d46dfbcedadeb439ad0367f8afcf8867dca43 (patch) | |
tree | b896df229f7c671637924c156d5a759ba50a3190 /src/google/protobuf/reflection_ops_unittest.cc | |
parent | 709ea28f3264aa5632e5577a4080671173fc6166 (diff) | |
download | protobuf-d37d46dfbcedadeb439ad0367f8afcf8867dca43.tar.gz protobuf-d37d46dfbcedadeb439ad0367f8afcf8867dca43.tar.bz2 protobuf-d37d46dfbcedadeb439ad0367f8afcf8867dca43.zip |
Integrate recent changes from Google-internal code tree. See CHANGES.txt
for details.
Diffstat (limited to 'src/google/protobuf/reflection_ops_unittest.cc')
-rw-r--r-- | src/google/protobuf/reflection_ops_unittest.cc | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/src/google/protobuf/reflection_ops_unittest.cc b/src/google/protobuf/reflection_ops_unittest.cc index 2f2d5262..1cd56f1e 100644 --- a/src/google/protobuf/reflection_ops_unittest.cc +++ b/src/google/protobuf/reflection_ops_unittest.cc @@ -138,16 +138,18 @@ TEST(ReflectionOpsTest, MergeExtensions) { TEST(ReflectionOpsTest, MergeUnknown) { // Test that the messages' UnknownFieldSets are correctly merged. unittest::TestEmptyMessage message1, message2; - message1.mutable_unknown_fields()->AddField(1234)->add_varint(1); - message2.mutable_unknown_fields()->AddField(1234)->add_varint(2); + message1.mutable_unknown_fields()->AddVarint(1234, 1); + message2.mutable_unknown_fields()->AddVarint(1234, 2); ReflectionOps::Merge(message2, &message1); - ASSERT_EQ(1, message1.unknown_fields().field_count()); - const UnknownField& field = message1.unknown_fields().field(0); - ASSERT_EQ(2, field.varint_size()); - EXPECT_EQ(1, field.varint(0)); - EXPECT_EQ(2, field.varint(1)); + ASSERT_EQ(2, message1.unknown_fields().field_count()); + ASSERT_EQ(UnknownField::TYPE_VARINT, + message1.unknown_fields().field(0).type()); + EXPECT_EQ(1, message1.unknown_fields().field(0).varint()); + ASSERT_EQ(UnknownField::TYPE_VARINT, + message1.unknown_fields().field(1).type()); + EXPECT_EQ(2, message1.unknown_fields().field(1).varint()); } #ifdef GTEST_HAS_DEATH_TEST @@ -211,7 +213,7 @@ TEST(ReflectionOpsTest, ClearExtensions) { TEST(ReflectionOpsTest, ClearUnknown) { // Test that the message's UnknownFieldSet is correctly cleared. unittest::TestEmptyMessage message; - message.mutable_unknown_fields()->AddField(1234)->add_varint(1); + message.mutable_unknown_fields()->AddVarint(1234, 1); ReflectionOps::Clear(&message); @@ -224,16 +226,13 @@ TEST(ReflectionOpsTest, DiscardUnknownFields) { // Set some unknown fields in message. message.mutable_unknown_fields() - ->AddField(123456) - ->add_varint(654321); + ->AddVarint(123456, 654321); message.mutable_optional_nested_message() ->mutable_unknown_fields() - ->AddField(123456) - ->add_varint(654321); + ->AddVarint(123456, 654321); message.mutable_repeated_nested_message(0) ->mutable_unknown_fields() - ->AddField(123456) - ->add_varint(654321); + ->AddVarint(123456, 654321); EXPECT_EQ(1, message.unknown_fields().field_count()); EXPECT_EQ(1, message.optional_nested_message() @@ -258,16 +257,13 @@ TEST(ReflectionOpsTest, DiscardUnknownExtensions) { // Set some unknown fields. message.mutable_unknown_fields() - ->AddField(123456) - ->add_varint(654321); + ->AddVarint(123456, 654321); message.MutableExtension(unittest::optional_nested_message_extension) ->mutable_unknown_fields() - ->AddField(123456) - ->add_varint(654321); + ->AddVarint(123456, 654321); message.MutableExtension(unittest::repeated_nested_message_extension, 0) ->mutable_unknown_fields() - ->AddField(123456) - ->add_varint(654321); + ->AddVarint(123456, 654321); EXPECT_EQ(1, message.unknown_fields().field_count()); EXPECT_EQ(1, |