v8/test/mjsunit/temporal/plain-date-time-get-iso-fields.js
Frank Tang 790d55486b [Temporal] Add some tests for PlainDateTime
Land some of the tests for Temporal.PlainDateTime
All marked as FAIL at this stage.

Bug: v8:11544
Change-Id: I09bf681e61f19d96607c848ddcb6bee06580aff1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3085625
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77332}
2021-10-12 08:48:20 +00: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);