diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-02-14 10:27:44 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-02-14 10:27:44 -0500 |
| commit | a8b36fbe34e4acfea1fcb348fbed321b05611fd3 (patch) | |
| tree | 23f489f85c427a003577f5c40b74201ba8c85ddb /lib/std/fs/path.zig | |
| parent | cdc5070f216a924d24588b8d0fe06400e036e6bf (diff) | |
| parent | 40b9db7cad6f876bb3e8fa32d7b32bbd4bc983ea (diff) | |
| download | zig-a8b36fbe34e4acfea1fcb348fbed321b05611fd3.tar.gz zig-a8b36fbe34e4acfea1fcb348fbed321b05611fd3.zip | |
Merge remote-tracking branch 'origin/master' into llvm10
Diffstat (limited to 'lib/std/fs/path.zig')
| -rw-r--r-- | lib/std/fs/path.zig | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/std/fs/path.zig b/lib/std/fs/path.zig index f6f34585be..5d1c775629 100644 --- a/lib/std/fs/path.zig +++ b/lib/std/fs/path.zig @@ -89,16 +89,14 @@ pub fn joinPosix(allocator: *Allocator, paths: []const []const u8) ![]u8 { } fn testJoinWindows(paths: []const []const u8, expected: []const u8) void { - var buf: [1024]u8 = undefined; - const a = &std.heap.FixedBufferAllocator.init(&buf).allocator; - const actual = joinWindows(a, paths) catch @panic("fail"); + const actual = joinWindows(testing.allocator, paths) catch @panic("fail"); + defer testing.allocator.free(actual); testing.expectEqualSlices(u8, expected, actual); } fn testJoinPosix(paths: []const []const u8, expected: []const u8) void { - var buf: [1024]u8 = undefined; - const a = &std.heap.FixedBufferAllocator.init(&buf).allocator; - const actual = joinPosix(a, paths) catch @panic("fail"); + const actual = joinPosix(testing.allocator, paths) catch @panic("fail"); + defer testing.allocator.free(actual); testing.expectEqualSlices(u8, expected, actual); } |
