diff options
| author | David Pflug <david@pflug.io> | 2025-12-13 12:01:10 -0500 |
|---|---|---|
| committer | David Pflug <david@pflug.io> | 2025-12-13 12:01:10 -0500 |
| commit | 7d1184a140d35973797078995c82b2cd586e4026 (patch) | |
| tree | 583e8acadd9cb7d0fd9c9d5fb89f786ff8b41235 | |
| parent | e767de2337c9600e83884749b403886b8b2a8f6a (diff) | |
Update to new Zig mem trim API
trimRight is now trimEnd
| -rw-r--r-- | build.zig | 8 | ||||
| -rw-r--r-- | test/tests.zig | 2 |
2 files changed, 5 insertions, 5 deletions
@@ -473,7 +473,7 @@ const ZiglingStep = struct { .Exited => |code| { if (code != 0) { // The test failed. - const stderr = std.mem.trimRight(u8, result.stderr, " \r\n"); + const stderr = std.mem.trimEnd(u8, result.stderr, " \r\n"); return self.step.fail("\n{s}", .{stderr}); } @@ -594,7 +594,7 @@ pub fn trimLines(allocator: std.mem.Allocator, buf: []const u8) ![]const u8 { var iter = std.mem.splitSequence(u8, buf, " \n"); while (iter.next()) |line| { // TODO: trimming CR characters is probably not necessary. - const data = std.mem.trimRight(u8, line, " \r"); + const data = std.mem.trimEnd(u8, line, " \r"); try list.appendSlice(allocator, data); try list.append(allocator, '\n'); } @@ -603,7 +603,7 @@ pub fn trimLines(allocator: std.mem.Allocator, buf: []const u8) ![]const u8 { // Remove the trailing LF character, that is always present in the exercise // output. - return std.mem.trimRight(u8, result, "\n"); + return std.mem.trimEnd(u8, result, "\n"); } /// Prints a message to stderr. @@ -655,7 +655,7 @@ fn validate_exercises() bool { var iter = std.mem.splitScalar(u8, ex.output, '\n'); while (iter.next()) |line| { - const output = std.mem.trimRight(u8, line, " \r"); + const output = std.mem.trimEnd(u8, line, " \r"); if (output.len != line.len) { print("exercise {s} output field lines have trailing whitespace\n", .{ ex.main_file, diff --git a/test/tests.zig b/test/tests.zig index a242ca6..9a8e9e9 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -303,7 +303,7 @@ fn check( fn readLine(reader: *fs.File.Reader, buf: []u8) !?[]const u8 { try reader.interface.readSliceAll(buf); - return mem.trimRight(u8, buf, " \r\n"); + return mem.trimEnd(u8, buf, " \r\n"); } /// Fails with a custom error message. |
