Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

expectSerializeEqual

stringify.expectSerializeEqual
fn expectSerializeEqual(
    expected: []const u8,
    value: anytype,
    options: SerializeOptions,
) !void

File

lib/std/zon/stringify.zig:118

Code

fn expectSerializeEqual(
    expected: []const u8,
    value: anytype,
    options: SerializeOptions,
) !void {
    var aw: Writer.Allocating = .init(std.testing.allocator);
    const bw = &aw.writer;
    defer aw.deinit();

    try serialize(value, options, bw);
    try std.testing.expectEqualStrings(expected, aw.written());
}