test(apple): preserve serialized UID and cancellation identities

This commit is contained in:
morluto committed 2026-10-24 08:22:14 +08:00
1 parent fcd5192743
commit be2a0b98ae
3 files changed
+12 -4

No files matched your search

@@ -15,13 +15,15 @@ it.each(["utf8", "utf8-bom", "utf16le", "utf16be", "binary"] as const)(
const root = await createTestTempDirectory("rea-keyed-encoding-");
const xml = await nativeFixture("archive-xml-encoding/archive.xml");
const utf16 = Buffer.from(xml.replace("UTF-8", "UTF-16"), "utf16le");
// The binary builder emits type-8 records for UID; CF$UID is XML's convention.
const binarySource = xml.replaceAll("<key>CF$UID</key>", "<key>UID</key>");
const bytes =
encoding === "utf8"
? Buffer.from(xml)
: encoding === "utf8-bom"
? Buffer.concat([Buffer.from([0xef, 0xbb, 0xbf]), Buffer.from(xml)])
: encoding === "binary"
? Buffer.from(buildBinary(parse(xml)))
? Buffer.from(buildBinary(parse(binarySource)))
: Buffer.concat([
Buffer.from(
encoding === "utf16le" ? [0xff, 0xfe] : [0xfe, 0xff],
@@ -65,6 +67,8 @@ it.each(["utf8-as-utf16", "utf16-as-utf8"] as const)(
async (kind) => {
const root = await createTestTempDirectory("rea-keyed-encoding-");
const xml = await nativeFixture("archive-xml-encoding/archive.xml");
// The binary builder emits type-8 records for UID; CF$UID is XML's convention.
const binarySource = xml.replaceAll("<key>CF$UID</key>", "<key>UID</key>");
const bytes =
kind === "utf8-as-utf16"
? Buffer.from(xml.replace("UTF-8", "UTF-16"))
@@ -1037,6 +1037,7 @@ describe("DMG attach cancellation and preexisting mounts", () => {
},
);
it("leaves a preexisting outside-root mount attached", async () => {
const calls: string[][] = [];
const host: NativeDmgHost = {
+6 -3
View File
@@ -94,11 +94,14 @@ export const archiveNumberMetadataCases: readonly MetadataCase[] = [
malformedReference: false,
},
{
name: `${key} malformed numeric reference`,
name:
key === "CF$UID"
? `${key} malformed numeric reference`
: `${key} unsafe integer dictionary data`,
source: { [key]: "__INTEGER__" },
element: "",
expected: { [key]: ROUNDED },
malformedReference: true,
expected: { [key]: key === "CF$UID" ? ROUNDED : EXACT_INTEGER },
malformedReference: key === "CF$UID",
},
]),
{