Skip to content

Commit

Permalink
Merge branch 'kristate-zig-backport-std.mem.join'
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrk committed Feb 7, 2019
2 parents 7fc99c3 + 38a7716 commit a0590bd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions std/mem.zig
Expand Up @@ -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" {
Expand Down

0 comments on commit a0590bd

Please sign in to comment.