From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../intl402/Locale/constructor-locale-object.js | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 js/src/tests/test262/intl402/Locale/constructor-locale-object.js (limited to 'js/src/tests/test262/intl402/Locale/constructor-locale-object.js') diff --git a/js/src/tests/test262/intl402/Locale/constructor-locale-object.js b/js/src/tests/test262/intl402/Locale/constructor-locale-object.js new file mode 100644 index 0000000000..11760b13c8 --- /dev/null +++ b/js/src/tests/test262/intl402/Locale/constructor-locale-object.js @@ -0,0 +1,39 @@ +// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-intl.locale +description: > + Verifies canonicalization of specific tags. +info: | + ApplyOptionsToTag( tag, options ) + 10. Return CanonicalizeLanguageTag(tag). +features: [Intl.Locale] +---*/ + +// Pass Intl.Locale object and replace subtag. +const enUS = new Intl.Locale("en-US"); +const enGB = new Intl.Locale(enUS, {region: "GB"}); + +assert.sameValue(enUS.toString(), "en-US", 'enUS.toString() returns "en-US"'); +assert.sameValue(enGB.toString(), "en-GB", 'enGB.toString() returns "en-GB"'); + +// Pass Intl.Locale object and replace Unicode extension keyword. +const zhUnihan = new Intl.Locale("zh-u-co-unihan"); +const zhZhuyin = new Intl.Locale(zhUnihan, {collation: "zhuyin"}); + +assert.sameValue( + zhUnihan.toString(), + "zh-u-co-unihan", + 'zhUnihan.toString() returns "zh-u-co-unihan"' +); +assert.sameValue( + zhZhuyin.toString(), + "zh-u-co-zhuyin", + 'zhZhuyin.toString() returns "zh-u-co-zhuyin"' +); + +assert.sameValue(zhUnihan.collation, "unihan", 'The value of zhUnihan.collation is "unihan"'); +assert.sameValue(zhZhuyin.collation, "zhuyin", 'The value of zhZhuyin.collation is "zhuyin"'); + +reportCompare(0, 0); -- cgit v1.2.3