test(javascript): share primitive expansion producer fixtures

This commit is contained in:
morluto committed 2026-10-10 02:49:46 +08:00
1 parent 449d57075e
commit c867bcd0aa
4 files changed
+35 -40

No files matched your search

@@ -1,3 +1,4 @@
import { primitiveByteExpansionSource } from "../../../tests/fixtures/javascriptPrimitiveExpansion.js";
import * as t from "@babel/types";
import { expect, it } from "vitest";
@@ -111,15 +112,7 @@ it("preserves primitive candidate budget unknowns in semantic graph coverage", (
});
it("preserves derived string-byte limit reasons in semantic graph unknowns", () => {
const declarations = ['const value0 = "x";'];
for (let index = 1; index <= 30; index += 1) {
const previous = `value${String(index - 1)}`;
declarations.push(
`const value${String(index)} = ${previous} + ${previous};`,
);
}
declarations.push("const answer = value30;");
const source = declarations.join("\n");
const source = primitiveByteExpansionSource();
const ir = analyzeJavaScriptSemantics(source);
const graph = graphFor(source, ir);