aboutsummaryrefslogtreecommitdiffhomepage
path: root/objectivec/Tests
diff options
context:
space:
mode:
authorGravatar Bo Yang <teboring@teboring-macpro.roam.corp.google.com>2015-05-25 12:48:03 -0700
committerGravatar Bo Yang <teboring@teboring-macpro.roam.corp.google.com>2015-05-25 12:48:03 -0700
commit50a765ba03ddf311a4facc78104903e3ba5b3e8b (patch)
tree01b36604d8f6a9579fa160e43477f381f22524d7 /objectivec/Tests
parentad0a5cab521d86fcadb8991427395e77daca71a6 (diff)
Fix bugs in objective-c.
Diffstat (limited to 'objectivec/Tests')
-rw-r--r--objectivec/Tests/GPBMessageTests+Serialization.m7
-rw-r--r--objectivec/Tests/unittest_runtime_proto3.proto5
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 {