summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/NumberFormat/constructor-trailingZeroDisplay-invalid.js
blob: 6a5f620a2a4f246781cab29ee50d81e80aacde5c (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
// Copyright 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-initializenumberformat
description: Rejects invalid values for trailingZeroDisplay option.
features: [Intl.NumberFormat-v3]
---*/

assert.throws(RangeError, function() {
  new Intl.NumberFormat([], {trailingZeroDisplay: ''});
}, 'empty string');

assert.throws(RangeError, function() {
  new Intl.NumberFormat([], {trailingZeroDisplay: 'Auto'});
}, 'Auto');

assert.throws(RangeError, function() {
  new Intl.NumberFormat([], {trailingZeroDisplay: 'StripIfInteger'});
}, 'StripIfInteger');

assert.throws(RangeError, function() {
  new Intl.NumberFormat([], {trailingZeroDisplay: 'stripifinteger'});
}, 'stripifinteger');

assert.throws(RangeError, function() {
  new Intl.NumberFormat([], {trailingZeroDisplay: ' auto'});
}, '" auto" (with leading space)');

assert.throws(RangeError, function() {
  new Intl.NumberFormat([], {trailingZeroDisplay: 'auto '});
}, '"auto " (with trailing space)');

reportCompare(0, 0);