diff --git a/std/mem.zig b/std/mem.zig index 48d1cb930cdc0c72fd3174ba31fcb8ea2c7786a9..a6cbae744fc7e6e2f15bbd10e3e1ff6cf7e32840 100644 --- a/std/mem.zig +++ b/std/mem.zig @@ -911,8 +911,11 @@ pub fn join(allocator: *Allocator, separator: []const u8, slices: []const []cons } test "mem.join" { - assert(eql(u8, try join(debug.global_allocator, ",", [][]const u8{ "a", "b", "c" }), "a,b,c")); - assert(eql(u8, try join(debug.global_allocator, ",", [][]const u8{"a"}), "a")); + var buf: [1024]u8 = undefined; + const a = &std.heap.FixedBufferAllocator.init(&buf).allocator; + assert(eql(u8, try join(a, ",", [][]const u8{ "a", "b", "c" }), "a,b,c")); + assert(eql(u8, try join(a, ",", [][]const u8{"a"}), "a")); + assert(eql(u8, try join(a, ",", [][]const u8{ "a", "", "b", "", "c" }), "a,,b,,c")); } test "testStringEquality" {