authorgravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2019-05-21 00:29:46+10:00
committergravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2019-06-10 14:39:44+10:00
loga712a5515d2d7a418d77bc419e4fc0a7fe5639f5
treedeb1a679f1d0ee26a4f26d6276bd1d4ed6006ddc
parentebedc99ac1148c8d3465ad2338d3db142e57579f
signature Commit is signed but in an unrecognized format.

std: testing.expectEqual on structs now works


1 files changed, 4 insertions(+), 2 deletions(-)

std/testing.zig+4-2
......@@ -78,8 +78,10 @@ pub fn expectEqual(expected: var, actual: @typeOf(expected)) void {
7878
7979 TypeId.Array => |array| expectEqualSlices(array.child, &expected, &actual),
8080
81 TypeId.Struct => {
82 @compileError("TODO implement testing.expectEqual for structs");
81 TypeId.Struct => |structType| {
82 inline for (structType.fields) |field| {
83 expectEqual(@field(expected, field.name), @field(actual, field.name));
84 }
8385 },
8486
8587 TypeId.Union => |union_info| {