From b03a15e6d1d710ffd8e9c844ddce4ab5d38f65fa Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Sat, 24 Oct 2026 04:49:15 +0800 Subject: [PATCH] test(ghidra): own fixed import target fixtures --- src/ghidra/GhidraLanguageOverride.test.ts | 37 +++++++++++++---------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/ghidra/GhidraLanguageOverride.test.ts b/src/ghidra/GhidraLanguageOverride.test.ts index ea167159c9..b00a07d9be 100644 --- a/src/ghidra/GhidraLanguageOverride.test.ts +++ b/src/ghidra/GhidraLanguageOverride.test.ts @@ -68,6 +68,26 @@ const pe: BinaryTarget = { managed: false, }; +const fixedImportTarget = ( + format: "raw-binary" | "dos-mz" | "dos-com", +): BinaryTarget => { + const executable = { + path: pe.path, + sha256: pe.sha256, + kind: "executable", + architecture: "x86", + availableArchitectures: ["x86"], + } as const; + return format === "raw-binary" + ? { + ...executable, + format, + entryPoint: "0x0", + entryPointSource: "0x0", + } + : { ...executable, format }; +}; + const legacyMips: BinaryTarget = { path: "/fixture-mips.elf", sha256: "b".repeat(64), @@ -402,22 +422,7 @@ describe("Ghidra language override profile", () => { it.each(["raw-binary", "dos-mz", "dos-com"] as const)( "attributes a fixed %s import override conflict to the named settings", async (format) => { - const executable = { - path: pe.path, - sha256: pe.sha256, - kind: "executable", - architecture: "x86", - availableArchitectures: ["x86"], - } as const; - const target: BinaryTarget = - format === "raw-binary" - ? { - ...executable, - format, - entryPoint: "0x0", - entryPointSource: "0x0", - } - : { ...executable, format }; + const target = fixedImportTarget(format); const resolved = await provider({ REA_GHIDRA_LANGUAGE_ID: "x86:LE:32:default", REA_GHIDRA_COMPILER_SPEC_ID: "borlandcpp",