zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit a712a5515d2d7a418d77bc419e4fc0a7fe5639f5 (tree)
parent ebedc99ac1148c8d3465ad2338d3db142e57579f
Author: daurnimator <quae@daurnimator.com>
Date:   Tue, 21 May 2019 00:29:46 +1000

std: testing.expectEqual on structs now works

Diffstat:
Mstd/testing.zig | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/std/testing.zig b/std/testing.zig @@ -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| {