File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
Google.Protobuf.Test/Reflection
Google.Protobuf/Reflection Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,16 @@ public void NestedEnumValueComments()
137137 Assert . AreEqual ( " Zero value comment\n " , value . Declaration . LeadingComments ) ;
138138 }
139139
140+ [ Test ]
141+ public void OneofComments ( )
142+ {
143+ // CommentMessage doesn't have an enum, but we can use TestAllTypes.
144+ var message = unitTestProto3Descriptor . FindTypeByName < MessageDescriptor > ( "TestAllTypes" ) ;
145+ var oneof = message . Oneofs . Single ( o => o . Name == "oneof_field" ) ;
146+ Assert . NotNull ( oneof . Declaration ) ;
147+ Assert . AreEqual ( " For oneof test\n " , oneof . Declaration . LeadingComments ) ;
148+ }
149+
140150 private static FileDescriptor LoadProtos ( )
141151 {
142152 var type = typeof ( DescriptorDeclarationTest ) ;
Original file line number Diff line number Diff line change @@ -119,6 +119,7 @@ internal override IReadOnlyList<DescriptorBase> GetNestedDescriptorListForField(
119119 DescriptorProto . FieldFieldNumber => ( IReadOnlyList < DescriptorBase > ) fieldsInDeclarationOrder ,
120120 DescriptorProto . NestedTypeFieldNumber => ( IReadOnlyList < DescriptorBase > ) NestedTypes ,
121121 DescriptorProto . EnumTypeFieldNumber => ( IReadOnlyList < DescriptorBase > ) EnumTypes ,
122+ DescriptorProto . OneofDeclFieldNumber => ( IReadOnlyList < DescriptorBase > ) Oneofs ,
122123 _ => null ,
123124 } ;
124125
You can’t perform that action at this time.
0 commit comments