Function expectFmt [src]

This function is intended to be used only in tests. When the formatted result of the template and its arguments does not equal the expected text, it prints diagnostics to stderr to show how they are not equal, then returns an error. It depends on expectEqualStrings() for printing diagnostics.

Prototype

pub fn expectFmt(expected: []const u8, comptime template: []const u8, args: anytype) !void

Parameters

expected: []const u8template: []const u8

Source

pub fn expectFmt(expected: []const u8, comptime template: []const u8, args: anytype) !void { const actual = try std.fmt.allocPrint(allocator, template, args); defer allocator.free(actual); return expectEqualStrings(expected, actual); }