summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/PlainYearMonth/prototype/since/options-invalid.js
blob: 822d4570a1fcf4d310cd54f7a1391cbdb84426a8 (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
// |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.plainyearmonth.prototype.since
description: Verify that invalid options are handled correctly.
features: [Temporal]
---*/

const feb20 = new Temporal.PlainYearMonth(2020, 2);
const feb21 = new Temporal.PlainYearMonth(2021, 2);

[
  null,
  1,
  'hello',
  true,
  Symbol('foo'),
  1n
].forEach((badOption) =>
  assert.throws(TypeError, () => feb21.since(feb20, badOption), `${String(badOption)} throws TypeError`)
);

reportCompare(0, 0);