constructor-unicode-ext-invalid.js (819B)
1 // Copyright 2018 André Bargull; Igalia, S.L. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-intl.locale 6 description: > 7 Verifies treatment of specific structurally invalid tags. 8 info: | 9 ApplyOptionsToTag( tag, options ) 10 2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception. 11 features: [Intl.Locale] 12 ---*/ 13 14 const invalidLanguageTags = [ 15 // Unicode extension sequence is incomplete. 16 "da-u", 17 "da-u-", 18 "da-u--", 19 "da-u-t-latn", 20 "da-u-x-priv", 21 22 // Duplicate 'u' singleton. 23 "da-u-ca-gregory-u-ca-buddhist" 24 ]; 25 26 for (const langtag of invalidLanguageTags) { 27 assert.throws(RangeError, function() { 28 new Intl.Locale(langtag) 29 }, 30 `new Intl.Locale("${langtag}") throws RangeError`); 31 } 32 33 reportCompare(0, 0);