diff options
| author | Adrià Arrufat <adria.arrufat@gmail.com> | 2025-12-04 11:10:30 +0900 |
|---|---|---|
| committer | mlugg <mlugg@noreply.codeberg.org> | 2025-12-05 14:31:27 +0100 |
| commit | 02c5f05e2f0e8e786f0530014e35c1520efd0084 (patch) | |
| tree | 38b298fa7849d78c7d02294e7bd3b7aed2b7e52c /lib/std/testing.zig | |
| parent | 1a420a8dca34db8b632b0451d022ef92f78f96ac (diff) | |
| download | zig-02c5f05e2f0e8e786f0530014e35c1520efd0084.tar.gz zig-02c5f05e2f0e8e786f0530014e35c1520efd0084.zip | |
std: replace usages of std.mem.indexOf with std.mem.find
Diffstat (limited to 'lib/std/testing.zig')
| -rw-r--r-- | lib/std/testing.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/testing.zig b/lib/std/testing.zig index d12ac3bf21..ee2aef36be 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -643,7 +643,7 @@ pub fn tmpDir(opts: std.fs.Dir.OpenOptions) TmpDir { } pub fn expectEqualStrings(expected: []const u8, actual: []const u8) !void { - if (std.mem.indexOfDiff(u8, actual, expected)) |diff_index| { + if (std.mem.findDiff(u8, actual, expected)) |diff_index| { if (@inComptime()) { @compileError(std.fmt.comptimePrint("\nexpected:\n{s}\nfound:\n{s}\ndifference starts at index {d}", .{ expected, actual, diff_index, @@ -992,7 +992,7 @@ fn printIndicatorLine(source: []const u8, indicator_index: usize) void { line_begin + 1 else 0; - const line_end_index = if (std.mem.indexOfScalar(u8, source[indicator_index..], '\n')) |line_end| + const line_end_index = if (std.mem.findScalar(u8, source[indicator_index..], '\n')) |line_end| (indicator_index + line_end) else source.len; @@ -1008,7 +1008,7 @@ fn printIndicatorLine(source: []const u8, indicator_index: usize) void { fn printWithVisibleNewlines(source: []const u8) void { var i: usize = 0; - while (std.mem.indexOfScalar(u8, source[i..], '\n')) |nl| : (i += nl + 1) { + while (std.mem.findScalar(u8, source[i..], '\n')) |nl| : (i += nl + 1) { printLine(source[i..][0..nl]); } print("{s}␃\n", .{source[i..]}); // End of Text symbol (ETX) |
