Something went wrong. Try again.
Dev fork of jetzig jetzig.dev
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738const std = @import("std");
const Build = std.Build;const Module = Build.Module;
pub fn import(name: []const u8, module: *Module) Module.Import { return .{ .name = name, .module = module };}
pub fn addTest(b: *Build, name: []const u8, mod: *Module) void { const step = if (b.top_level_steps.get("test")) |tls| &tls.step else b.step("test", "Run tests"); const test_module = b.addTest(.{ .name = name, .root_module = mod, .filters = testFilters(b), }); const artifact = b.addRunArtifact(test_module); step.dependOn(&artifact.step);}
fn testFilters(b: *Build) []const []const u8 { if (!b.available_options_map.contains("test-filter")) return b.option( []const []const u8, "test-filter", "Skip tests that do not match any filter", ) orelse &.{};
const opt = b.user_input_options.getPtr("test-filter") orelse return &.{}; return switch (opt.*) { .list => |l| l.items, .scalar => |s| b.allocator.dupe([]const u8, &.{s}) catch @panic("OOM"), else => &.{}, };}