aboutsummaryrefslogtreecommitdiff
path: root/lib/std/testing.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2025-12-22 12:50:46 +0100
committerAlex Rønne Petersen <alex@alexrp.com>2025-12-22 12:50:46 +0100
commitaa0249d74e573742db3567f589fc6e4a00e1fff8 (patch)
treecce61cb7f02072d205a12ae451922f0bf09c13ce /lib/std/testing.zig
parent6b9125cbe662d530160e0732c856aa0da86894c0 (diff)
parent02c5f05e2f0e8e786f0530014e35c1520efd0084 (diff)
downloadzig-aa0249d74e573742db3567f589fc6e4a00e1fff8.tar.gz
zig-aa0249d74e573742db3567f589fc6e4a00e1fff8.zip
Merge pull request 'std.ascii: rename indexOf functions to find' (#30101) from adria/zig:indexof-find into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30101 Reviewed-by: Andrew Kelley <andrewrk@noreply.codeberg.org> Reviewed-by: mlugg <mlugg@noreply.codeberg.org>
Diffstat (limited to 'lib/std/testing.zig')
-rw-r--r--lib/std/testing.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/testing.zig b/lib/std/testing.zig
index 2aa282d110..186cafad59 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)