summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/Locale/constructor-options-throwing-getters.js
blob: 92418505add803655c644f10d0d870ee2387476a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2018 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-Intl.Locale
description: Checks the propagation of exceptions from the options for the Locale constructor.
features: [Intl.Locale]
---*/

function CustomError() {}

const options = [
  "language",
  "script",
  "region",
  "calendar",
  "collation",
  "hourCycle",
  "caseFirst",
  "numeric",
  "numberingSystem",
];

for (const option of options) {
  assert.throws(CustomError, () => {
    new Intl.Locale("en", {
      get [option]() {
        throw new CustomError();
      }
    });
  },
  `new Intl.Locale("en", {get ${option}() {throw new CustomError();}}) throws CustomError`);
}

reportCompare(0, 0);