Debian Codegraph @

js/src/tests/test262/intl402/Locale/constructor-options-collation-invalid.js

raw
1 // Copyright 2018 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 constructor.
8 info: |
9 Intl.Locale( tag [, options] )
10
11 ...
12 18. If collation is not undefined, then
13 a. If collation does not match the [(3*8alphanum) *("-" (3*8alphanum))] sequence, throw a RangeError exception.
14
15 features: [Intl.Locale]
16 ---*/
17
18
19 /*
20 alphanum = (ALPHA / DIGIT) ; letters and numbers
21 collation = (3*8alphanum) *("-" (3*8alphanum))
22 */
23 const invalidCollationOptions = [
24 "",
25 "a",
26 "ab",
27 "abcdefghi",
28 "abc-abcdefghi",
29 ];
30 for (const invalidCollationOption of invalidCollationOptions) {
31 assert.throws(RangeError, function() {
32 new Intl.Locale("en", {collation: invalidCollationOption});
33 });
34 }
35
36 reportCompare(0, 0);