mirror of
https://github.com/morluto/rea.git
synced 2026-11-15 19:23:24 +00:00
* refactor(native): report bounded string reads that stop at their allowance as decode limits * fix(verify): count generic and multi-line plain-Error limit classes
36 lines
1.0 KiB
TypeScript
36 lines
1.0 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("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);
|
|
});
|