aboutsummaryrefslogtreecommitdiffhomepage
path: root/objectivec/Tests/unittest_objc.proto
diff options
context:
space:
mode:
authorGravatar Thomas Van Lenten <thomasvl@google.com>2016-04-26 14:40:11 -0400
committerGravatar Thomas Van Lenten <thomasvl@google.com>2016-04-26 15:15:49 -0400
commit18b6a321b5fd8f53e1029c436c2ad5dd2d3122df (patch)
treed0c0dd00376f74cf985428719766c6fcf2fdbbb5 /objectivec/Tests/unittest_objc.proto
parent40574479978f80bd86caf44edae5b0a22d596c79 (diff)
Proper checking of enum with non zero default
proto2 syntax allows the first enum to have a non zero value. This means any field using that default has a non zero default without having an explicit default being set. So when deciding what runtime info is needed, don't rely on an explicit default, always check that the values aren't zero. Fixes https://github.com/google/protobuf/issues/1453
Diffstat (limited to 'objectivec/Tests/unittest_objc.proto')
-rw-r--r--objectivec/Tests/unittest_objc.proto10
1 files changed, 10 insertions, 0 deletions
diff --git a/objectivec/Tests/unittest_objc.proto b/objectivec/Tests/unittest_objc.proto
index 9483cb1d..6bcfbf70 100644
--- a/objectivec/Tests/unittest_objc.proto
+++ b/objectivec/Tests/unittest_objc.proto
@@ -401,3 +401,13 @@ message EnumTestMsg {
repeated MyEnum mumble = 4;
}
+
+// Test case for https://github.com/google/protobuf/issues/1453
+// Message with no explicit defaults, but a non zero default for an enum.
+message MessageWithOneBasedEnum {
+ enum OneBasedEnum {
+ ONE = 1;
+ TWO = 2;
+ }
+ optional OneBasedEnum enum_field = 1;
+}