diff options
| author | Igor Anić <igor.anic@gmail.com> | 2023-12-18 21:39:07 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-01-13 19:37:33 -0700 |
| commit | 7d3a31872eda55438259b54818baaa90b6ecd74c (patch) | |
| tree | 0f37119cde4ccd495925d05ca70a7b939c252f16 /lib/std/math.zig | |
| parent | 7923a53996f8d24ad27823db3a45a6dd4a2bf317 (diff) | |
| download | zig-7d3a31872eda55438259b54818baaa90b6ecd74c.tar.gz zig-7d3a31872eda55438259b54818baaa90b6ecd74c.zip | |
tar: improve diagnostic reporting
Using Python testtar file (mentioned in #14310) to test diagnostic
reporting.
Added computing checksum by using both unsigned and signed header bytes
values.
Added skipping gnu exteneded sparse headers while reporting unsupported
header in diagnostic.
Note on testing:
wget https://github.com/python/cpython/raw/3.11/Lib/test/testtar.tar -O
/tmp/testtar.tar
```
test "Python testtar.tar file" {
const file_name = "testtar.tar";
var file = try std.fs.cwd().openFile("/tmp/" ++ file_name, .{});
defer file.close();
var diag = Options.Diagnostics{ .allocator = std.testing.allocator };
defer diag.deinit();
var iter = iterator(file.reader(), &diag);
while (try iter.next()) |f| {
std.debug.print("supported: {} {s} {d}\n", .{ f.kind, f.name, f.size });
try f.skip();
}
for (diag.errors.items) |e| {
switch (e) {
.unsupported_file_type => |u| {
std.debug.print("unsupported: {} {s}\n", .{ u.file_type, u.file_name });
},
else => unreachable,
}
}
}
```
Diffstat (limited to 'lib/std/math.zig')
0 files changed, 0 insertions, 0 deletions
