node/deps/v8/test/mjsunit/temporal/plain-date-time-get-iso-fields.js
Michaël Zasso 270253c4e2
deps: update V8 to 9.7.106.18
PR-URL: https://github.com/nodejs/node/pull/40907
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2022-01-20 10:38:37 +01:00

51 lines
1.7 KiB
JavaScript

// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-temporal
d8.file.execute('test/mjsunit/temporal/temporal-helpers.js');
assertPlainDateTime(new Temporal.PlainDateTime(1, 2, 3, 4, 5, 6, 7, 8, 9),
1, 2, 3, 4, 5, 6, 7, 8, 9);
assertPlainDateTime(new Temporal.PlainDateTime(1, 2, 3, 4, 5, 6, 7, 8),
1, 2, 3, 4, 5, 6, 7, 8, 0);
assertPlainDateTime(new Temporal.PlainDateTime(1, 2, 3, 4, 5, 6, 7),
1, 2, 3, 4, 5, 6, 7, 0, 0);
assertPlainDateTime(new Temporal.PlainDateTime(1, 2, 3, 4, 5, 6),
1, 2, 3, 4, 5, 6, 0, 0, 0);
assertPlainDateTime(new Temporal.PlainDateTime(1, 2, 3, 4, 5),
1, 2, 3, 4, 5, 0, 0, 0, 0);
assertPlainDateTime(new Temporal.PlainDateTime(1, 2, 3, 4),
1, 2, 3, 4, 0, 0, 0, 0, 0);
assertPlainDateTime(new Temporal.PlainDateTime(1, 2, 3),
1, 2, 3, 0, 0, 0, 0, 0, 0);
assertThrows(() => new Temporal.PlainDateTime(1, 2), RangeError);
assertThrows(() => new Temporal.PlainDateTime(1), RangeError);
assertThrows(() => new Temporal.PlainDateTime(), RangeError);
// smallest values
assertPlainDateTime(new Temporal.PlainDateTime(-25406, 1, 1),
-25406, 1, 1, 0, 0, 0, 0, 0, 0);
// largest values
assertPlainDateTime(
new Temporal.PlainDateTime(29345, 12, 31, 23, 59, 59, 999, 999, 999),
29345, 12, 31, 23, 59, 59, 999, 999, 999);
assertPlainDateTime(
new Temporal.PlainDateTime(false, true, true, NaN, undefined, true),
0, 1, 1, 0, 0, 1, 0, 0, 0, 0);
assertPlainDateTime(
new Temporal.PlainDateTime(11.9, 12.8, 13.7, 14.6, 15.5, 16.6, 17.7, 18.8,
1.999999), 11, 12, 13, 14, 15, 16, 17, 18, 1);