aboutsummaryrefslogtreecommitdiff
path: root/test/tests.zig
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2020-02-20 13:14:19 +0100
committerLemonBoy <thatlemon@gmail.com>2020-02-20 13:14:19 +0100
commita3855477866bbe59b0583ca07170a981e7ca5839 (patch)
tree04804df2f7778cfce9c535c99d718c9871fe6eda /test/tests.zig
parentc49ab049c590d51661654084062f9f067c73fda0 (diff)
downloadzig-a3855477866bbe59b0583ca07170a981e7ca5839.tar.gz
zig-a3855477866bbe59b0583ca07170a981e7ca5839.zip
ir: Compile error on result_loc type mismatch w/ slicing
Closes #4508
Diffstat (limited to 'test/tests.zig')
-rw-r--r--test/tests.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/tests.zig b/test/tests.zig
index f079b4664c..64a46abbc2 100644
--- a/test/tests.zig
+++ b/test/tests.zig
@@ -677,8 +677,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;