fix(native): keep plist XML element types for large numbers
The XML fallback inferred an integer from `Number.isInteger`, so an integral `<real>` beyond 2^53 was misreported as an unknown integer. Read the `<integer>` and `<real>` literals from plutil's XML text instead: an unsafe integral number that matches one `<integer>` literal and no `<real>` gets its exact decimal; a number that could be either stays as decoded with a limitation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
430c297ca4
commit
f85056d83e
@@ -134,9 +134,9 @@ describe.skipIf(process.platform !== "darwin")(
|
||||
describe.skipIf(process.platform !== "darwin")(
|
||||
"native plist CLI integers",
|
||||
() => {
|
||||
cliTest(
|
||||
"reports exact plist integers beyond the JSON number range",
|
||||
async ({ cli }) => {
|
||||
cliTest.for([false, true])(
|
||||
"reports exact plist integers beyond the JSON number range (data: %s)",
|
||||
async (withData, { cli }) => {
|
||||
const directory = await createTestTempDirectory("rea-plist-integers-");
|
||||
const app = join(directory, "Example.app");
|
||||
const contents = join(app, "Contents");
|
||||
@@ -153,6 +153,7 @@ describe.skipIf(process.platform !== "darwin")(
|
||||
"<key>Max</key><integer>18446744073709551615</integer>",
|
||||
"<key>Min</key><integer>-9223372036854775808</integer>",
|
||||
"<key>Count</key><integer>42</integer>",
|
||||
...(withData ? ["<key>Blob</key><data>AAEC</data>"] : []),
|
||||
"</dict></plist>",
|
||||
].join(""),
|
||||
);
|
||||
@@ -171,7 +172,10 @@ describe.skipIf(process.platform !== "darwin")(
|
||||
Min: { $plist_type: "integer", decimal: "-9223372036854775808" },
|
||||
Count: 42,
|
||||
},
|
||||
limitations: [expect.stringContaining("2 integer value(s)")],
|
||||
limitations: [
|
||||
...(withData ? [expect.stringContaining("XML conversion")] : []),
|
||||
expect.stringContaining("2 integer value(s)"),
|
||||
],
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user