Skip to content

Commit

Permalink
de: Replace logError with require.failf
Browse files Browse the repository at this point in the history
  • Loading branch information
ibokuri committed Dec 27, 2023
1 parent 39b59ad commit db1015b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/de/blocks/int.zig
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ test "deserialize - integer (from string)" {
},
.{
.name = "unsigned",
.tokens = &.{.{ .String = "255" }},
.tokens = &.{.{ .String = "256" }},
.want = @as(u8, std.math.maxInt(u8)),
},
.{
Expand Down
4 changes: 2 additions & 2 deletions src/de/testing.zig
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub fn deserialize(
) !Result(Want) {
return deserializeErr(block, Want, input) catch |e| {
if (test_case) |t| {
return testing.logErr(t, e);
try require.failf(@errorName(e), "Test case: \"{s}\"", .{t});
}

return e;
Expand Down Expand Up @@ -73,7 +73,7 @@ pub fn deserializeWithLifetime(
) !Want {
return deserializeErrWithLifetime(ally, block, Want, input, lifetime) catch |e| {
if (test_case) |t| {
return testing.logErr(t, e);
try require.failf(@errorName(e), "Test case: \"{s}\"", .{t});
}

return e;
Expand Down
5 changes: 0 additions & 5 deletions src/testing.zig
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,3 @@ pub const Token = union(enum) {
Enum,
Union,
};

pub fn logErr(comptime name: []const u8, err: anyerror) anyerror {
std.log.err("test case \"{s}\" failed", .{name});
return err;
}

0 comments on commit db1015b

Please sign in to comment.