Files
reverse-engineering-anything/tests/evaluation/limitClassGuard.test.ts
T
morluto e09bbcaf5f refactor: report NativeAOT, Interface Builder and owned-MCP output limits through the shared limit owners (#11194)
* refactor: report NativeAOT, Interface Builder and owned-MCP output limits through the shared limit owners

* refactor(errors): carry a parser's required value on its limit reference and in adjustable-budget refusals (#11201)

* fix(android): keep the JADX output-limit refusal's retained process output

* refactor(native): name PE and native-export allowances in the BinaryResourceFailure limit (#11253)

PeImportLimitFailure, PeLoadConfigLimitFailure and NativeExportLimitFailure kept a parallel `limit` field beside the LimitRef their BinaryResourceFailure base already carries (named only "structure"). The allowance name now lives in the LimitRef, consumers read it with binaryResourceAllowance against the parser's exported allowance list, and the three subclasses are removed. The local-limit-error-class guard also counts limit subclasses of BinaryResourceFailure.
2026-11-16 00:02:47 +08:00

44 lines
1.2 KiB
TypeScript

import { expect, it } from "vitest";
import { localLimitErrorClassCount } from "../../scripts/verify/limit-class-guard.mjs";
it("counts plain-Error limit classes in every layout", () => {
expect(
localLimitErrorClassCount("class ProbeLimitFailure extends Error {}"),
).toBe(1);
expect(
localLimitErrorClassCount(
"export class ProbeBudgetError<T> extends Error {}",
),
).toBe(1);
expect(
localLimitErrorClassCount(
"class ProbeExhausted<T extends Map<string, number>>\n extends Error {}",
),
).toBe(1);
expect(
localLimitErrorClassCount("class ProbeExceeded\n extends Error {}"),
).toBe(1);
});
it("counts limit subclasses of BinaryResourceFailure, which names its allowance", () => {
expect(
localLimitErrorClassCount(
"export class ProbeLimitFailure extends BinaryResourceFailure {}",
),
).toBe(1);
});
it("ignores classes on the shared owners and unrelated names", () => {
expect(
localLimitErrorClassCount(
'class ProbeLimit extends ParseFailureError<"limit"> {}',
),
).toBe(0);
expect(localLimitErrorClassCount("class ProbeFailure extends Error {}")).toBe(
0,
);
expect(
localLimitErrorClassCount("class ProbeLimit extends ErrorBase {}"),
).toBe(0);
});