diff options
-rw-r--r-- | build.zig | 3 | ||||
-rw-r--r-- | src/db.zig | 7 | ||||
-rw-r--r-- | src/main.zig | 6 |
3 files changed, 15 insertions, 1 deletions
@@ -31,6 +31,9 @@ pub fn build(b: *std.Build) void { .target = target, .optimize = optimize, }); + exe_unit_tests.linkSystemLibrary("duckdb"); + exe_unit_tests.linkLibC(); + exe_unit_tests.linkLibCpp(); const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); const test_step = b.step("test", "Run unit tests"); test_step.dependOn(&run_exe_unit_tests.step); @@ -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()); +} |