diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Temporal/PlainTime/prototype/subtract/argument-higher-units.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Temporal/PlainTime/prototype/subtract/argument-higher-units.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Temporal/PlainTime/prototype/subtract/argument-higher-units.js b/js/src/tests/test262/built-ins/Temporal/PlainTime/prototype/subtract/argument-higher-units.js new file mode 100644 index 0000000000..43588561a9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Temporal/PlainTime/prototype/subtract/argument-higher-units.js @@ -0,0 +1,32 @@ +// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.subtract +description: Higher units are ignored. +includes: [temporalHelpers.js] +features: [Temporal] +---*/ + +const plainTime = new Temporal.PlainTime(15, 23, 30, 123, 456, 789); +const values = [ + new Temporal.Duration(0, 0, 0, 1), + new Temporal.Duration(0, 0, 1), + new Temporal.Duration(0, 1), + new Temporal.Duration(1), + { days: 1 }, + { weeks: 1 }, + { months: 1 }, + { years: 1 }, + "P1D", + "P1W", + "P1M", + "P1Y", +]; +for (const value of values) { + TemporalHelpers.assertPlainTime(plainTime.subtract(value), + 15, 23, 30, 123, 456, 789); +} + +reportCompare(0, 0); |