std.testing.expectError: fix error names

This commit is contained in:
gooncreeper 2024-11-08 22:03:34 -05:00 committed by Veikka Tuominen
parent 862266514a
commit 9fa9c7abd0

View File

@ -41,14 +41,14 @@ fn print(comptime fmt: []const u8, args: anytype) void {
pub fn expectError(expected_error: anyerror, actual_error_union: anytype) !void {
if (actual_error_union) |actual_payload| {
print("expected error.{s}, found {any}\n", .{ @errorName(expected_error), actual_payload });
return error.TestUnexpectedError;
return error.TestExpectedError;
} else |actual_error| {
if (expected_error != actual_error) {
print("expected error.{s}, found error.{s}\n", .{
@errorName(expected_error),
@errorName(actual_error),
});
return error.TestExpectedError;
return error.TestUnexpectedError;
}
}
}