diff --git a/src/error_tests.zig b/src/error_tests.zig index 51bdac7..b818bc0 100644 --- a/src/error_tests.zig +++ b/src/error_tests.zig @@ -1,5 +1,6 @@ const std = @import("std"); -const Compilation = @import("compile.zig").Compilation; +const compile = @import("compile.zig"); +const Module = compile.Module; test "compiler: unknown global variable" { try testEqual( @@ -42,11 +43,16 @@ test "compiler: invalid divert target" { fn testEqual(source_bytes: [:0]const u8, expected_error: []const u8) !void { const gpa = std.testing.allocator; + var arena_allocator = std.heap.ArenaAllocator.init(gpa); + defer arena_allocator.deinit(); + var allocating = std.io.Writer.Allocating.init(gpa); defer allocating.deinit(); - const io_w = &allocating.writer; - var c = try Compilation.compile(gpa, .{ + const io_w = &allocating.writer; + const arena = arena_allocator.allocator(); + + var c = try Module.compile(gpa, arena, .{ .source_bytes = source_bytes, .filename = "", .dump_writer = null, @@ -56,7 +62,7 @@ fn testEqual(source_bytes: [:0]const u8, expected_error: []const u8) !void { }); defer c.deinit(); - try std.testing.expect(c.errors.len > 0); - for (c.errors) |err| try c.renderError(io_w, err); + try std.testing.expect(c.errors.items.len > 0); + for (c.errors.items) |err| try c.renderError(io_w, err); return std.testing.expectEqualSlices(u8, expected_error, allocating.written()); }