From aa56929ff7e03cd563d951782ba72e06be2a6935 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sat, 30 Jul 2022 00:31:14 +0200 Subject: Reworked io functions to take a configurable reader or writer --- src/main.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main.zig') diff --git a/src/main.zig b/src/main.zig index ff4f09b..4eb46a3 100644 --- a/src/main.zig +++ b/src/main.zig @@ -15,10 +15,10 @@ pub fn main() anyerror!void { var file = try std.fs.cwd().openFile("mycology/sanity.bf", .{}); defer file.close(); - var i = try interpreter.Interpreter.init(gpa.allocator(), file.reader(), io.defaultFunctions, args); + var i = try interpreter.Interpreter.init(gpa.allocator(), file.reader(), args); defer i.deinit(); - std.os.exit(@intCast(u8, try i.run())); + std.os.exit(@intCast(u8, try i.run(io.context(std.io.getStdIn().reader(), std.io.getStdOut().writer())))); } test "all" { @@ -28,7 +28,7 @@ test "sanity" { var file = try std.fs.cwd().openFile("mycology/sanity.bf", .{}); defer file.close(); const args = [_][]const u8{"sanity"}; - var i = try interpreter.Interpreter.init(std.testing.allocator, file.reader(), io.defaultFunctions, args[0..]); + var i = try interpreter.Interpreter.init(std.testing.allocator, file.reader(), args[0..]); defer i.deinit(); - try std.testing.expectEqual(try i.run(), 0); + try std.testing.expectEqual(try i.run(io.context(std.io.getStdIn().reader(), std.io.getStdOut().writer())), 0); } -- cgit v1.2.3