From b6129f6cee45bd90b7ac97b8839dc28d21bedcb2 Mon Sep 17 00:00:00 2001 From: KeithBrown39423 Date: Tue, 11 Jun 2024 20:49:16 -0500 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Fix=20failing=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/testing.zig | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/testing.zig b/src/testing.zig index 1e52d5e..560f320 100644 --- a/src/testing.zig +++ b/src/testing.zig @@ -7,8 +7,8 @@ test "UUID v1" { const uuid = zuid.new.v1(); const version = uuid.version; const variant = uuid.variant; - const urn: [36]u8 = undefined; - _ = try std.fmt.bufPrint(&urn, "{s}", .{uuid}); + var urn: [36]u8 = undefined; + _ = std.fmt.bufPrint(&urn, "{s}", .{uuid}) catch unreachable; try expect(urn.len == 36); try expect(urn[14] == '1' and version == 1); @@ -26,8 +26,8 @@ test "UUID v3" { const uuid = zuid.new.v3(namespace, url); const version = uuid.version; const variant = uuid.variant; - const urn: [36]u8 = undefined; - _ = try std.fmt.bufPrint(&urn, "{s}", .{uuid}); + var urn: [36]u8 = undefined; + _ = std.fmt.bufPrint(&urn, "{s}", .{uuid}) catch unreachable; try expect(std.mem.eql(u8, str, &urn)); try expect(urn.len == 36); @@ -41,8 +41,8 @@ test "UUID v4" { const uuid = zuid.new.v4(); const version = uuid.version; const variant = uuid.variant; - const urn: [36]u8 = undefined; - _ = try std.fmt.bufPrint(&urn, "{s}", .{uuid}); + var urn: [36]u8 = undefined; + _ = std.fmt.bufPrint(&urn, "{s}", .{uuid}) catch unreachable; try expect(urn.len == 36); try expect(urn[14] == '4' and version == 4); @@ -60,8 +60,8 @@ test "UUID v5" { const uuid = zuid.new.v5(namespace, url); const version = uuid.version; const variant = uuid.variant; - const urn: [36]u8 = undefined; - _ = try std.fmt.bufPrint(&urn, "{s}", .{uuid}); + var urn: [36]u8 = undefined; + _ = std.fmt.bufPrint(&urn, "{s}", .{uuid}) catch unreachable; try expect(std.mem.eql(u8, str, &urn)); try expect(urn.len == 36); @@ -75,8 +75,8 @@ test "UUID v6" { const uuid = zuid.new.v6(); const version = uuid.version; const variant = uuid.variant; - const urn: [36]u8 = undefined; - _ = try std.fmt.bufPrint(&urn, "{s}", .{uuid}); + var urn: [36]u8 = undefined; + _ = std.fmt.bufPrint(&urn, "{s}", .{uuid}) catch unreachable; try expect(urn.len == 36); try expect(urn[14] == '6' and version == 6); @@ -89,8 +89,8 @@ test "UUID v7" { const uuid = zuid.new.v7(); const version = uuid.version; const variant = uuid.variant; - const urn: [36]u8 = undefined; - _ = try std.fmt.bufPrint(&urn, "{s}", .{uuid}); + var urn: [36]u8 = undefined; + _ = std.fmt.bufPrint(&urn, "{s}", .{uuid}) catch unreachable; try expect(urn.len == 36); try expect(urn[14] == '7' and version == 7); @@ -107,8 +107,8 @@ test "UUID v8" { const uuid = zuid.new.v8(custom_a, custom_b, custom_c); const version = uuid.version; const variant = uuid.variant; - const urn: [36]u8 = undefined; - _ = try std.fmt.bufPrint(&urn, "{s}", .{uuid}); + var urn: [36]u8 = undefined; + _ = std.fmt.bufPrint(&urn, "{s}", .{uuid}) catch unreachable; try expect(urn.len == 36); try expect(urn[14] == '8' and version == 8);