constructor-options-language-grandfathered.js (1033B)
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 Checks error cases for the options argument to the Locale 8 constructor. 9 info: | 10 ApplyOptionsToTag( tag, options ) 11 ... 12 3. Let language be ? GetOption(options, "language", "string", undefined, undefined). 13 4. If language is not undefined, then 14 a. If language does not match the language production, throw a RangeError exception. 15 b. If language matches the grandfathered production, throw a RangeError exception. 16 ... 17 18 features: [Intl.Locale] 19 ---*/ 20 21 assert.throws(RangeError, function() { 22 new Intl.Locale("nb", { 23 language: "no-bok", 24 }); 25 }, `new Intl.Locale("nb", {language: "no-bok"}) throws RangeError`); 26 27 assert.throws(RangeError, function() { 28 new Intl.Locale("nb", { 29 language: "no-bok", 30 region: "NO", 31 }); 32 }, `new Intl.Locale("nb", {language: "no-bok", region: "NO"}) throws RangeError`); 33 34 35 reportCompare(0, 0);