mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-21 05:50:55 +08:00
* Separate native linking from C compilation - Split the helper-object runtime-pack path into explicit link planning and platform linking. - Reserve SCRIPTC_LINKER for object-only executable links while retaining a deprecated SCRIPTC_CC compatibility path. - Add no-legacy-C coverage and document the linker/SDK boundary. * Preserve runtime pack link errors * Fix linker cache invalidation and warnings * Fix C executable cache routing - Keep explicit C builds on compiler-backed cache identities. - Cover linker-only environment changes across exact C repeats.
21 lines
1.1 KiB
TypeScript
21 lines
1.1 KiB
TypeScript
import { expect, test } from "vitest";
|
|
import { shouldWarnLegacyCExecutable } from "./legacy-c-warning.js";
|
|
|
|
const executable = {
|
|
executable: true,
|
|
fromC: false,
|
|
backend: undefined,
|
|
sanitize: false,
|
|
};
|
|
|
|
test("warns only for generated legacy C executables on runtime-pack hosts", () => {
|
|
expect(shouldWarnLegacyCExecutable(executable, { SCRIPTC_CC: "clang" }, true)).toBe(true);
|
|
expect(shouldWarnLegacyCExecutable({ ...executable, fromC: true }, { SCRIPTC_CC: "clang" }, true)).toBe(false);
|
|
expect(shouldWarnLegacyCExecutable({ ...executable, backend: "c" }, { SCRIPTC_CC: "clang" }, true)).toBe(false);
|
|
expect(shouldWarnLegacyCExecutable({ ...executable, sanitize: true }, { SCRIPTC_CC: "clang" }, true)).toBe(false);
|
|
expect(shouldWarnLegacyCExecutable({ ...executable, executable: false }, { SCRIPTC_CC: "clang" }, true)).toBe(false);
|
|
expect(shouldWarnLegacyCExecutable(executable, { SCRIPTC_CC: "clang", SCRIPTC_TARGET: "wasm32-wasi" }, true)).toBe(false);
|
|
expect(shouldWarnLegacyCExecutable(executable, { SCRIPTC_CC: "" }, true)).toBe(false);
|
|
expect(shouldWarnLegacyCExecutable(executable, { SCRIPTC_CC: "clang" }, false)).toBe(false);
|
|
});
|