Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/Duration/from/argument-string-negative-fractional-units.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) 2021 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.duration.prototype.add
7 description: Strings with fractional duration units are treated with the correct sign
8 includes: [temporalHelpers.js]
9 features: [Temporal]
10 ---*/
11
12 const resultHours = Temporal.Duration.from("-PT24.567890123H");
13 TemporalHelpers.assertDuration(resultHours, 0, 0, 0, 0, -24, -34, -4, -404, -442, -800, "negative fractional hours");
14
15 const resultMinutes = Temporal.Duration.from("-PT1440.567890123M");
16 TemporalHelpers.assertDuration(resultMinutes, 0, 0, 0, 0, 0, -1440, -34, -73, -407, -380, "negative fractional minutes");
17
18 reportCompare(0, 0);