summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/DurationFormat/constructor-options-fractionalDigits-invalid.js
blob: 7f580a8e320f987f18b6eea78f7b054fd7b9251a (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
// |reftest| skip -- Intl.DurationFormat is not supported
// Copyright 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-Intl.DurationFormat
description: Tests that the option localeMatcher is processed correctly.
info: |
    Intl.DurationFormat ( [ locales [ , options ] ] )
    (...)
    18. Set durationFormat.[[FractionalDigits]] to ? GetNumberOption(options, "fractionalDigits", 0, 9, undefined).
features: [Intl.DurationFormat]
---*/

const invalidOptions = [
  -10,
  10
];

for (const fractionalDigits of invalidOptions) {
  assert.throws(RangeError, function() {
    new Intl.DurationFormat("en", { fractionalDigits });
  }, `new Intl.DurationFormat("en", {fractionalDigits: "${fractionalDigits}"}) throws RangeError`);
}

reportCompare(0, 0);