1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
2 // Copyright (C) 2021 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
6 description: Temporal.Duration throws a RangeError if any value is fractional
7 esid: sec-temporal.duration
11 const descriptions = [
22 ].map((time) => `Duration constructor throws RangeError with fractional value in the ${time} position`);
24 assert.throws(RangeError, () => new Temporal.Duration(1.1), descriptions[0]);
25 assert.throws(RangeError, () => new Temporal.Duration(0, 1.1), descriptions[1]);
26 assert.throws(RangeError, () => new Temporal.Duration(0, 0, 1.1), descriptions[2]);
27 assert.throws(RangeError, () => new Temporal.Duration(0, 0, 0, 1.1), descriptions[3]);
28 assert.throws(RangeError, () => new Temporal.Duration(0, 0, 0, 0, 1.1), descriptions[4]);
29 assert.throws(RangeError, () => new Temporal.Duration(0, 0, 0, 0, 0, 1.1), descriptions[5]);
30 assert.throws(RangeError, () => new Temporal.Duration(0, 0, 0, 0, 0, 0, 1.1), descriptions[6]);
31 assert.throws(RangeError, () => new Temporal.Duration(0, 0, 0, 0, 0, 0, 0, 1.1), descriptions[7]);
32 assert.throws(RangeError, () => new Temporal.Duration(0, 0, 0, 0, 0, 0, 0, 0, 1.1), descriptions[8]);
33 assert.throws(RangeError, () => new Temporal.Duration(0, 0, 0, 0, 0, 0, 0, 0, 0, 1.1), descriptions[9]);