mirror of
https://github.com/morluto/rea.git
synced 2026-11-13 18:22:42 +00:00
fix(plist): recognize OpenStep files with leading comments (#6394)
This commit is contained in:
3 files changed
+84
-7
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import { mkdir, writeFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
|
||||
import { parseOpenStep } from "plist";
|
||||
import { expect, it } from "vitest";
|
||||
|
||||
import { createTestTempDirectory } from "../../tests/fixtures/temporaryDirectory.js";
|
||||
import { resolveAppBundleExecutable } from "./AppBundleExecutable.js";
|
||||
|
||||
it.each([
|
||||
["no comment", ""],
|
||||
["block comment", "/* App metadata */\n"],
|
||||
["line comment", "// App metadata\n"],
|
||||
["mixed comments", " \t/* header */\n// executable selection\n"],
|
||||
])("resolves an OpenStep Info.plist with %s", async (_label, prefix) => {
|
||||
const root = await createTestTempDirectory("rea-openstep-bundle-");
|
||||
const bundle = join(root, "Fixture.app");
|
||||
const programs = join(bundle, "Contents", "MacOS");
|
||||
const executable = join(programs, "Fixture");
|
||||
const infoPlist = join(bundle, "Contents", "Info.plist");
|
||||
const source = `${prefix}{ CFBundleExecutable = Fixture; }`;
|
||||
expect(parseOpenStep(source)).toEqual({ CFBundleExecutable: "Fixture" });
|
||||
await mkdir(programs, { recursive: true });
|
||||
await writeFile(infoPlist, source);
|
||||
await writeFile(executable, "fixture - never executed");
|
||||
|
||||
expect(await resolveAppBundleExecutable(bundle)).toEqual({
|
||||
ok: true,
|
||||
value: { executable, infoPlist },
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user