diff options
author | Julien Dessaux | 2022-08-03 22:32:09 +0200 |
---|---|---|
committer | Julien Dessaux | 2022-08-03 22:32:09 +0200 |
commit | e5eca00399e68ceec72b6a8c9e73b2052799bcd8 (patch) | |
tree | 694d0597144d12ca7eb6131aa9b76318eb4bb146 /src/main.zig | |
parent | Improved main test to check for expected output (diff) | |
download | zigfunge98-e5eca00399e68ceec72b6a8c9e73b2052799bcd8.tar.gz zigfunge98-e5eca00399e68ceec72b6a8c9e73b2052799bcd8.tar.bz2 zigfunge98-e5eca00399e68ceec72b6a8c9e73b2052799bcd8.zip |
Implemented decimalInput io function
Diffstat (limited to '')
-rw-r--r-- | src/main.zig | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main.zig b/src/main.zig index e83a2fd..b85aa6f 100644 --- a/src/main.zig +++ b/src/main.zig @@ -18,7 +18,9 @@ pub fn main() anyerror!void { var i = try interpreter.Interpreter.init(gpa.allocator(), file.reader(), args); defer i.deinit(); - std.os.exit(@intCast(u8, try i.run(io.context(std.io.getStdIn().reader(), std.io.getStdOut().writer())))); + var ioContext = try io.context(gpa.allocator(), std.io.getStdIn().reader(), std.io.getStdOut().writer()); + defer ioContext.deinit(); + std.os.exit(@intCast(u8, try i.run(ioContext))); } test "all" { @@ -34,6 +36,8 @@ test "sanity" { const args = [_][]const u8{"sanity"}; var i = try interpreter.Interpreter.init(std.testing.allocator, file.reader(), args[0..]); defer i.deinit(); - try std.testing.expectEqual(try i.run(io.context(stdin.reader(), stdout.writer())), 0); + var ioContext = try io.context(std.testing.allocator, stdin.reader(), stdout.writer()); + defer ioContext.deinit(); + try std.testing.expectEqual(try i.run(ioContext), 0); try std.testing.expectEqual(std.mem.eql(u8, stdout.items, expected), true); } |