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

LibJS: Compare Unicode locale variants using case-insensitive matching

In the IsStructurallyValidLanguageTag AO, we of course cannot assume the
variants are canonicalized to lower-case yet, because canonicalization
hasn't happened yet.
This commit is contained in:
Timothy Flynn 2021-09-01 18:54:30 -04:00 committed by Linus Groh
parent fdedb3ab33
commit 940c023e09
2 changed files with 8 additions and 1 deletions

View file

@ -18,6 +18,13 @@ describe("errors", () => {
});
test("duplicate variant subtags", () => {
expect(() => {
Intl.getCanonicalLocales("en-posix-POSIX");
}).toThrowWithMessage(
RangeError,
"en-posix-POSIX is not a structurally valid language tag"
);
expect(() => {
Intl.getCanonicalLocales("en-POSIX-POSIX");
}).toThrowWithMessage(