chor: use new Writer interface for terminal's Writer; fix test cases
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 3m38s

This commit is contained in:
2025-10-01 10:59:29 +02:00
parent aa17e13b99
commit 832fc45c3e
6 changed files with 46 additions and 44 deletions

View File

@@ -167,10 +167,10 @@ pub fn expectEqualCells(origin: Point, size: Point, expected: []const Cell, actu
var actual_cps = try std.ArrayList(Cell).initCapacity(allocator, size.x);
defer actual_cps.deinit(allocator);
var output = try std.ArrayList(u8).initCapacity(allocator, expected_cps.capacity * actual_cps.capacity + 5 * size.y);
defer output.deinit(allocator);
var allocating_writer = std.Io.Writer.Allocating.init(allocator);
defer allocating_writer.deinit();
const writer = output.writer(allocator);
var writer = &allocating_writer.writer;
var differ = false;
const expected_centered = try center(allocator, "Expected Screen", size.x, " ");
@@ -212,7 +212,7 @@ pub fn expectEqualCells(origin: Point, size: Point, expected: []const Cell, actu
var stdout_buffer: [1024]u8 = undefined;
var stdout = std.fs.File.stdout().writer(&stdout_buffer);
const stdout_writer = &stdout.interface;
try stdout_writer.writeAll(output.items);
try stdout_writer.writeAll(writer.buffer[0..writer.end]);
try stdout_writer.flush();
return error.TestExpectEqualCells;
}