Commit ccb76fff authored by Jie Luo's avatar Jie Luo

Add Oneof custom options test

parent 5af0b547
......@@ -68,10 +68,9 @@ extend google.protobuf.FieldOptions {
fixed64 field_opt1 = 7740936;
}
// See https://github.com/google/protobuf/issues/2316
// extend google.protobuf.OneofOptions {
// int32 oneof_opt1 = 7740111;
// }
extend google.protobuf.OneofOptions {
int32 oneof_opt1 = 7740111;
}
extend google.protobuf.EnumOptions {
sfixed32 enum_opt1 = 7753576;
......@@ -106,8 +105,7 @@ message TestMessageWithCustomOptions {
(field_opt1)=8765432109];
oneof AnOneof {
// See https://github.com/google/protobuf/issues/2316
// option (oneof_opt1) = -99;
option (oneof_opt1) = -99;
int32 oneof_field = 2;
}
......
......@@ -50,6 +50,7 @@ namespace Google.Protobuf.Test.Reflection
FileOpt1 = 7736974,
MessageOpt1 = 7739036,
FieldOpt1 = 7740936,
OneofOpt1 = 7740111,
EnumOpt1 = 7753576,
EnumValueOpt1 = 1560678,
ServiceOpt1 = 7887650,
......@@ -197,6 +198,9 @@ namespace Google.Protobuf.Test.Reflection
var fieldOptions = TestMessageWithCustomOptions.Descriptor.Fields["field1"] .CustomOptions;
AssertOption(8765432109UL, fieldOptions.TryGetFixed64, FieldOpt1);
var oneofOptions = TestMessageWithCustomOptions.Descriptor.Oneofs[0].CustomOptions;
AssertOption(-99, oneofOptions.TryGetInt32, OneofOpt1);
var enumOptions = TestMessageWithCustomOptions.Descriptor.EnumTypes[0].CustomOptions;
AssertOption(-789, enumOptions.TryGetSFixed32, EnumOpt1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment