Commit 6038192fad
Changed files (1)
lib
std
tar
lib/std/tar/Writer.zig
@@ -346,8 +346,8 @@ pub const Header = extern struct {
for (cases) |case| {
var header = Header.init(.regular);
try header.setPath(case.in[0], case.in[1]);
- try testing.expectEqualStrings(case.out[0], str(&header.prefix));
- try testing.expectEqualStrings(case.out[1], str(&header.name));
+ try testing.expectEqualStrings(case.out[0], std.mem.sliceTo(&header.prefix, 0));
+ try testing.expectEqualStrings(case.out[1], std.mem.sliceTo(&header.name, 0));
}
const error_cases = [_]struct {
@@ -370,14 +370,6 @@ pub const Header = extern struct {
);
}
}
-
- // Breaks string on first null character.
- fn str(s: []const u8) []const u8 {
- for (s, 0..) |c, i| {
- if (c == 0) return s[0..i];
- }
- return s;
- }
};
test {