std.tar: remove redundant test name prefixes

This commit is contained in:
Igor Anić 2024-03-02 00:50:39 +01:00
parent 04e8bbd932
commit 10add7c677
2 changed files with 22 additions and 22 deletions

View File

@ -656,7 +656,7 @@ fn stripComponents(path: []const u8, count: u32) []const u8 {
return path[i..];
}
test "tar stripComponents" {
test "stripComponents" {
const expectEqualStrings = std.testing.expectEqualStrings;
try expectEqualStrings("a/b/c", stripComponents("a/b/c", 0));
try expectEqualStrings("b/c", stripComponents("a/b/c", 1));
@ -665,7 +665,7 @@ test "tar stripComponents" {
try expectEqualStrings("", stripComponents("a/b/c", 4));
}
test "tar PaxIterator" {
test "PaxIterator" {
const Attr = struct {
kind: PaxAttributeKind,
value: []const u8 = undefined,
@ -793,7 +793,7 @@ test {
_ = @import("tar/test.zig");
}
test "tar header parse size" {
test "header parse size" {
const cases = [_]struct {
in: []const u8,
want: u64 = 0,
@ -828,7 +828,7 @@ test "tar header parse size" {
}
}
test "tar header parse mode" {
test "header parse mode" {
const cases = [_]struct {
in: []const u8,
want: u64 = 0,
@ -871,3 +871,17 @@ test "create file and symlink" {
_ = try createDirAndSymlink(root.dir, "../../../g/h/i/file4", "j/k/l/symlink3");
_ = try createDirAndFile(root.dir, "g/h/i/file4");
}
test "insufficient buffer for iterator" {
var file_name_buffer: [10]u8 = undefined;
var link_name_buffer: [10]u8 = undefined;
var fsb = std.io.fixedBufferStream("");
try std.testing.expectError(
error.TarInsufficientBuffer,
iterator(fsb.reader(), .{
.file_name_buffer = &file_name_buffer,
.link_name_buffer = &link_name_buffer,
}),
);
}

View File

@ -2,7 +2,7 @@ const std = @import("std");
const tar = @import("../tar.zig");
const testing = std.testing;
test "tar run Go test cases" {
test "run test cases" {
const Case = struct {
const File = struct {
name: []const u8,
@ -401,7 +401,7 @@ const Md5Writer = struct {
}
};
test "tar should not overwrite existing file" {
test "should not overwrite existing file" {
// Starting from this folder structure:
// $ tree root
// root
@ -457,7 +457,7 @@ test "tar should not overwrite existing file" {
try tar.pipeToFileSystem(root2.dir, fsb.reader(), .{ .mode_mode = .ignore, .strip_components = 0 });
}
test "tar case sensitivity" {
test "case sensitivity" {
// Mimicking issue #18089, this tar contains, same file name in two case
// sensitive name version. Should fail on case insensitive file systems.
//
@ -484,7 +484,7 @@ test "tar case sensitivity" {
try testing.expect((try root.dir.statFile("alacritty/Darkermatrix.yml")).kind == .file);
}
test "tar pipeToFileSystem" {
test "pipeToFileSystem" {
// $ tar tvf
// pipe_to_file_system_test/
// pipe_to_file_system_test/b/
@ -515,17 +515,3 @@ test "tar pipeToFileSystem" {
var buf: [32]u8 = undefined;
try testing.expectEqualSlices(u8, "../a/file", try root.dir.readLink("b/symlink", &buf));
}
test "insufficient buffer for iterator" {
var file_name_buffer: [10]u8 = undefined;
var link_name_buffer: [10]u8 = undefined;
var fsb = std.io.fixedBufferStream("");
try testing.expectError(
error.TarInsufficientBuffer,
tar.iterator(fsb.reader(), .{
.file_name_buffer = &file_name_buffer,
.link_name_buffer = &link_name_buffer,
}),
);
}