commit 11b99339702fc91bfab912fb4ddc45995bdbfdb0 (tree)
parent 6d4e2a9171a2616f6a744f8f842fb4042b868fc8
Author: mlugg <mlugg@mlugg.co.uk>
Date: Mon, 16 Dec 2024 15:20:39 +0000
test-stack-traces: migrate from deprecated std.Build APIs
Diffstat:
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/test/src/StackTrace.zig b/test/src/StackTrace.zig
@@ -44,9 +44,9 @@ fn addExpect(
for (mode_config.exclude_os) |tag| if (tag == builtin.os.tag) return;
const b = self.b;
- const annotated_case_name = fmt.allocPrint(b.allocator, "check {s} ({s})", .{
+ const annotated_case_name = b.fmt("check {s} ({s})", .{
name, @tagName(optimize_mode),
- }) catch @panic("OOM");
+ });
for (self.test_filters) |test_filter| {
if (mem.indexOf(u8, annotated_case_name, test_filter)) |_| break;
} else if (self.test_filters.len > 0) return;
@@ -55,10 +55,12 @@ fn addExpect(
const source_zig = write_files.add("source.zig", source);
const exe = b.addExecutable(.{
.name = "test",
- .root_source_file = source_zig,
- .optimize = optimize_mode,
- .target = b.graph.host,
- .error_tracing = mode_config.error_tracing,
+ .root_module = b.createModule(.{
+ .root_source_file = source_zig,
+ .optimize = optimize_mode,
+ .target = b.graph.host,
+ .error_tracing = mode_config.error_tracing,
+ }),
});
const run = b.addRunArtifact(exe);
@@ -83,5 +85,4 @@ const std = @import("std");
const builtin = @import("builtin");
const Step = std.Build.Step;
const OptimizeMode = std.builtin.OptimizeMode;
-const fmt = std.fmt;
const mem = std.mem;