update compiler unit tests to new API

This commit is contained in:
Andrew Kelley 2025-07-07 20:30:37 -07:00
parent b0395531d3
commit 26659c862f

View File

@ -2053,15 +2053,15 @@ const UnpackResult = struct {
// output errors to string
var errors = try fetch.error_bundle.toOwnedBundle("");
defer errors.deinit(gpa);
var out = std.ArrayList(u8).init(gpa);
defer out.deinit();
try errors.renderToWriter(.{ .ttyconf = .no_color }, out.writer());
var aw: std.io.Writer.Allocating = .init(gpa);
defer aw.deinit();
try errors.renderToWriter(.{ .ttyconf = .no_color }, &aw.writer);
try std.testing.expectEqualStrings(
\\error: unable to unpack
\\ note: unable to create symlink from 'dir2/file2' to 'filename': SymlinkError
\\ note: file 'dir2/file4' has unsupported type 'x'
\\
, out.items);
, aw.getWritten());
}
};
@ -2428,10 +2428,10 @@ const TestFetchBuilder = struct {
if (notes_len > 0) {
try std.testing.expectEqual(notes_len, em.notes_len);
}
var al = std.ArrayList(u8).init(std.testing.allocator);
defer al.deinit();
try errors.renderToWriter(.{ .ttyconf = .no_color }, al.writer());
try std.testing.expectEqualStrings(msg, al.items);
var aw: std.io.Writer.Allocating = .init(std.testing.allocator);
defer aw.deinit();
try errors.renderToWriter(.{ .ttyconf = .no_color }, &aw.writer);
try std.testing.expectEqualStrings(msg, aw.getWritten());
}
};