| Index: third_party/protobuf/src/google/protobuf/unknown_field_set_unittest.cc
|
| diff --git a/third_party/protobuf/src/google/protobuf/unknown_field_set_unittest.cc b/third_party/protobuf/src/google/protobuf/unknown_field_set_unittest.cc
|
| index c6b8769f32b0f6fb213cb3661c2324f614734297..9b02f0b040708646cb10b85f8d3cf12667588cdd 100644
|
| --- a/third_party/protobuf/src/google/protobuf/unknown_field_set_unittest.cc
|
| +++ b/third_party/protobuf/src/google/protobuf/unknown_field_set_unittest.cc
|
| @@ -1,6 +1,6 @@
|
| // Protocol Buffers - Google's data interchange format
|
| // Copyright 2008 Google Inc. All rights reserved.
|
| -// http://code.google.com/p/protobuf/
|
| +// https://developers.google.com/protocol-buffers/
|
| //
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| @@ -118,7 +118,12 @@ TEST_F(UnknownFieldSetTest, AllFieldsPresent) {
|
| const FieldDescriptor* field = descriptor_->FindFieldByNumber(i);
|
| if (field != NULL) {
|
| ASSERT_LT(pos, unknown_fields_->field_count());
|
| - EXPECT_EQ(i, unknown_fields_->field(pos++).number());
|
| + // Do not check oneof field if it is not set.
|
| + if (field->containing_oneof() == NULL) {
|
| + EXPECT_EQ(i, unknown_fields_->field(pos++).number());
|
| + } else if (i == unknown_fields_->field(pos).number()) {
|
| + pos++;
|
| + }
|
| if (field->is_repeated()) {
|
| // Should have a second instance.
|
| ASSERT_LT(pos, unknown_fields_->field_count());
|
| @@ -477,6 +482,13 @@ TEST_F(UnknownFieldSetTest, UnknownEnumValue) {
|
| }
|
| }
|
|
|
| +TEST_F(UnknownFieldSetTest, SpaceUsedExcludingSelf) {
|
| + UnknownFieldSet empty;
|
| + empty.AddVarint(1, 0);
|
| + EXPECT_EQ(sizeof(vector<UnknownField>) + sizeof(UnknownField),
|
| + empty.SpaceUsedExcludingSelf());
|
| +}
|
| +
|
| TEST_F(UnknownFieldSetTest, SpaceUsed) {
|
| unittest::TestEmptyMessage empty_message;
|
|
|
|
|