summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/Duration/from/argument-non-string.js
blob: 3d53993e4e3922301a7942624b202df366ee9d3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
// Copyright (C) 2020 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.duration.from
description: Appropriate error thrown if primitive input cannot convert to a valid string
features: [Temporal]
---*/

assert.throws(TypeError, () => Temporal.Duration.from(undefined), "undefined");
assert.throws(TypeError, () => Temporal.Duration.from(null), "null");
assert.throws(TypeError, () => Temporal.Duration.from(true), "boolean");
assert.throws(TypeError, () => Temporal.Duration.from(Symbol()), "Symbol");
assert.throws(TypeError, () => Temporal.Duration.from(5), "number");
assert.throws(TypeError, () => Temporal.Duration.from(5n), "bigint");

reportCompare(0, 0);