1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:27:43 +00:00

LibJS: Canonicalize Unicode locale extension attributes and keywords

This commit is contained in:
Timothy Flynn 2021-08-28 16:04:55 -04:00 committed by Linus Groh
parent 94e66f500c
commit a2f0eeff7a
2 changed files with 43 additions and 18 deletions

View file

@ -96,4 +96,16 @@ describe("normal behavior", () => {
expect(Intl.getCanonicalLocales(true)).toEqual([]);
expect(Intl.getCanonicalLocales(123)).toEqual([]);
});
test("duplicate Unicode locale extension attributes", () => {
expect(Intl.getCanonicalLocales("en-us-u-aaa-aaa")).toEqual(["en-US-u-aaa"]);
expect(Intl.getCanonicalLocales("en-us-u-aaa-bbb-aaa")).toEqual(["en-US-u-aaa-bbb"]);
});
test("duplicate Unicode locale extension keywords", () => {
expect(Intl.getCanonicalLocales("en-us-u-1k-aaa-1k-bbb")).toEqual(["en-US-u-1k-aaa"]);
expect(Intl.getCanonicalLocales("en-us-u-1k-aaa-2k-ccc-1k-bbb")).toEqual([
"en-US-u-1k-aaa-2k-ccc",
]);
});
});