Skip to content

Commit 84b0706

Browse files
committed
change tests to comptime checks
1 parent cb9fa54 commit 84b0706

File tree

2 files changed

+8
-24
lines changed

2 files changed

+8
-24
lines changed

build.zig

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,9 @@ const std = @import("std");
22
const builtin = @import("builtin");
33

44
pub fn build(b: *std.Build) !void {
5-
const optimize = b.standardOptimizeOption(.{});
6-
const target = b.standardTargetOptions(.{});
7-
85
_ = b.addModule("root", .{
96
.root_source_file = b.path("src/zwin32.zig"),
107
});
11-
12-
const test_step = b.step("test", "Run zwin32 tests");
13-
14-
const tests = b.addTest(.{
15-
.name = "zwin32-tests",
16-
.root_source_file = b.path("src/zwin32.zig"),
17-
.target = target,
18-
.optimize = optimize,
19-
});
20-
21-
b.installArtifact(tests);
22-
23-
test_step.dependOn(&b.addRunArtifact(tests).step);
248
}
259

2610
pub fn install_xaudio2(

src/zwin32.zig

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
const std = @import("std");
2+
const panic = std.debug.panic;
3+
const assert = std.debug.assert;
4+
5+
comptime {
6+
std.testing.refAllDeclsRecursive(@This());
7+
}
8+
19
pub const w32 = @import("w32.zig");
210
pub const dwrite = @import("dwrite.zig");
311
pub const dxgi = @import("dxgi.zig");
@@ -19,17 +27,9 @@ pub const xinput = @import("xinput.zig");
1927
pub const dds_loader = @import("dds_loader.zig");
2028
pub const d3dcompiler = @import("d3dcompiler.zig");
2129

22-
test {
23-
std.testing.refAllDeclsRecursive(@This());
24-
}
25-
2630
const HRESULT = w32.HRESULT;
2731
const S_OK = w32.S_OK;
2832

29-
const std = @import("std");
30-
const panic = std.debug.panic;
31-
const assert = std.debug.assert;
32-
3333
// TODO: Handle more error codes from https://docs.microsoft.com/en-us/windows/win32/com/com-error-codes-10
3434
pub const HResultError =
3535
w32.MiscError || w32.Error || dxgi.Error || d3d12.Error || d3d11.Error ||

0 commit comments

Comments
 (0)