Commit 11b9933970

mlugg <mlugg@mlugg.co.uk>
2024-12-16 16:20:39
test-stack-traces: migrate from deprecated std.Build APIs
1 parent 6d4e2a9
Changed files (1)
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;