| author | |
| committer | |
| log | 10add7c677d368501691178ea0c073a9766cd498 |
| tree | beb81d132badb7e95f796379a0eb73fd860e20bc |
| parent | 04e8bbd932c9ce9ac99230a656c8951c467d5b24 |
2 files changed, 22 insertions(+), 22 deletions(-)
lib/std/tar.zig+18-4| ... | ... | @@ -656,7 +656,7 @@ fn stripComponents(path: []const u8, count: u32) []const u8 { |
| 656 | 656 | return path[i..]; |
| 657 | 657 | } |
| 658 | 658 | |
| 659 | test "tar stripComponents" { | |
| 659 | test "stripComponents" { | |
| 660 | 660 | const expectEqualStrings = std.testing.expectEqualStrings; |
| 661 | 661 | try expectEqualStrings("a/b/c", stripComponents("a/b/c", 0)); |
| 662 | 662 | try expectEqualStrings("b/c", stripComponents("a/b/c", 1)); |
| ... | ... | @@ -665,7 +665,7 @@ test "tar stripComponents" { |
| 665 | 665 | try expectEqualStrings("", stripComponents("a/b/c", 4)); |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | test "tar PaxIterator" { | |
| 668 | test "PaxIterator" { | |
| 669 | 669 | const Attr = struct { |
| 670 | 670 | kind: PaxAttributeKind, |
| 671 | 671 | value: []const u8 = undefined, |
| ... | ... | @@ -793,7 +793,7 @@ test { |
| 793 | 793 | _ = @import("tar/test.zig"); |
| 794 | 794 | } |
| 795 | 795 | |
| 796 | test "tar header parse size" { | |
| 796 | test "header parse size" { | |
| 797 | 797 | const cases = [_]struct { |
| 798 | 798 | in: []const u8, |
| 799 | 799 | want: u64 = 0, |
| ... | ... | @@ -828,7 +828,7 @@ test "tar header parse size" { |
| 828 | 828 | } |
| 829 | 829 | } |
| 830 | 830 | |
| 831 | test "tar header parse mode" { | |
| 831 | test "header parse mode" { | |
| 832 | 832 | const cases = [_]struct { |
| 833 | 833 | in: []const u8, |
| 834 | 834 | want: u64 = 0, |
| ... | ... | @@ -871,3 +871,17 @@ test "create file and symlink" { |
| 871 | 871 | _ = try createDirAndSymlink(root.dir, "../../../g/h/i/file4", "j/k/l/symlink3"); |
| 872 | 872 | _ = try createDirAndFile(root.dir, "g/h/i/file4"); |
| 873 | 873 | } |
| 874 | ||
| 875 | test "insufficient buffer for iterator" { | |
| 876 | var file_name_buffer: [10]u8 = undefined; | |
| 877 | var link_name_buffer: [10]u8 = undefined; | |
| 878 | ||
| 879 | var fsb = std.io.fixedBufferStream(""); | |
| 880 | try std.testing.expectError( | |
| 881 | error.TarInsufficientBuffer, | |
| 882 | iterator(fsb.reader(), .{ | |
| 883 | .file_name_buffer = &file_name_buffer, | |
| 884 | .link_name_buffer = &link_name_buffer, | |
| 885 | }), | |
| 886 | ); | |
| 887 | } |
lib/std/tar/test.zig+4-18| ... | ... | @@ -2,7 +2,7 @@ const std = @import("std"); |
| 2 | 2 | const tar = @import("../tar.zig"); |
| 3 | 3 | const testing = std.testing; |
| 4 | 4 | |
| 5 | test "tar run Go test cases" { | |
| 5 | test "run test cases" { | |
| 6 | 6 | const Case = struct { |
| 7 | 7 | const File = struct { |
| 8 | 8 | name: []const u8, |
| ... | ... | @@ -401,7 +401,7 @@ const Md5Writer = struct { |
| 401 | 401 | } |
| 402 | 402 | }; |
| 403 | 403 | |
| 404 | test "tar should not overwrite existing file" { | |
| 404 | test "should not overwrite existing file" { | |
| 405 | 405 | // Starting from this folder structure: |
| 406 | 406 | // $ tree root |
| 407 | 407 | // root |
| ... | ... | @@ -457,7 +457,7 @@ test "tar should not overwrite existing file" { |
| 457 | 457 | try tar.pipeToFileSystem(root2.dir, fsb.reader(), .{ .mode_mode = .ignore, .strip_components = 0 }); |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | test "tar case sensitivity" { | |
| 460 | test "case sensitivity" { | |
| 461 | 461 | // Mimicking issue #18089, this tar contains, same file name in two case |
| 462 | 462 | // sensitive name version. Should fail on case insensitive file systems. |
| 463 | 463 | // |
| ... | ... | @@ -484,7 +484,7 @@ test "tar case sensitivity" { |
| 484 | 484 | try testing.expect((try root.dir.statFile("alacritty/Darkermatrix.yml")).kind == .file); |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | test "tar pipeToFileSystem" { | |
| 487 | test "pipeToFileSystem" { | |
| 488 | 488 | // $ tar tvf |
| 489 | 489 | // pipe_to_file_system_test/ |
| 490 | 490 | // pipe_to_file_system_test/b/ |
| ... | ... | @@ -515,17 +515,3 @@ test "tar pipeToFileSystem" { |
| 515 | 515 | var buf: [32]u8 = undefined; |
| 516 | 516 | try testing.expectEqualSlices(u8, "../a/file", try root.dir.readLink("b/symlink", &buf)); |
| 517 | 517 | } |
| 518 | ||
| 519 | test "insufficient buffer for iterator" { | |
| 520 | var file_name_buffer: [10]u8 = undefined; | |
| 521 | var link_name_buffer: [10]u8 = undefined; | |
| 522 | ||
| 523 | var fsb = std.io.fixedBufferStream(""); | |
| 524 | try testing.expectError( | |
| 525 | error.TarInsufficientBuffer, | |
| 526 | tar.iterator(fsb.reader(), .{ | |
| 527 | .file_name_buffer = &file_name_buffer, | |
| 528 | .link_name_buffer = &link_name_buffer, | |
| 529 | }), | |
| 530 | ); | |
| 531 | } |