diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-02-20 18:36:04 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-02-20 18:36:04 -0500 |
| commit | 903127f36cf995d251a474438d3ecc6c6e0e30d2 (patch) | |
| tree | 10b45461abfb8933b2ac6c8121026490b22d1c6d /test/tests.zig | |
| parent | 0f016b368de2ac93a298ab771646931329062fb5 (diff) | |
| parent | e381a42de9c0f0c5439a926b0ac99026a0373f49 (diff) | |
| download | zig-903127f36cf995d251a474438d3ecc6c6e0e30d2.tar.gz zig-903127f36cf995d251a474438d3ecc6c6e0e30d2.zip | |
Merge remote-tracking branch 'origin/master' into sub-architecture-annihilation
Diffstat (limited to 'test/tests.zig')
| -rw-r--r-- | test/tests.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/tests.zig b/test/tests.zig index f12f7f83d4..e9fdde2e4b 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -650,8 +650,10 @@ pub const StackTracesContext = struct { const got: []const u8 = got_result: { var buf = try Buffer.initSize(b.allocator, 0); defer buf.deinit(); - var bytes = stderr.toSliceConst(); - if (bytes.len != 0 and bytes[bytes.len - 1] == '\n') bytes = bytes[0 .. bytes.len - 1]; + const bytes = if (stderr.endsWith("\n")) + stderr.toSliceConst()[0 .. stderr.len() - 1] + else + stderr.toSliceConst()[0..stderr.len()]; var it = mem.separate(bytes, "\n"); process_lines: while (it.next()) |line| { if (line.len == 0) continue; |
