Release Unicode Tools 0.1.0
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
codePointLabel,
|
||||
compareNormalization,
|
||||
decodeCodePointList,
|
||||
inspectText,
|
||||
parseCodePointList,
|
||||
} from "../../src/unicode/model";
|
||||
|
||||
describe("Unicode helper integration", () => {
|
||||
it("parses and decodes scalar values", () => {
|
||||
expect(parseCodePointList("U+0041 1F600")).toEqual([0x41, 0x1f600]);
|
||||
expect(decodeCodePointList("41, 1F600")).toBe("A😀");
|
||||
expect(() => parseCodePointList("D800")).toThrow(/scalar value/u);
|
||||
});
|
||||
|
||||
it("inspects code points separately from graphemes", () => {
|
||||
const result = inspectText("e\u0301");
|
||||
expect(result.codePointCount).toBe(2);
|
||||
expect(result.graphemes).toHaveLength(1);
|
||||
expect(result.points[1]?.javascript).toBe("\\u0301");
|
||||
});
|
||||
|
||||
it("compares all normalization forms", () => {
|
||||
const result = compareNormalization("e\u0301");
|
||||
expect(result.forms.find((item) => item.form === "NFC")?.value).toBe("é");
|
||||
expect(codePointLabel(0x1f600)).toBe("U+1F600");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user