std: testing.expectEqual on structs now works

This commit is contained in:
daurnimator 2019-05-21 00:29:46 +10:00
parent ebedc99ac1
commit a712a5515d
No known key found for this signature in database
GPG Key ID: 45B429A8F9D9D22A

View File

@ -78,8 +78,10 @@ pub fn expectEqual(expected: var, actual: @typeOf(expected)) void {
TypeId.Array => |array| expectEqualSlices(array.child, &expected, &actual),
TypeId.Struct => {
@compileError("TODO implement testing.expectEqual for structs");
TypeId.Struct => |structType| {
inline for (structType.fields) |field| {
expectEqual(@field(expected, field.name), @field(actual, field.name));
}
},
TypeId.Union => |union_info| {