summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/Collator/constructor-options-throwing-getters.js
blob: ed2993524ca14201456e56e09528531ad169dd48 (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
// Copyright 2018 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-initializecollator
description: Checks the propagation of exceptions from the options for the Collator constructor.
---*/

function CustomError() {}

const options = [
  "usage",
  "localeMatcher",
  "collation",
  "numeric",
  "caseFirst",
  "sensitivity",
  "ignorePunctuation",
];

for (const option of options) {
  assert.throws(CustomError, () => {
    new Intl.Collator("en", {
      get [option]() {
        throw new CustomError();
      }
    });
  }, `Exception from ${option} getter should be propagated`);
}

reportCompare(0, 0);