mirror of
https://github.com/tc39/test262.git
synced 2025-07-25 23:14:47 +02:00
fixup! Add tests for "Intl NumberFormat v3" proposal
This commit is contained in:
parent
c0ea82adf1
commit
396fc064d8
@ -0,0 +1,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: Abrupt completion from invalid values for `roundingMode`
|
||||||
|
features: [Intl.NumberFormat-v3]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
|
new Intl.NumberFormat('en', {roundingMode: null});
|
||||||
|
}, 'null');
|
||||||
|
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
|
new Intl.NumberFormat('en', {roundingMode: 3});
|
||||||
|
}, 'number');
|
||||||
|
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
|
new Intl.NumberFormat('en', {roundingMode: true});
|
||||||
|
}, 'boolean');
|
||||||
|
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
|
new Intl.NumberFormat('en', {roundingMode: 'HalfExpand'});
|
||||||
|
}, 'invalid string');
|
||||||
|
|
||||||
|
var symbol = Symbol('halfExpand');
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
new Intl.NumberFormat('en', {roundingMode: symbol});
|
||||||
|
}, 'Symbol');
|
||||||
|
|
||||||
|
var brokenToString = { toString: function() { throw new Test262Error(); } };
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
new Intl.NumberFormat('en', {roundingMode: brokenToString});
|
||||||
|
}, 'broken `toString` implementation');
|
Loading…
x
Reference in New Issue
Block a user