Commit fd02e45b authored by Jon Skeet's avatar Jon Skeet

Fix trivial bug in field orderings.

(Shows the benefit of unit testing even code "too simple to fail"...)
parent c20f67fd
......@@ -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>
......
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