mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 14:25:16 +00:00
Fixes #13970. This fix makes test runners resolve package paths relative to the directory the test runner is in. This means it is not possible to import a file from outside the file tree root at the directory containing the test runner.
22 lines
686 B
Zig
22 lines
686 B
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const test1 = b.addTest(.{
|
|
.root_source_file = .{ .path = "test_root/empty.zig" },
|
|
});
|
|
const test2 = b.addTest(.{
|
|
.root_source_file = .{ .path = "src/empty.zig" },
|
|
});
|
|
const test3 = b.addTest(.{
|
|
.root_source_file = .{ .path = "empty.zig" },
|
|
});
|
|
test1.setTestRunner("src/main.zig");
|
|
test2.setTestRunner("src/main.zig");
|
|
test3.setTestRunner("src/main.zig");
|
|
|
|
const test_step = b.step("test", "Test package path resolution of custom test runner");
|
|
test_step.dependOn(&test1.step);
|
|
test_step.dependOn(&test2.step);
|
|
test_step.dependOn(&test3.step);
|
|
}
|