blob: db746ccaa0f7306c9bc616dcf4ba2113b5e472fe [file] [log] [blame]
// 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.duration.prototype.with
description: A non-integer value for any recognized property in the property bag, throws a RangeError
features: [Temporal]
---*/
const instance = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 987, 654, 321);
const fields = [
"years",
"months",
"weeks",
"days",
"hours",
"minutes",
"seconds",
"milliseconds",
"microseconds",
"nanoseconds",
];
fields.forEach((field) => {
assert.throws(RangeError, () => instance.with({ [field]: 1.5 }));
assert.throws(RangeError, () => instance.with({ [field]: -1.5 }));
});