diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/intl402/Collator/unicode-ext-value-collation.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/intl402/Collator/unicode-ext-value-collation.js')
-rw-r--r-- | js/src/tests/test262/intl402/Collator/unicode-ext-value-collation.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/Collator/unicode-ext-value-collation.js b/js/src/tests/test262/intl402/Collator/unicode-ext-value-collation.js new file mode 100644 index 0000000000..c09eefec32 --- /dev/null +++ b/js/src/tests/test262/intl402/Collator/unicode-ext-value-collation.js @@ -0,0 +1,40 @@ +// Copyright 2012 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.1.1_19_b +description: Tests the special handling of the "co" key in Intl.Collator. +author: Norbert Lindenberg +---*/ + +function checkCollation(extensionCoValue, usageValue, expectedCollations, expectedUsage) { + var requestLocale = extensionCoValue !== undefined ? "de-DE-u-co-" + extensionCoValue : "de-DE"; + var options = usageValue !== undefined ? { usage: usageValue } : undefined; + var collator = new Intl.Collator([requestLocale], options); + + var collation = collator.resolvedOptions().collation; + assert.notSameValue(expectedCollations.indexOf(collation), -1, (extensionCoValue === undefined ? "Default collation" : "Collation for \"" + extensionCoValue) + "\" should be " + expectedCollations.join(" or ") + ", but is " + collation + "."); + + var usage = collator.resolvedOptions().usage; + assert.sameValue(usage, expectedUsage, (usageValue === undefined ? "Default usage" : "Usage") + " mismatch."); +} + +checkCollation(undefined, undefined, ["default"], "sort"); + +checkCollation("phonebk", undefined, ["phonebk", "default"], "sort"); + +checkCollation("invalid", undefined, ["default"], "sort"); + +checkCollation("standard", undefined, ["default"], "sort"); + +checkCollation("standard", "search", ["default"], "search"); + +checkCollation("standard", "sort", ["default"], "sort"); + +checkCollation("search", undefined, ["default"], "sort"); + +checkCollation("search", "search", ["default"], "search"); + +checkCollation("search", "sort", ["default"], "sort"); + +reportCompare(0, 0); |