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.

testRender

markdown.testRender
fn testRender(input: []const u8, expected: []const u8) !void

File

lib/docs/wasm/markdown.zig:1111

Code

fn testRender(input: []const u8, expected: []const u8) !void {
    var parser = try Parser.init(testing.allocator);
    defer parser.deinit();

    var lines = std.mem.splitScalar(u8, input, '\n');
    while (lines.next()) |line| {
        try parser.feedLine(line);
    }
    var doc = try parser.endInput();
    defer doc.deinit(testing.allocator);

    var actual = std.array_list.Managed(u8).init(testing.allocator);
    defer actual.deinit();
    try doc.render(actual.writer());

    try testing.expectEqualStrings(expected, actual.items);
}