style: apply stylua formatter

This commit is contained in:
Erica Marigold 2025-01-08 14:14:30 +00:00
parent 9d3c815fbb
commit 03320fe090
Signed by: DevComp
GPG key ID: 429EF1C337871656
9 changed files with 489 additions and 485 deletions

View file

@ -431,7 +431,6 @@ function ZipReader.extract(self: ZipReader, entry: ZipEntry, options: Extraction
skip = true, skip = true,
})) }))
-- Check if the path was a relative path -- Check if the path was a relative path
if path.isRelative(linkPath) then if path.isRelative(linkPath) then
if string.sub(linkPath, -1) ~= "/" then if string.sub(linkPath, -1) ~= "/" then

View file

@ -29,7 +29,8 @@ return function(test: typeof(frktest.test))
check.equal(targetPath, "pandoc") check.equal(targetPath, "pandoc")
local bin = zip:extract(entry, { isString = false, followSymlinks = true }) :: buffer local bin = zip:extract(entry, { isString = false, followSymlinks = true }) :: buffer
local expectedBin = process.spawn("unzip", { "-p", "tests/data/pandoc_soft_links.zip", "pandoc-3.2-arm64/bin/pandoc" }) local expectedBin =
process.spawn("unzip", { "-p", "tests/data/pandoc_soft_links.zip", "pandoc-3.2-arm64/bin/pandoc" })
check.is_true(expectedBin.ok) check.is_true(expectedBin.ok)
-- Compare hashes instead of the entire binary to improve speed and not print out -- Compare hashes instead of the entire binary to improve speed and not print out

View file

@ -15,7 +15,7 @@ local FALLIBLES = {
"invalid_offset2.zip", "invalid_offset2.zip",
"misaligned_comment.zip", "misaligned_comment.zip",
"comment_garbage.zip", "comment_garbage.zip",
"chinese.zip" -- FIXME: Support encoding other than UTF-8 and ASCII using OS APIs after FFI "chinese.zip", -- FIXME: Support encoding other than UTF-8 and ASCII using OS APIs after FFI
} }
local METHOD_NAME_TRANSFORMATIONS: { [string]: unzip.CompressionMethod } = { local METHOD_NAME_TRANSFORMATIONS: { [string]: unzip.CompressionMethod } = {
@ -83,7 +83,9 @@ return function(test: typeof(frktest.test))
continue continue
end end
local checkErr:(((...any) -> any?) -> nil) = if table.find(FALLIBLES, file) then check.should_error else check.should_not_error local checkErr: ((...any) -> any?) -> nil = if table.find(FALLIBLES, file)
then check.should_error
else check.should_not_error
test.case(`Parsed metadata matches unzip output - {file}`, function() test.case(`Parsed metadata matches unzip output - {file}`, function()
checkErr(function(...) checkErr(function(...)
file = "tests/data/" .. file file = "tests/data/" .. file
@ -118,7 +120,9 @@ return function(test: typeof(frktest.test))
check.equal(tonumber(length), entry.size) check.equal(tonumber(length), entry.size)
check.equal(METHOD_NAME_TRANSFORMATIONS[method :: string], entry.method) check.equal(METHOD_NAME_TRANSFORMATIONS[method :: string], entry.method)
check.is_true(dateFuzzyEq(gotDateTime:formatLocalTime("%Y-%m-%d"), expectedDate :: string, 1)) check.is_true(
dateFuzzyEq(gotDateTime:formatLocalTime("%Y-%m-%d"), expectedDate :: string, 1)
)
-- TODO: Use extra datetime field -- TODO: Use extra datetime field
check.is_true( check.is_true(