mirror of
https://github.com/tc39/test262.git
synced 2025-07-16 02:24:38 +02:00
ISO strings may separate the time from the date with a case-insensitive T, or a space. This adds tests to all entry points that take ISO strings, to ensure that they accept an uppercase T, lowercase T, or space as the time separator. These tests are based on the one test for Temporal.PlainDateTime.from that was already present.
30 lines
817 B
JavaScript
30 lines
817 B
JavaScript
// 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.plaindatetime.compare
|
|
description: Time separator in string argument can vary
|
|
features: [Temporal]
|
|
---*/
|
|
|
|
const dateTime = new Temporal.PlainDateTime(1976, 11, 18, 15, 23);
|
|
const tests = [
|
|
["1976-11-18T15:23", "uppercase T"],
|
|
["1976-11-18t15:23", "lowercase T"],
|
|
["1976-11-18 15:23", "space between date and time"],
|
|
];
|
|
|
|
tests.forEach(([arg, description]) => {
|
|
assert.sameValue(
|
|
Temporal.PlainDateTime.compare(arg, dateTime),
|
|
0,
|
|
`variant time separators (${description}), first argument`
|
|
);
|
|
|
|
assert.sameValue(
|
|
Temporal.PlainDateTime.compare(dateTime, arg),
|
|
0,
|
|
`variant time separators (${description}), second argument`
|
|
);
|
|
});
|