tests/archive: comments: specs only
This commit is contained in:
1 parent
54f53a35f6
commit
96602286f8
33 files changed
+34
-226
No files matched your search
+2
-11
@@ -1,8 +1,4 @@
|
||||
-- archive/tar tests: archives from Python's tarfile (ustar / GNU / pax) and GNU tar (ustar / gnu / posix / v7) list
|
||||
-- the same entries as tarfile reads (names, types, sizes, links, mtimes, modes, data CRCs); the writer produces the same
|
||||
-- bytes as tarfile for the same entries in all three formats and round-trips; Archive values (add / read / write,
|
||||
-- conversion of a gzip / any archive to tar); .tar.gz / .tgz / .tar.bz2 / .tar.xz / .tar.zst / .tar.br load through the
|
||||
-- api as the tar inside; errors; the fuzz pass. Fixtures: tools/fixtures/tar.py.
|
||||
-- archive/tar tests against Python's tarfile and GNU tar (tools/fixtures/tar.py).
|
||||
local T = require("@tests/T")
|
||||
local F = require("@rosetta")
|
||||
local TarF = require("@rosetta/archive/tar")
|
||||
@@ -38,7 +34,6 @@ local function check(a: any, want: any, label: string)
|
||||
end
|
||||
end
|
||||
|
||||
-- 1. reading
|
||||
for _, c in Fx.tars do
|
||||
local a, err = TarF.decode(Bytes.reader(buffer.fromstring(c.data)))
|
||||
t:check(a, c.name .. ": " .. tostring(err))
|
||||
@@ -47,7 +42,7 @@ for _, c in Fx.tars do
|
||||
t:note("%-18s %2d entries", c.name, #c.entries)
|
||||
end
|
||||
|
||||
-- 2. writing: byte-identical to Python's tarfile (which pads to 10240-byte records)
|
||||
-- byte-identical to Python's tarfile (which pads to 10240-byte records)
|
||||
for _, w in Fx.writes do
|
||||
local list = {}
|
||||
for _, e in w.entries do
|
||||
@@ -83,7 +78,6 @@ for _, w in Fx.writes do
|
||||
end
|
||||
end
|
||||
|
||||
-- 3. Archive values: add / read / write, other archives to tar
|
||||
do
|
||||
local a = TarF.new()
|
||||
a:add("a.txt", "alpha", { mtime = 5 })
|
||||
@@ -98,7 +92,6 @@ do
|
||||
t:check(back:list()[2].dir, "directory entry")
|
||||
local _, e = back:read("missing")
|
||||
t:check(e and e.code == Err.ARG, "missing entry")
|
||||
-- a gzip (single-stream archive) converts to a tar holding its one entry
|
||||
local g = F.load(Fx.gzips[1].data)
|
||||
local tb = F.save(g, nil, { format = "tar" })
|
||||
local ta = F.load(tb)
|
||||
@@ -106,7 +99,6 @@ do
|
||||
t:eq(ta:list()[1].size, Fx.gzips[1].size, "gzip -> tar entry size")
|
||||
end
|
||||
|
||||
-- 4. compressed tars through the api
|
||||
for _, w in Fx.wrapped do
|
||||
local a, err = F.load(w.data, { name = w.name })
|
||||
t:check(a, w.name .. ": " .. tostring(err))
|
||||
@@ -118,7 +110,6 @@ for _, w in Fx.wrapped do
|
||||
t:eq(outer:list()[1].name, "a.tar", w.name .. ": inner entry named after the file")
|
||||
end
|
||||
|
||||
-- 5. errors
|
||||
do
|
||||
local good = Fx.tars[1].data
|
||||
local b = buffer.fromstring(good)
|
||||
|
||||
Reference in new issue
Block a user