summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/Calendar/prototype/daysInMonth/branding.js
blob: 0a08a13ba840bc662081a83dedc2ad6fd325b125 (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
// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.calendar.prototype.daysinmonth
description: Throw a TypeError if the receiver is invalid
features: [Symbol, Temporal]
---*/

const daysInMonth = Temporal.Calendar.prototype.daysInMonth;

assert.sameValue(typeof daysInMonth, "function");

const args = [new Temporal.PlainDate(2000, 1, 1)];

assert.throws(TypeError, () => daysInMonth.apply(undefined, args), "undefined");
assert.throws(TypeError, () => daysInMonth.apply(null, args), "null");
assert.throws(TypeError, () => daysInMonth.apply(true, args), "true");
assert.throws(TypeError, () => daysInMonth.apply("", args), "empty string");
assert.throws(TypeError, () => daysInMonth.apply(Symbol(), args), "symbol");
assert.throws(TypeError, () => daysInMonth.apply(1, args), "1");
assert.throws(TypeError, () => daysInMonth.apply({}, args), "plain object");
assert.throws(TypeError, () => daysInMonth.apply(Temporal.Calendar, args), "Temporal.Calendar");
assert.throws(TypeError, () => daysInMonth.apply(Temporal.Calendar.prototype, args), "Temporal.Calendar.prototype");

reportCompare(0, 0);