mirror of
https://github.com/morluto/rea.git
synced 2026-11-14 18:52:48 +00:00
* fix(native): retain Mach-O file identity through completion * fix(native): distinguish malformed Mach-O encryption facts * fix(native): preserve Mach-O command and dylib coverage * fix(native): preserve Apple dispatch fixup and declaration facts --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { expect, it } from "vitest";
|
|
import type { NativeCommandCapture } from "./CommandRunner.js";
|
|
import { parseDyldFileTypeRefusal } from "./NativeMachoCommandDiagnostics.js";
|
|
|
|
const capture = (stdout: string, stderr = ""): NativeCommandCapture => ({
|
|
tool: "dyld_info",
|
|
executable: "/usr/bin/dyld_info",
|
|
executableSha256: "a".repeat(64),
|
|
toolVersion: null,
|
|
versionReason: null,
|
|
arguments: ["-imports", "/selected/target"],
|
|
stdout,
|
|
stderr,
|
|
stdoutBytes: Buffer.byteLength(stdout),
|
|
stderrBytes: Buffer.byteLength(stderr),
|
|
exitCode: 1,
|
|
signal: null,
|
|
});
|
|
|
|
it.each([
|
|
["unknown filetype 3", "3"],
|
|
["unknown mh.filetype 4", "4"],
|
|
])("recognizes a sole dyld file-type refusal (%s)", (diagnostic, fileType) => {
|
|
expect(
|
|
parseDyldFileTypeRefusal(capture(`/selected/target:\n${diagnostic}\n`)),
|
|
).toEqual({ fileType, diagnostic });
|
|
});
|
|
|
|
it.each([
|
|
["unknown mh.filetype 4\nmalformed load command\n", ""],
|
|
["unknown mh.filetype 4\n", "read failed\n"],
|
|
])("keeps mixed dyld diagnostics unclassified (%s, %s)", (stdout, stderr) => {
|
|
expect(parseDyldFileTypeRefusal(capture(stdout, stderr))).toBeNull();
|
|
});
|