diff options
Diffstat (limited to 'objectivec/Tests')
-rw-r--r-- | objectivec/Tests/GPBMessageTests+Serialization.m | 7 | ||||
-rw-r--r-- | objectivec/Tests/unittest_runtime_proto3.proto | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/objectivec/Tests/GPBMessageTests+Serialization.m b/objectivec/Tests/GPBMessageTests+Serialization.m index 8867f56d..0859f14c 100644 --- a/objectivec/Tests/GPBMessageTests+Serialization.m +++ b/objectivec/Tests/GPBMessageTests+Serialization.m @@ -177,6 +177,13 @@ static NSData *DataFromCStr(const char *str) { XCTAssertEqual([field.varintList valueAtIndex:0], (uint64_t)Message3_Enum_Extra3); + // TODO(teboring): This test could fail without explicitly marking the repeated_enum in Message3 + // to be unpacked. This is becaucse proto3 repeated primitive field is packed by default. However, + // the proto2 primitive repeated field is still unpacked by default. Previously, parsing of the + // repeated_enum field would fail. To fix it: + // 1) Objective-C implementation of parsing should be able to parse packed field for unpacked + // field and vice versa. + // 2) repeated_packed_enum in Message3 should be removed, because it's unnecessary now. field = [unknownFields getField:Message2_FieldNumber_RepeatedEnumArray]; XCTAssertEqual(field.varintList.count, 1U); XCTAssertEqual([field.varintList valueAtIndex:0], diff --git a/objectivec/Tests/unittest_runtime_proto3.proto b/objectivec/Tests/unittest_runtime_proto3.proto index feb7029d..a081fa7e 100644 --- a/objectivec/Tests/unittest_runtime_proto3.proto +++ b/objectivec/Tests/unittest_runtime_proto3.proto @@ -75,7 +75,10 @@ message Message3 { repeated bytes repeated_bytes = 45; // No 'group' in proto3. repeated Message3 repeated_message = 48; - repeated Enum repeated_enum = 49; + // TODO(teboring): In proto3, repeated primitive field is packed by default. + // testProto2UnknownEnumToUnknownField needs repeated_enum to be unpacked. + // Remove this option when testProto2UnknownEnumToUnknownField. + repeated Enum repeated_enum = 49 [packed=false]; repeated Enum repeated_packed_enum = 50 [packed=true]; oneof o { |