Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

testThreadName

Thread.testThreadName
fn testThreadName(io: Io, thread: *Thread) !void

File

lib/std/Thread.zig:1609

Code

fn testThreadName(io: Io, thread: *Thread) !void {
    const testCases: []const []const u8 = &.{
        "mythread",
        &@as([max_name_len]u8, @splat('b')),
    };

    inline for (testCases) |tc| {
        try thread.setName(io, tc);

        var name_buffer: [max_name_len:0]u8 = undefined;

        const name = try thread.getName(&name_buffer);
        if (name) |value| {
            try std.testing.expectEqual(tc.len, value.len);
            try std.testing.expectEqualStrings(tc, value);
        }
    }
}