build-system: Replace deprecated usages of root_source_file on addTests (#8031)

Yet another low-hanging fruit
This commit is contained in:
Mitchell Hashimoto
2025-07-22 15:28:11 -07:00
committed by GitHub
10 changed files with 51 additions and 30 deletions

View File

@ -111,9 +111,11 @@ pub fn build(b: *std.Build) !void {
const test_exe = b.addTest(.{
.name = "test",
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
}),
});
test_exe.linkLibrary(lib);
const tests_run = b.addRunArtifact(test_exe);

View File

@ -29,9 +29,11 @@ pub fn build(b: *std.Build) !void {
const test_exe = b.addTest(.{
.name = "test",
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
}),
});
const tests_run = b.addRunArtifact(test_exe);
const test_step = b.step("test", "Run tests");

View File

@ -23,9 +23,11 @@ pub fn build(b: *std.Build) !void {
if (target.query.isNative()) {
test_exe = b.addTest(.{
.name = "test",
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
}),
});
const tests_run = b.addRunArtifact(test_exe.?);
const test_step = b.step("test", "Run tests");

View File

@ -20,9 +20,11 @@ pub fn build(b: *std.Build) !void {
if (target.query.isNative()) {
const test_exe = b.addTest(.{
.name = "test",
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
}),
});
test_exe.linkLibrary(lib);
const tests_run = b.addRunArtifact(test_exe);

View File

@ -43,9 +43,11 @@ pub fn build(b: *std.Build) !void {
const test_exe = b.addTest(.{
.name = "test",
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
}),
});
{

View File

@ -98,9 +98,11 @@ pub fn build(b: *std.Build) !void {
{
const test_exe = b.addTest(.{
.name = "test",
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
}),
});
test_exe.linkLibrary(lib);

View File

@ -54,9 +54,11 @@ pub fn build(b: *std.Build) !void {
{
const test_exe = b.addTest(.{
.name = "test",
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
}),
});
if (target.result.os.tag.isDarwin()) {
try apple_sdk.addPaths(b, test_exe);

View File

@ -23,9 +23,11 @@ pub fn build(b: *std.Build) !void {
if (target.query.isNative()) {
test_exe = b.addTest(.{
.name = "test",
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
}),
});
const tests_run = b.addRunArtifact(test_exe.?);
const test_step = b.step("test", "Run tests");

View File

@ -15,9 +15,11 @@ pub fn build(b: *std.Build) !void {
if (target.query.isNative()) {
const test_exe = b.addTest(.{
.name = "test",
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
}),
});
test_exe.linkLibrary(lib);
const tests_run = b.addRunArtifact(test_exe);

View File

@ -12,9 +12,12 @@ pub fn build(b: *std.Build) !void {
});
const unit_tests = b.addTest(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.name = "test",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
}),
});
unit_tests.linkLibC();