#'builtin' has no member named 'test_functions'

1 messages · Page 1 of 1 (latest)

spark parcel
#

Looking at standard test_runner.zig, I see test functions are accessed via:

const test_fns = builtin.test_functions;

But when I try to do:

const std = @import("std");
const builtin = @import("builtin");

pub fn main() !void {
    std.debug.print("\nfound tests: {n}\n", .{builtin.test_functions.len});
}

test "simple test" {
    // ...
}

I get:

error: root struct of file 'builtin' has no member named 'test_functions'
    std.debug.print("\nfound tests: {}\n", .{builtin.test_functions});
                                             ~~~~~~~^~~~~~~~~~~~~~~

What am I doing wrong?

dusky prawn
#

that decl only exists for test builds