feature. See also
. The project being documented here (as the example) is the Zig library itself.
Compile.matchCompileError
fn matchCompileError(actual: []const u8, expected: []const u8) bool
File
Code
fn matchCompileError(actual: []const u8, expected: []const u8) bool {
if (mem.endsWith(u8, actual, expected)) return true;
if (mem.startsWith(u8, expected, ":?:?: ")) {
if (mem.endsWith(u8, actual, expected[":?:?: ".len..])) return true;
}
// up to and after /?/.
const expected_trim = mem.trim(u8, expected, " ");
if (mem.find(u8, expected_trim, "/?/")) |index| {
const actual_trim = mem.trim(u8, actual, " ");
const lhs = expected_trim[0..index];
const rhs = expected_trim[index + "/?/".len ..];
if (mem.startsWith(u8, actual_trim, lhs) and mem.endsWith(u8, actual_trim, rhs)) return true;
}
return false;
}