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.
Zig › std/ › testing.zig › expectStringEndsWith
expectStringEndsWith
testing.expectStringEndsWith
pub fn expectStringEndsWith (actual : []const u8 , expected_ends_with : []const u8 ) !void
File
Code
pub fn expectStringEndsWith (actual : []const u8 , expected_ends_with : []const u8 ) !void {
if (std .mem .endsWith (u8 , actual , expected_ends_with ))
return ;
const shortened_actual = if (actual .len >= expected_ends_with .len )
actual [(actual .len - expected_ends_with .len )..]
else
actual ;
print ("\n====== expected to end with: =========\n" , .{});
printWithVisibleNewlines (expected_ends_with );
print ("\n====== instead ended with: ===========\n" , .{});
printWithVisibleNewlines (shortened_actual );
print ("\n========= full output: ==============\n" , .{});
printWithVisibleNewlines (actual );
print ("\n======================================\n" , .{});
return error .TestExpectedEndsWith ;
}