diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-07-29 22:07:29 +0200 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-07-29 22:07:29 +0200 |
commit | cf908fa9cadcf4bc29d65bfa89f1ec1b5d7c2d4f (patch) | |
tree | d5d73273592266b5de5b1379a4bd89ae1ac6edf4 /src | |
parent | a392744cc995d7c26730d2f1626612ad4739ca9b (diff) |
Add testing for Db
Diffstat (limited to 'src')
-rw-r--r-- | src/db.zig | 7 | ||||
-rw-r--r-- | src/main.zig | 6 |
2 files changed, 12 insertions, 1 deletions
@@ -38,3 +38,10 @@ pub fn deinit(self: *Self) void{ pub fn connect(self: Self) !Connection { return Connection.init(self); } + +test "Open and connect" { + var database = try Self.init(":memory:"); + defer database.deinit(); + var connection = try database.connect(); + defer connection.deinit(); +} diff --git a/src/main.zig b/src/main.zig index df11bea..14e1810 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,5 +1,5 @@ const std = @import("std"); -const Db = @import("./db.zig"); +pub const Db = @import("./db.zig"); pub fn main() !void { var database = try Db.init(":memory:"); @@ -7,3 +7,7 @@ pub fn main() !void { var connection = try database.connect(); defer connection.deinit(); } + +test { + std.testing.refAllDecls(@This()); +} |