aboutsummaryrefslogtreecommitdiff
path: root/test/tests.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-08-18 19:40:08 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-08-19 16:45:16 -0700
commita85f41ec2c38eff7e64ba32c76c5a60b48274a8a (patch)
tree402b34d085835205fa9ff6fbef1b5360646ff91b /test/tests.zig
parent10b95d89f878c8ba780f573d65604ef79d6cbd9a (diff)
downloadzig-a85f41ec2c38eff7e64ba32c76c5a60b48274a8a.tar.gz
zig-a85f41ec2c38eff7e64ba32c76c5a60b48274a8a.zip
test-stack-traces: relax parsing rules
* accept forward and backward slashes in file paths * strip multiple extensions; e.g. if the basename is "test.exe.obj" then it strips to "test".
Diffstat (limited to 'test/tests.zig')
-rw-r--r--test/tests.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/tests.zig b/test/tests.zig
index 5a58daecaa..a622521182 100644
--- a/test/tests.zig
+++ b/test/tests.zig
@@ -923,7 +923,7 @@ pub const StackTracesContext = struct {
pos = marks[i] + delim.len;
}
// locate source basename
- pos = mem.lastIndexOfScalar(u8, line[0..marks[0]], fs.path.sep) orelse {
+ pos = mem.lastIndexOfAny(u8, line[0..marks[0]], "\\/") orelse {
// unexpected pattern: emit raw line and cont
try buf.appendSlice(line);
try buf.appendSlice("\n");
@@ -935,9 +935,9 @@ pub const StackTracesContext = struct {
try buf.appendSlice(line[pos + 1 .. marks[2] + delims[2].len]);
try buf.appendSlice(" [address]");
if (self.mode == .Debug) {
- if (mem.lastIndexOfScalar(u8, line[marks[4]..marks[5]], '.')) |idot| {
- // On certain platforms (windows) or possibly depending on how we choose to link main
- // the object file extension may be present so we simply strip any extension.
+ // On certain platforms (windows) or possibly depending on how we choose to link main
+ // the object file extension may be present so we simply strip any extension.
+ if (mem.indexOfScalar(u8, line[marks[4]..marks[5]], '.')) |idot| {
try buf.appendSlice(line[marks[3] .. marks[4] + idot]);
try buf.appendSlice(line[marks[5]..]);
} else {