blob: bb20845bc981d3f9c8e6ba967c379c9ef98b27d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// Copyright (C) 2018 Ujjwal Sharma. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-intl.numberformat.prototype.format
description: >
Tests that Intl.NumberFormat.prototype.format throws a TypeError
if called on a non-object value or an object that hasn't been
initialized as a NumberFormat.
---*/
const invalidTargets = [undefined, null, true, 0, 'NumberFormat', [], {}, Symbol()];
const fn = Object.getOwnPropertyDescriptor(Intl.NumberFormat.prototype, 'format').get;
invalidTargets.forEach(target => {
assert.throws(
TypeError,
() => fn.call(target),
`Calling format getter on ${String(target)} should throw a TypeError.`
);
});
reportCompare(0, 0);
|