Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainTime/from/argument-object.js

raw
1 // |reftest| shell-option(--enable-temporal) skip-if(!this.hasOwnProperty('Temporal')||!xulRuntime.shell) -- Temporal is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2022 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-temporal.plaintime.from
7 description: Plain object argument is supported and ignores plural properties
8 includes: [temporalHelpers.js]
9 features: [Temporal]
10 ---*/
11
12 TemporalHelpers.assertPlainTime(Temporal.PlainTime.from({ hour: 15, minute: 23 }),
13 15, 23, 0, 0, 0, 0);
14 TemporalHelpers.assertPlainTime(Temporal.PlainTime.from({ minute: 30, microsecond: 555 }),
15 0, 30, 0, 0, 555, 0);
16 TemporalHelpers.assertPlainTime(Temporal.PlainTime.from({ year: 2019, month: 10, day: 1, hour: 14, minute: 20, second: 36 }),
17 14, 20, 36, 0, 0, 0);
18 TemporalHelpers.assertPlainTime(Temporal.PlainTime.from({ hours: 2, minute: 30, microsecond: 555 }),
19 0, 30, 0, 0, 555, 0);
20
21 assert.throws(TypeError, () => Temporal.PlainTime.from({}));
22 assert.throws(TypeError, () => Temporal.PlainTime.from({ minutes: 12 }));
23
24 reportCompare(0, 0);