diff options
author | Julien Dessaux | 2022-07-30 00:31:14 +0200 |
---|---|---|
committer | Julien Dessaux | 2022-07-30 00:31:14 +0200 |
commit | aa56929ff7e03cd563d951782ba72e06be2a6935 (patch) | |
tree | 54501fa0e6af07581d998ebc5e2fe7fa373828a7 /src/main.zig | |
parent | Removed useless imports (diff) | |
download | zigfunge98-aa56929ff7e03cd563d951782ba72e06be2a6935.tar.gz zigfunge98-aa56929ff7e03cd563d951782ba72e06be2a6935.tar.bz2 zigfunge98-aa56929ff7e03cd563d951782ba72e06be2a6935.zip |
Reworked io functions to take a configurable reader or writer
Diffstat (limited to 'src/main.zig')
-rw-r--r-- | src/main.zig | 8 |
1 files changed, 4 insertions, 4 deletions
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); } |