Fix trivial bug in field orderings.
(Shows the benefit of unit testing even code "too simple to fail"...)
This commit is contained in:
parent
c20f67fdb4
commit
fd02e45b2a
@ -238,5 +238,18 @@ namespace Google.Protobuf.Reflection
|
||||
Assert.IsNull(fieldDescriptor.Accessor);
|
||||
Assert.IsNull(messageDescriptor.GeneratedType);
|
||||
}
|
||||
|
||||
// From TestFieldOrdering:
|
||||
// string my_string = 11;
|
||||
// int64 my_int = 1;
|
||||
// float my_float = 101;
|
||||
// NestedMessage single_nested_message = 200;
|
||||
[Test]
|
||||
public void FieldListOrderings()
|
||||
{
|
||||
var fields = TestFieldOrderings.Descriptor.Fields;
|
||||
Assert.AreEqual(new[] { 11, 1, 101, 200 }, fields.InDeclarationOrder().Select(x => x.FieldNumber));
|
||||
Assert.AreEqual(new[] { 1, 11, 101, 200 }, fields.InFieldNumberOrder().Select(x => x.FieldNumber));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ namespace Google.Protobuf.Reflection
|
||||
/// </value>
|
||||
public IList<FieldDescriptor> InFieldNumberOrder()
|
||||
{
|
||||
return messageDescriptor.fieldsInDeclarationOrder;
|
||||
return messageDescriptor.fieldsInNumberOrder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user