summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/DateTimeFormat/prototype/formatRangeToParts/this-bad-object.js
blob: 21f29b4541734a5b611d809b92931f5367aee265 (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
// Copyright 2019 Igalia, S.L. All rights reserved.
// This code is governed by the license found in the LICENSE file.

/*---
description: >
  Throws a TypeError if this is not a DateTimeFormat object
features: [Intl.DateTimeFormat-formatRange]
---*/

const formatRangeToParts = Intl.DateTimeFormat.prototype.formatRangeToParts;

assert.throws(TypeError, function() {
  formatRangeToParts.call({});
}, "{}");

assert.throws(TypeError, function() {
  formatRangeToParts.call(new Date());
}, "new Date()");

assert.throws(TypeError, function() {
  formatRangeToParts.call(Intl.DateTimeFormat);
}, "Intl.DateTimeFormat");

assert.throws(TypeError, function() {
  formatRangeToParts.call(Intl.DateTimeFormat.prototype);
}, "Intl.DateTimeFormat.prototype");

reportCompare(0, 0);