aboutsummaryrefslogtreecommitdiff
path: root/src/interpreter.zig
diff options
context:
space:
mode:
authorJulien Dessaux2022-08-18 20:52:07 +0200
committerJulien Dessaux2022-08-18 20:52:07 +0200
commit800c61339432258e8dad0ca7c56ddface84cab87 (patch)
tree97a170c70284fa2c9bc2145f8925acb135cccbde /src/interpreter.zig
parentFixed bugs reported by the mycology test suite (diff)
downloadzigfunge98-800c61339432258e8dad0ca7c56ddface84cab87.tar.gz
zigfunge98-800c61339432258e8dad0ca7c56ddface84cab87.tar.bz2
zigfunge98-800c61339432258e8dad0ca7c56ddface84cab87.zip
Made the timestamp function mockable for testing purposes
Diffstat (limited to 'src/interpreter.zig')
-rw-r--r--src/interpreter.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/interpreter.zig b/src/interpreter.zig
index c378c11..9fb98a1 100644
--- a/src/interpreter.zig
+++ b/src/interpreter.zig
@@ -13,13 +13,13 @@ pub const Interpreter = struct {
self.field.deinit();
self.allocator.destroy(self);
}
- pub fn init(allocator: std.mem.Allocator, fileReader: anytype, args: []const []const u8, env: []const [*:0]const u8) !*Interpreter {
+ pub fn init(allocator: std.mem.Allocator, fileReader: anytype, timestamp: fn () i64, args: []const []const u8, env: []const [*:0]const u8) !*Interpreter {
var i = try allocator.create(Interpreter);
errdefer allocator.destroy(i);
i.allocator = allocator;
i.field = try field.Field.init_from_reader(allocator, fileReader);
errdefer i.field.deinit();
- i.pointer = try pointer.Pointer.init(std.testing.allocator, i.field, args, env);
+ i.pointer = try pointer.Pointer.init(std.testing.allocator, i.field, timestamp, args, env);
errdefer i.pointer.deinit();
return i;
}