Files
zig/test/standalone/test_obj_link_run/build.zig
T
Linus Groh 39fa831947 std: Remove a handful of things deprecated during the 0.15 release cycle
- std.Build.Step.Compile.root_module mutators -> std.Build.Module
- std.Build.Step.Compile.want_lto -> std.Build.Step.Compile.lto
- std.Build.Step.ConfigHeader.getOutput -> std.Build.Step.ConfigHeader.getOutputFile
- std.Build.Step.Run.max_stdio_size -> std.Build.Step.Run.stdio_limit
- std.enums.nameCast -> @field(E, tag_name) / @field(E, @tagName(tag))
- std.Io.tty.detectConfig -> std.Io.tty.Config.detect
- std.mem.trimLeft -> std.mem.trimStart
- std.mem.trimRight -> std.mem.trimEnd
- std.meta.intToEnum -> std.enums.fromInt
- std.meta.TagPayload -> @FieldType(U, @tagName(tag))
- std.meta.TagPayloadByName -> @FieldType(U, tag_name)
2025-11-27 20:17:04 +00:00

36 lines
1.1 KiB
Zig

pub fn build(b: *std.Build) void {
const is_windows = b.graph.host.result.os.tag == .windows;
const test_obj = b.addTest(.{
.emit_object = true,
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = b.graph.host,
}),
});
if (is_windows) {
test_obj.root_module.linkSystemLibrary("ntdll", .{});
test_obj.root_module.linkSystemLibrary("kernel32", .{});
test_obj.root_module.linkSystemLibrary("ws2_32", .{});
}
const test_exe_mod = b.createModule(.{
.root_source_file = null,
.target = b.graph.host,
});
test_exe_mod.addObject(test_obj);
const test_exe = b.addExecutable(.{
.name = "test",
.root_module = test_exe_mod,
});
const test_step = b.step("test", "Test the program");
b.default_step = test_step;
const test_run = b.addRunArtifact(test_exe);
test_run.addCheck(.{ .expect_stderr_match = "All 3 tests passed." });
test_step.dependOn(&test_run.step);
}
const std = @import("std");