From d90b260fcf9d0b6523e465c4eadfed8000b2e057 Mon Sep 17 00:00:00 2001 From: = Date: Sun, 3 Dec 2023 22:51:29 +0100 Subject: [PATCH] Mark string methods as public. Also, fix the associated tests. Apparently printing to stdout caused them to fail ? --- uuid.zig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/uuid.zig b/uuid.zig index 09c6af0..0aac72a 100644 --- a/uuid.zig +++ b/uuid.zig @@ -22,12 +22,12 @@ pub const UUID = struct { return uuid; } - fn to_string(self: UUID,slice: []u8) void { - var string:[36]u8 = format_uuid(self); + pub fn to_string(self: UUID, slice: []u8) void { + var string: [36]u8 = format_uuid(self); std.mem.copy(u8, slice, &string); } - fn format_uuid(self: UUID) [36]u8 { + pub fn format_uuid(self: UUID) [36]u8 { var buf: [36]u8 = undefined; buf[8] = '-'; buf[13] = '-'; @@ -161,8 +161,8 @@ test "check to_string works" { uuid1.to_string(&string1); uuid1.to_string(&string2); - std.debug.print("\nUUID {s} \n", .{uuid1}); - std.debug.print("\nFirst call to_string {s} \n", .{string1}); - std.debug.print("Second call to_string {s} \n", .{string2}); + std.log.debug("\nUUID {s} \n", .{uuid1}); + std.log.debug("\nFirst call to_string {s} \n", .{string1}); + std.log.debug("Second call to_string {s} \n", .{string2}); try testing.expectEqual(string1, string2); }