diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-04-01 12:44:45 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-04-01 13:30:07 -0400 |
| commit | 2e806682f451efd26bef0486ddd980ab60de0fa1 (patch) | |
| tree | 7962a47dd9df3976a7aa8c8c5ad754d27dd55ba4 /test/tests.zig | |
| parent | 553f0e0546e0ceecf2ff735443d9a2c2f282b8db (diff) | |
| download | zig-2e806682f451efd26bef0486ddd980ab60de0fa1.tar.gz zig-2e806682f451efd26bef0486ddd980ab60de0fa1.zip | |
(breaking) std.Buffer => std.ArrayListSentineled(u8, 0)
This new name (and the fact that it is a function returning a type) will
make it more clear which use cases are better suited for ArrayList and
which are better suited for ArrayListSentineled.
Also for consistency with ArrayList,
* `append` => `appendSlice`
* `appendByte` => `append`
Thanks daurnimator for pointing out the confusion of std.Buffer.
Diffstat (limited to 'test/tests.zig')
| -rw-r--r-- | test/tests.zig | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/test/tests.zig b/test/tests.zig index 28459d84c1..7f3e55ec7a 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -4,7 +4,6 @@ const debug = std.debug; const warn = debug.warn; const build = std.build; const CrossTarget = std.zig.CrossTarget; -const Buffer = std.Buffer; const io = std.io; const fs = std.fs; const mem = std.mem; @@ -640,7 +639,7 @@ pub const StackTracesContext = struct { // - replace address with symbolic string // - skip empty lines const got: []const u8 = got_result: { - var buf = try Buffer.initSize(b.allocator, 0); + var buf = ArrayList(u8).init(b.allocator); defer buf.deinit(); if (stderr.len != 0 and stderr[stderr.len - 1] == '\n') stderr = stderr[0 .. stderr.len - 1]; var it = mem.separate(stderr, "\n"); @@ -652,21 +651,21 @@ pub const StackTracesContext = struct { var pos: usize = if (std.Target.current.os.tag == .windows) 2 else 0; for (delims) |delim, i| { marks[i] = mem.indexOfPos(u8, line, pos, delim) orelse { - try buf.append(line); - try buf.append("\n"); + try buf.appendSlice(line); + try buf.appendSlice("\n"); continue :process_lines; }; pos = marks[i] + delim.len; } pos = mem.lastIndexOfScalar(u8, line[0..marks[0]], fs.path.sep) orelse { - try buf.append(line); - try buf.append("\n"); + try buf.appendSlice(line); + try buf.appendSlice("\n"); continue :process_lines; }; - try buf.append(line[pos + 1 .. marks[2] + delims[2].len]); - try buf.append(" [address]"); - try buf.append(line[marks[3]..]); - try buf.append("\n"); + try buf.appendSlice(line[pos + 1 .. marks[2] + delims[2].len]); + try buf.appendSlice(" [address]"); + try buf.appendSlice(line[marks[3]..]); + try buf.appendSlice("\n"); } break :got_result buf.toOwnedSlice(); }; |
