feat: publish Regex Tools 0.1.0
This commit is contained in:
12
src/regex/execution/request-limits.test.ts
Normal file
12
src/regex/execution/request-limits.test.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { utf8ByteLength } from "./request-limits";
|
||||
|
||||
describe("UTF-8 resource accounting", () => {
|
||||
it("matches TextEncoder for ASCII, astral characters and lone surrogates", () => {
|
||||
for (const value of ["", "ASCII", "Bérénice", "😀", "\ud800", "\udc00"]) {
|
||||
expect(utf8ByteLength(value)).toBe(
|
||||
new TextEncoder().encode(value).byteLength,
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user