chore(tests): add test for utf8 encoded filenames

This commit is contained in:
Erica Marigold 2025-01-08 14:40:51 +00:00
parent ecdae4155e
commit eb7aa1d010
Signed by: DevComp
GPG key ID: 429EF1C337871656
3 changed files with 14 additions and 1 deletions

Binary file not shown.

View file

@ -44,5 +44,18 @@ return function(test: typeof(frktest.test))
-- the entire binary data in case there's a mismatch
check.equal(serde.hash("blake3", bin), serde.hash("blake3", expectedBin.stdout))
end)
test.case("Extracts files with UTF8 names", function()
local data = fs.readFile("tests/data/utf8_filenames.zip")
local zip = ZipReader.load(buffer.fromstring(data))
local entries = {}
for _, entry in zip:listDirectory("/") do
table.insert(entries, entry.name)
end
check.equal(#entries, 3)
check.table.equal(entries, { "file_こんにちは.txt", "file_你好.txt", "file_안녕하세요.txt" })
end)
end)
end

View file

@ -14,7 +14,7 @@ local FALLIBLES = {
-- "invalid_cde_number_of_files_allocation_smaller_offset.zip",
"invalid_offset.zip",
"invalid_offset2.zip",
"chinese.zip", -- TODO: Support UTF8 data in file names
"chinese.zip", -- Contains non UTF8 data which can't parse without OS APIs
"non_utf8.zip", -- FIXME: Lune breaks for non utf8 data in process stdout
"pandoc_soft_links.zip", -- Soft links are tested separately in edge_cases
}