diff --git a/tests/boundary/providers/native/nativePlistTextSource.test.ts b/tests/boundary/providers/native/nativePlistTextSource.test.ts index bab6753811..b16898cd5c 100644 --- a/tests/boundary/providers/native/nativePlistTextSource.test.ts +++ b/tests/boundary/providers/native/nativePlistTextSource.test.ts @@ -66,14 +66,14 @@ it.for([ }, { name: "unknown XML scalar", - bytes: Buffer.from(" 42 "), + bytes: Buffer.from("1e999"), description: "XML 1.0 document text", format: "xml", value: { $plist_type: "unknown", - element: "integer", - literal: " 42 ", - reason: "invalid-literal", + element: "real", + literal: "1e999", + reason: "unrepresentable", }, limitations: [ expect.stringContaining("1 XML scalar value(s) could not be established"), @@ -164,7 +164,14 @@ it.for([ const conversion = fixture.conversions[conversionIndex++]; if (conversion === undefined) throw new Error("Unexpected conversion of directly supported source"); - expect(args[1]).toBe(conversion.format); + expect(args).toEqual([ + "-convert", + conversion.format, + "-o", + "-", + "--", + path, + ]); return ok({ ...result.value, stdout: conversion.output, diff --git a/tests/boundary/providers/native/plistSourceFormat.test.ts b/tests/boundary/providers/native/plistSourceFormat.test.ts index bdfd6d8519..54d74b570b 100644 --- a/tests/boundary/providers/native/plistSourceFormat.test.ts +++ b/tests/boundary/providers/native/plistSourceFormat.test.ts @@ -27,6 +27,7 @@ const DATA = { $plist_type: "data", base64: "3q2+7w==" }; class PlistSourceRunner extends NativeFixtureRunner { constructor( + private readonly path: string, description: string, private readonly xmlFallback: boolean, private readonly convertedXml: string = XML, @@ -36,8 +37,23 @@ class PlistSourceRunner extends NativeFixtureRunner { override async run(tool: string, arguments_: readonly string[]) { const result = await super.run(tool, arguments_); - if (!result.ok || tool !== "plutil" || !this.xmlFallback) return result; - const json = arguments_.includes("json"); + if (!result.ok || tool !== "plutil") return result; + if (arguments_[0] === "-lint") { + expect(arguments_).toEqual(["-lint", "--", this.path]); + return ok({ ...result.value, stdout: "", stdoutBytes: 0 }); + } + const format = arguments_[1]; + expect(["json", "xml1"]).toContain(format); + expect(arguments_).toEqual([ + "-convert", + format, + "-o", + "-", + "--", + this.path, + ]); + if (!this.xmlFallback) return result; + const json = format === "json"; const stdout = json ? "" : this.convertedXml; return ok({ ...result.value, @@ -87,7 +103,7 @@ it.for([ contents: ` \n${XML}`, expected: "xml", xmlFallback: true, - expectedTools: ["file"], + expectedTools: ["file", "plutil"], expectedLimitations: [], }, { @@ -95,7 +111,7 @@ it.for([ contents: `\n${XML}`, expected: "xml", xmlFallback: true, - expectedTools: ["file"], + expectedTools: ["file", "plutil"], expectedLimitations: [], }, ...[false, true].map((bigEndian) => ({ @@ -105,7 +121,7 @@ it.for([ : Buffer.from(`\uFEFF${XML}`, "utf16le"), expected: "xml", xmlFallback: true, - expectedTools: ["file"], + expectedTools: ["file", "plutil"], expectedLimitations: [], })), { description: "ASCII text\n", expected: "unknown", xmlFallback: true }, @@ -120,7 +136,7 @@ it.for([ expected: "xml", xmlFallback: false, expectedValue: { ...VALUE, Blob: DATA }, - expectedTools: ["file"], + expectedTools: ["file", "plutil"], }, { description: @@ -128,7 +144,7 @@ it.for([ contents: Buffer.from("\uFEFF" + XML, "utf16le").swap16(), expected: "xml", xmlFallback: true, - expectedTools: ["file"], + expectedTools: ["file", "plutil"], expectedLimitations: [], }, { @@ -162,7 +178,7 @@ it.for([ xmlFallback: true, convertedXml: "nela\u0085blsa\u2028bpsa\u2029blfa\nbpayloadAA==", - expectedTools: ["file"], + expectedTools: ["file", "plutil"], expectedLimitations: [], expectedValue: { nel: "a\u0085b", @@ -192,7 +208,7 @@ it.for([ await writeFile(path, contents); const client = new NativeMacOSProvider( {}, - new PlistSourceRunner(description, xmlFallback, convertedXml), + new PlistSourceRunner(path, description, xmlFallback, convertedXml), "darwin", ).createClient(nativeMachoTarget(join(root, "target"))); onTestFinished(async () => {