String.prototype.toLocale{Lower,Upper}Case validates all locale identifiers

This commit is contained in:
André Bargull 2025-09-25 17:22:14 +02:00 committed by Ms2ger
parent 409001b61b
commit b5aac6bc84
2 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,25 @@
// Copyright (C) 2025 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sup-string.prototype.tolocalelowercase
description: >
All locale identifiers are validated, not just the first one.
info: |
String.prototype.toLocaleLowerCase ( [ locales ] )
...
3. Return ? TransformCase(S, locales, lower).
TransformCase ( S, locales, targetCase )
1. Let requestedLocales be ? CanonicalizeLocaleList(locales).
...
---*/
var locales = [
"en-US",
"this is not a valid locale",
];
assert.throws(RangeError, function() {
"".toLocaleLowerCase(locales);
});

View File

@ -0,0 +1,25 @@
// Copyright (C) 2025 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sup-string.prototype.tolocaleuppercase
description: >
All locale identifiers are validated, not just the first one.
info: |
String.prototype.toLocaleUpperCase ( [ locales ] )
...
3. Return ? TransformCase(S, locales, upper).
TransformCase ( S, locales, targetCase )
1. Let requestedLocales be ? CanonicalizeLocaleList(locales).
...
---*/
var locales = [
"en-US",
"this is not a valid locale",
];
assert.throws(RangeError, function() {
"".toLocaleUpperCase(locales);
});