Commit a712a5515d

daurnimator <quae@daurnimator.com>
2019-05-20 16:29:46
std: testing.expectEqual on structs now works
1 parent ebedc99
Changed files (1)
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| {