Temporal: Add tests for unknown annotation without critical flag

See https://github.com/tc39/proposal-temporal/pull/2397
Adds tests for ISO strings with unrecognized annotations, (i.e., neither
time zone nor calendar), in various combinations with recognized
annotations.
This commit is contained in:
Philip Chimento 2022-10-07 16:07:57 -07:00 committed by Ms2ger
parent 9d87845bb0
commit dc11e501d6
63 changed files with 1860 additions and 0 deletions

View File

@ -0,0 +1,30 @@
// 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.calendar.prototype.dateadd
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.Calendar("iso8601");
tests.forEach(([arg, description]) => {
const result = instance.dateAdd(arg, new Temporal.Duration());
TemporalHelpers.assertPlainDate(
result,
2000, 5, "M05", 2,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,30 @@
// 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.calendar.prototype.dateuntil
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.Calendar("iso8601");
tests.forEach(([arg, description]) => {
const result = instance.dateUntil(arg, arg);
TemporalHelpers.assertDuration(
result,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.calendar.prototype.day
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.Calendar("iso8601");
tests.forEach(([arg, description]) => {
const result = instance.day(arg);
assert.sameValue(
result,
2,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.calendar.prototype.dayofweek
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.Calendar("iso8601");
tests.forEach(([arg, description]) => {
const result = instance.dayOfWeek(arg);
assert.sameValue(
result,
2,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.calendar.prototype.dayofyear
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.Calendar("iso8601");
tests.forEach(([arg, description]) => {
const result = instance.dayOfYear(arg);
assert.sameValue(
result,
123,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.calendar.prototype.daysinmonth
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.Calendar("iso8601");
tests.forEach(([arg, description]) => {
const result = instance.daysInMonth(arg);
assert.sameValue(
result,
31,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.calendar.prototype.daysinweek
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.Calendar("iso8601");
tests.forEach(([arg, description]) => {
const result = instance.daysInWeek(arg);
assert.sameValue(
result,
7,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.calendar.prototype.daysinyear
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.Calendar("iso8601");
tests.forEach(([arg, description]) => {
const result = instance.daysInYear(arg);
assert.sameValue(
result,
366,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.calendar.prototype.inleapyear
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.Calendar("iso8601");
tests.forEach(([arg, description]) => {
const result = instance.inLeapYear(arg);
assert.sameValue(
result,
true,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.calendar.prototype.month
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.Calendar("iso8601");
tests.forEach(([arg, description]) => {
const result = instance.month(arg);
assert.sameValue(
result,
5,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.calendar.prototype.monthcode
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.Calendar("iso8601");
tests.forEach(([arg, description]) => {
const result = instance.monthCode(arg);
assert.sameValue(
result,
"M05",
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.calendar.prototype.monthsinyear
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.Calendar("iso8601");
tests.forEach(([arg, description]) => {
const result = instance.monthsInYear(arg);
assert.sameValue(
result,
12,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.calendar.prototype.weekofyear
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.Calendar("iso8601");
tests.forEach(([arg, description]) => {
const result = instance.weekOfYear(arg);
assert.sameValue(
result,
18,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.calendar.prototype.year
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.Calendar("iso8601");
tests.forEach(([arg, description]) => {
const result = instance.year(arg);
assert.sameValue(
result,
2000,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,26 @@
// 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.instant.compare
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["1970-01-01T00:00Z[foo=bar]", "alone"],
["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"],
["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"],
["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
tests.forEach(([arg, description]) => {
const result = Temporal.Instant.compare(arg, arg);
assert.sameValue(
result,
0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,26 @@
// 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.instant.from
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["1970-01-01T00:00Z[foo=bar]", "alone"],
["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"],
["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"],
["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
tests.forEach(([arg, description]) => {
const result = Temporal.Instant.from(arg);
assert.sameValue(
result.epochNanoseconds,
0n,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,28 @@
// 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.instant.prototype.equals
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["1970-01-01T00:00Z[foo=bar]", "alone"],
["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"],
["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"],
["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.Instant(0n);
tests.forEach(([arg, description]) => {
const result = instance.equals(arg);
assert.sameValue(
result,
true,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.instant.prototype.since
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["1970-01-01T00:00Z[foo=bar]", "alone"],
["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"],
["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"],
["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.Instant(0n);
tests.forEach(([arg, description]) => {
const result = instance.since(arg);
TemporalHelpers.assertDuration(
result,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.instant.prototype.until
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["1970-01-01T00:00Z[foo=bar]", "alone"],
["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"],
["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"],
["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.Instant(0n);
tests.forEach(([arg, description]) => {
const result = instance.until(arg);
TemporalHelpers.assertDuration(
result,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,27 @@
// 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.plaindate.compare
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
tests.forEach(([arg, description]) => {
const result = Temporal.PlainDate.compare(arg, arg);
assert.sameValue(
result,
0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,28 @@
// 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.plaindate.from
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
tests.forEach(([arg, description]) => {
const result = Temporal.PlainDate.from(arg);
TemporalHelpers.assertPlainDate(
result,
2000, 5, "M05", 2,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.plaindate.prototype.equals
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.PlainDate(2000, 5, 2);
tests.forEach(([arg, description]) => {
const result = instance.equals(arg);
assert.sameValue(
result,
true,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,30 @@
// 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.plaindate.prototype.since
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.PlainDate(2000, 5, 2);
tests.forEach(([arg, description]) => {
const result = instance.since(arg);
TemporalHelpers.assertDuration(
result,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,37 @@
// 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.plaindate.prototype.toplaindatetime
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["12:34:56.987654321[foo=bar]", "alone"],
["12:34:56.987654321[UTC][foo=bar]", "with time zone"],
["12:34:56.987654321[u-ca=iso8601][foo=bar]", "with calendar"],
["12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["T12:34:56.987654321[foo=bar]", "with T"],
["T12:34:56.987654321[UTC][foo=bar]", "with T and time zone"],
["T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with T and calendar"],
["T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with T, time zone, and calendar"],
["1970-01-01T12:34:56.987654321[foo=bar]", "with date"],
["1970-01-01T12:34:56.987654321[UTC][foo=bar]", "with date and time zone"],
["1970-01-01T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with date and calendar"],
["1970-01-01T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with date, time zone, and calendar"],
["1970-01-01T12:34:56.987654321[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.PlainDate(2000, 5, 2);
tests.forEach(([arg, description]) => {
const result = instance.toPlainDateTime(arg);
TemporalHelpers.assertPlainDateTime(
result,
2000, 5, "M05", 2, 12, 34, 56, 987, 654, 321,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,36 @@
// 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.plaindate.prototype.tozoneddatetime
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["12:34:56.987654321[foo=bar]", "alone"],
["12:34:56.987654321[UTC][foo=bar]", "with time zone"],
["12:34:56.987654321[u-ca=iso8601][foo=bar]", "with calendar"],
["12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["T12:34:56.987654321[foo=bar]", "with T"],
["T12:34:56.987654321[UTC][foo=bar]", "with T and time zone"],
["T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with T and calendar"],
["T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with T, time zone, and calendar"],
["1970-01-01T12:34:56.987654321[foo=bar]", "with date"],
["1970-01-01T12:34:56.987654321[UTC][foo=bar]", "with date and time zone"],
["1970-01-01T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with date and calendar"],
["1970-01-01T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with date, time zone, and calendar"],
["1970-01-01T12:34:56.987654321[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.PlainDate(2000, 5, 2);
tests.forEach(([arg, description]) => {
const result = instance.toZonedDateTime({ plainTime: arg, timeZone: "UTC" });
assert.sameValue(
result.epochNanoseconds,
957_270_896_987_654_321n,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,30 @@
// 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.plaindate.prototype.until
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.PlainDate(2000, 5, 2);
tests.forEach(([arg, description]) => {
const result = instance.until(arg);
TemporalHelpers.assertDuration(
result,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,26 @@
// 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: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["1976-11-18T15:23[foo=bar]", "alone"],
["1976-11-18T15:23[UTC][foo=bar]", "with time zone"],
["1976-11-18T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["1976-11-18T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["1976-11-18T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
tests.forEach(([arg, description]) => {
const result = Temporal.PlainDateTime.compare(arg, arg);
assert.sameValue(
result,
0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,27 @@
// 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.from
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["1976-11-18T15:23[foo=bar]", "alone"],
["1976-11-18T15:23[UTC][foo=bar]", "with time zone"],
["1976-11-18T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["1976-11-18T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["1976-11-18T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
tests.forEach(([arg, description]) => {
const result = Temporal.PlainDateTime.from(arg);
TemporalHelpers.assertPlainDateTime(
result,
1976, 11, "M11", 18, 15, 23, 0, 0, 0, 0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,28 @@
// 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.prototype.equals
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["1976-11-18T15:23[foo=bar]", "alone"],
["1976-11-18T15:23[UTC][foo=bar]", "with time zone"],
["1976-11-18T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["1976-11-18T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["1976-11-18T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23);
tests.forEach(([arg, description]) => {
const result = instance.equals(arg);
assert.sameValue(
result,
true,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.prototype.since
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["1976-11-18T15:23[foo=bar]", "alone"],
["1976-11-18T15:23[UTC][foo=bar]", "with time zone"],
["1976-11-18T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["1976-11-18T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["1976-11-18T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23);
tests.forEach(([arg, description]) => {
const result = instance.since(arg);
TemporalHelpers.assertDuration(
result,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.prototype.until
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["1976-11-18T15:23[foo=bar]", "alone"],
["1976-11-18T15:23[UTC][foo=bar]", "with time zone"],
["1976-11-18T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["1976-11-18T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["1976-11-18T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23);
tests.forEach(([arg, description]) => {
const result = instance.until(arg);
TemporalHelpers.assertDuration(
result,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,30 @@
// 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.prototype.withplaindate
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23);
tests.forEach(([arg, description]) => {
const result = instance.withPlainDate(arg);
TemporalHelpers.assertPlainDateTime(
result,
2000, 5, "M05", 2, 15, 23, 0, 0, 0, 0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,37 @@
// 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.prototype.withplaintime
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["12:34:56.987654321[foo=bar]", "alone"],
["12:34:56.987654321[UTC][foo=bar]", "with time zone"],
["12:34:56.987654321[u-ca=iso8601][foo=bar]", "with calendar"],
["12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["T12:34:56.987654321[foo=bar]", "with T"],
["T12:34:56.987654321[UTC][foo=bar]", "with T and time zone"],
["T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with T and calendar"],
["T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with T, time zone, and calendar"],
["1970-01-01T12:34:56.987654321[foo=bar]", "with date"],
["1970-01-01T12:34:56.987654321[UTC][foo=bar]", "with date and time zone"],
["1970-01-01T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with date and calendar"],
["1970-01-01T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with date, time zone, and calendar"],
["1970-01-01T12:34:56.987654321[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23);
tests.forEach(([arg, description]) => {
const result = instance.withPlainTime(arg);
TemporalHelpers.assertPlainDateTime(
result,
1976, 11, "M11", 18, 12, 34, 56, 987, 654, 321,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,27 @@
// 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.plainmonthday.from
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["1976-05-02T15:23[foo=bar]", "alone"],
["1976-05-02T15:23[UTC][foo=bar]", "with time zone"],
["1976-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["1976-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["1976-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
tests.forEach(([arg, description]) => {
const result = Temporal.PlainMonthDay.from(arg);
TemporalHelpers.assertPlainMonthDay(
result,
"M05", 2,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,28 @@
// 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.plainmonthday.prototype.equals
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["1976-05-02T15:23[foo=bar]", "alone"],
["1976-05-02T15:23[UTC][foo=bar]", "with time zone"],
["1976-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["1976-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["1976-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.PlainMonthDay(5, 2);
tests.forEach(([arg, description]) => {
const result = instance.equals(arg);
assert.sameValue(
result,
true,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,34 @@
// 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.compare
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["12:34:56.987654321[foo=bar]", "alone"],
["12:34:56.987654321[UTC][foo=bar]", "with time zone"],
["12:34:56.987654321[u-ca=iso8601][foo=bar]", "with calendar"],
["12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["T12:34:56.987654321[foo=bar]", "with T"],
["T12:34:56.987654321[UTC][foo=bar]", "with T and time zone"],
["T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with T and calendar"],
["T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with T, time zone, and calendar"],
["1970-01-01T12:34:56.987654321[foo=bar]", "with date"],
["1970-01-01T12:34:56.987654321[UTC][foo=bar]", "with date and time zone"],
["1970-01-01T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with date and calendar"],
["1970-01-01T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with date, time zone, and calendar"],
["1970-01-01T12:34:56.987654321[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
tests.forEach(([arg, description]) => {
const result = Temporal.PlainTime.compare(arg, arg);
assert.sameValue(
result,
0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,35 @@
// 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.from
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["12:34:56.987654321[foo=bar]", "alone"],
["12:34:56.987654321[UTC][foo=bar]", "with time zone"],
["12:34:56.987654321[u-ca=iso8601][foo=bar]", "with calendar"],
["12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["T12:34:56.987654321[foo=bar]", "with T"],
["T12:34:56.987654321[UTC][foo=bar]", "with T and time zone"],
["T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with T and calendar"],
["T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with T, time zone, and calendar"],
["1970-01-01T12:34:56.987654321[foo=bar]", "with date"],
["1970-01-01T12:34:56.987654321[UTC][foo=bar]", "with date and time zone"],
["1970-01-01T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with date and calendar"],
["1970-01-01T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with date, time zone, and calendar"],
["1970-01-01T12:34:56.987654321[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
tests.forEach(([arg, description]) => {
const result = Temporal.PlainTime.from(arg);
TemporalHelpers.assertPlainTime(
result,
12, 34, 56, 987, 654, 321,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,36 @@
// 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.equals
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["12:34:56.987654321[foo=bar]", "alone"],
["12:34:56.987654321[UTC][foo=bar]", "with time zone"],
["12:34:56.987654321[u-ca=iso8601][foo=bar]", "with calendar"],
["12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["T12:34:56.987654321[foo=bar]", "with T"],
["T12:34:56.987654321[UTC][foo=bar]", "with T and time zone"],
["T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with T and calendar"],
["T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with T, time zone, and calendar"],
["1970-01-01T12:34:56.987654321[foo=bar]", "with date"],
["1970-01-01T12:34:56.987654321[UTC][foo=bar]", "with date and time zone"],
["1970-01-01T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with date and calendar"],
["1970-01-01T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with date, time zone, and calendar"],
["1970-01-01T12:34:56.987654321[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
tests.forEach(([arg, description]) => {
const result = instance.equals(arg);
assert.sameValue(
result,
true,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,37 @@
// 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.since
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["12:34:56.987654321[foo=bar]", "alone"],
["12:34:56.987654321[UTC][foo=bar]", "with time zone"],
["12:34:56.987654321[u-ca=iso8601][foo=bar]", "with calendar"],
["12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["T12:34:56.987654321[foo=bar]", "with T"],
["T12:34:56.987654321[UTC][foo=bar]", "with T and time zone"],
["T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with T and calendar"],
["T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with T, time zone, and calendar"],
["1970-01-01T12:34:56.987654321[foo=bar]", "with date"],
["1970-01-01T12:34:56.987654321[UTC][foo=bar]", "with date and time zone"],
["1970-01-01T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with date and calendar"],
["1970-01-01T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with date, time zone, and calendar"],
["1970-01-01T12:34:56.987654321[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
tests.forEach(([arg, description]) => {
const result = instance.since(arg);
TemporalHelpers.assertDuration(
result,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,30 @@
// 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.toplaindatetime
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
tests.forEach(([arg, description]) => {
const result = instance.toPlainDateTime(arg);
TemporalHelpers.assertPlainDateTime(
result,
2000, 5, "M05", 2, 12, 34, 56, 987, 654, 321,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.tozoneddatetime
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
tests.forEach(([arg, description]) => {
const result = instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" });
assert.sameValue(
result.epochNanoseconds,
957_270_896_987_654_321n,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,37 @@
// 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.until
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["12:34:56.987654321[foo=bar]", "alone"],
["12:34:56.987654321[UTC][foo=bar]", "with time zone"],
["12:34:56.987654321[u-ca=iso8601][foo=bar]", "with calendar"],
["12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["T12:34:56.987654321[foo=bar]", "with T"],
["T12:34:56.987654321[UTC][foo=bar]", "with T and time zone"],
["T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with T and calendar"],
["T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with T, time zone, and calendar"],
["1970-01-01T12:34:56.987654321[foo=bar]", "with date"],
["1970-01-01T12:34:56.987654321[UTC][foo=bar]", "with date and time zone"],
["1970-01-01T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with date and calendar"],
["1970-01-01T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with date, time zone, and calendar"],
["1970-01-01T12:34:56.987654321[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
tests.forEach(([arg, description]) => {
const result = instance.until(arg);
TemporalHelpers.assertDuration(
result,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,26 @@
// 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.plainyearmonth.compare
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2019-12-15T15:23[foo=bar]", "alone"],
["2019-12-15T15:23[UTC][foo=bar]", "with time zone"],
["2019-12-15T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2019-12-15T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2019-12-15T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
tests.forEach(([arg, description]) => {
const result = Temporal.PlainYearMonth.compare(arg, arg);
assert.sameValue(
result,
0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,27 @@
// 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.plainyearmonth.from
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["2019-12-15T15:23[foo=bar]", "alone"],
["2019-12-15T15:23[UTC][foo=bar]", "with time zone"],
["2019-12-15T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2019-12-15T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2019-12-15T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
tests.forEach(([arg, description]) => {
const result = Temporal.PlainYearMonth.from(arg);
TemporalHelpers.assertPlainYearMonth(
result,
2019, 12, "M12",
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,28 @@
// 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.plainyearmonth.prototype.equals
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2019-12-15T15:23[foo=bar]", "alone"],
["2019-12-15T15:23[UTC][foo=bar]", "with time zone"],
["2019-12-15T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2019-12-15T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2019-12-15T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.PlainYearMonth(2019, 12);
tests.forEach(([arg, description]) => {
const result = instance.equals(arg);
assert.sameValue(
result,
true,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.plainyearmonth.prototype.since
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["2019-12-15T15:23[foo=bar]", "alone"],
["2019-12-15T15:23[UTC][foo=bar]", "with time zone"],
["2019-12-15T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2019-12-15T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2019-12-15T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.PlainYearMonth(2019, 12);
tests.forEach(([arg, description]) => {
const result = instance.since(arg);
TemporalHelpers.assertDuration(
result,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.plainyearmonth.prototype.until
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["2019-12-15T15:23[foo=bar]", "alone"],
["2019-12-15T15:23[UTC][foo=bar]", "with time zone"],
["2019-12-15T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2019-12-15T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2019-12-15T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.PlainYearMonth(2019, 12);
tests.forEach(([arg, description]) => {
const result = instance.until(arg);
TemporalHelpers.assertDuration(
result,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,28 @@
// 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.timezone.prototype.getinstantfor
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["1976-11-18T15:23[foo=bar]", "alone"],
["1976-11-18T15:23[UTC][foo=bar]", "with time zone"],
["1976-11-18T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["1976-11-18T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["1976-11-18T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.TimeZone("UTC");
tests.forEach(([arg, description]) => {
const result = instance.getInstantFor(arg);
assert.sameValue(
result.epochNanoseconds,
217_178_580_000_000_000n,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,28 @@
// 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.timezone.prototype.getnexttransition
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["1970-01-01T00:00Z[foo=bar]", "alone"],
["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"],
["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"],
["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.TimeZone("UTC");
tests.forEach(([arg, description]) => {
const result = instance.getNextTransition(arg);
assert.sameValue(
result,
null,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,28 @@
// 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.timezone.prototype.getoffsetnanosecondsfor
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["1970-01-01T00:00Z[foo=bar]", "alone"],
["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"],
["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"],
["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.TimeZone("UTC");
tests.forEach(([arg, description]) => {
const result = instance.getOffsetNanosecondsFor(arg);
assert.sameValue(
result,
0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,28 @@
// 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.timezone.prototype.getoffsetstringfor
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["1970-01-01T00:00Z[foo=bar]", "alone"],
["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"],
["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"],
["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.TimeZone("UTC");
tests.forEach(([arg, description]) => {
const result = instance.getOffsetStringFor(arg);
assert.sameValue(
result,
"+00:00",
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.timezone.prototype.getplaindatetimefor
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["1970-01-01T00:00Z[foo=bar]", "alone"],
["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"],
["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"],
["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.TimeZone("UTC");
tests.forEach(([arg, description]) => {
const result = instance.getPlainDateTimeFor(arg);
TemporalHelpers.assertPlainDateTime(
result,
1970, 1, "M01", 1, 0, 0, 0, 0, 0, 0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.timezone.prototype.getpossibleinstantsfor
description: Various forms of unknown annotation
features: [Temporal]
includes: [compareArray.js]
---*/
const tests = [
["1976-11-18T15:23[foo=bar]", "alone"],
["1976-11-18T15:23[UTC][foo=bar]", "with time zone"],
["1976-11-18T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["1976-11-18T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["1976-11-18T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.TimeZone("UTC");
tests.forEach(([arg, description]) => {
const result = instance.getPossibleInstantsFor(arg);
assert.compareArray(
result.map(i => i.epochNanoseconds),
[217_178_580_000_000_000n],
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,28 @@
// 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.timezone.prototype.getprevioustransition
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["1970-01-01T00:00Z[foo=bar]", "alone"],
["1970-01-01T00:00Z[UTC][foo=bar]", "with time zone"],
["1970-01-01T00:00Z[u-ca=iso8601][foo=bar]", "with calendar"],
["1970-01-01T00:00Z[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["1970-01-01T00:00Z[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.TimeZone("UTC");
tests.forEach(([arg, description]) => {
const result = instance.getPreviousTransition(arg);
assert.sameValue(
result,
null,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,25 @@
// 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.zoneddatetime.compare
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["1970-01-01T00:00[UTC][foo=bar]", "with time zone"],
["1970-01-01T00:00[UTC][foo=bar][u-ca=iso8601]", "before calendar"],
["1970-01-01T00:00[UTC][u-ca=iso8601][foo=bar]", "after calendar"],
["1970-01-01T00:00[UTC][foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
tests.forEach(([arg, description]) => {
const result = Temporal.ZonedDateTime.compare(arg, arg);
assert.sameValue(
result,
0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,25 @@
// 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.zoneddatetime.from
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["1970-01-01T00:00[UTC][foo=bar]", "with time zone"],
["1970-01-01T00:00[UTC][foo=bar][u-ca=iso8601]", "before calendar"],
["1970-01-01T00:00[UTC][u-ca=iso8601][foo=bar]", "after calendar"],
["1970-01-01T00:00[UTC][foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
tests.forEach(([arg, description]) => {
const result = Temporal.ZonedDateTime.from(arg);
assert.sameValue(
result.epochNanoseconds,
0n,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,28 @@
// 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.zoneddatetime.prototype.equals
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["1970-01-01T00:00[UTC][foo=bar]", "with time zone"],
["1970-01-01T00:00[UTC][foo=bar][u-ca=iso8601]", "before calendar"],
["1970-01-01T00:00[UTC][u-ca=iso8601][foo=bar]", "after calendar"],
["1970-01-01T00:00[UTC][foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const timeZone = new Temporal.TimeZone("UTC");
const instance = new Temporal.ZonedDateTime(0n, timeZone);
tests.forEach(([arg, description]) => {
const result = instance.equals(arg);
assert.sameValue(
result,
true,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.zoneddatetime.prototype.since
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["1970-01-01T00:00[UTC][foo=bar]", "with time zone"],
["1970-01-01T00:00[UTC][foo=bar][u-ca=iso8601]", "before calendar"],
["1970-01-01T00:00[UTC][u-ca=iso8601][foo=bar]", "after calendar"],
["1970-01-01T00:00[UTC][foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const timeZone = new Temporal.TimeZone("UTC");
const instance = new Temporal.ZonedDateTime(0n, timeZone);
tests.forEach(([arg, description]) => {
const result = instance.since(arg);
TemporalHelpers.assertDuration(
result,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.zoneddatetime.prototype.until
description: Various forms of unknown annotation
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["1970-01-01T00:00[UTC][foo=bar]", "with time zone"],
["1970-01-01T00:00[UTC][foo=bar][u-ca=iso8601]", "before calendar"],
["1970-01-01T00:00[UTC][u-ca=iso8601][foo=bar]", "after calendar"],
["1970-01-01T00:00[UTC][foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const timeZone = new Temporal.TimeZone("UTC");
const instance = new Temporal.ZonedDateTime(0n, timeZone);
tests.forEach(([arg, description]) => {
const result = instance.until(arg);
TemporalHelpers.assertDuration(
result,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,30 @@
// 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.zoneddatetime.prototype.withplaindate
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const timeZone = new Temporal.TimeZone("UTC");
const instance = new Temporal.ZonedDateTime(0n, timeZone);
tests.forEach(([arg, description]) => {
const result = instance.withPlainDate(arg);
assert.sameValue(
result.epochNanoseconds,
957_225_600_000_000_000n,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,37 @@
// 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.zoneddatetime.prototype.withplaintime
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["12:34:56.987654321[foo=bar]", "alone"],
["12:34:56.987654321[UTC][foo=bar]", "with time zone"],
["12:34:56.987654321[u-ca=iso8601][foo=bar]", "with calendar"],
["12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["T12:34:56.987654321[foo=bar]", "with T"],
["T12:34:56.987654321[UTC][foo=bar]", "with T and time zone"],
["T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with T and calendar"],
["T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with T, time zone, and calendar"],
["1970-01-01T12:34:56.987654321[foo=bar]", "with date"],
["1970-01-01T12:34:56.987654321[UTC][foo=bar]", "with date and time zone"],
["1970-01-01T12:34:56.987654321[u-ca=iso8601][foo=bar]", "with date and calendar"],
["1970-01-01T12:34:56.987654321[UTC][foo=bar][u-ca=iso8601]", "with date, time zone, and calendar"],
["1970-01-01T12:34:56.987654321[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const timeZone = new Temporal.TimeZone("UTC");
const instance = new Temporal.ZonedDateTime(0n, timeZone);
tests.forEach(([arg, description]) => {
const result = instance.withPlainTime(arg);
assert.sameValue(
result.epochNanoseconds,
45_296_987_654_321n,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.calendar.prototype.era
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.Calendar("iso8601");
tests.forEach(([arg, description]) => {
const result = instance.era(arg);
assert.sameValue(
result,
undefined,
`unknown annotation (${description})`
);
});

View File

@ -0,0 +1,29 @@
// 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.calendar.prototype.erayear
description: Various forms of unknown annotation
features: [Temporal]
---*/
const tests = [
["2000-05-02[foo=bar]", "without time"],
["2000-05-02T15:23[foo=bar]", "alone"],
["2000-05-02T15:23[UTC][foo=bar]", "with time zone"],
["2000-05-02T15:23[u-ca=iso8601][foo=bar]", "with calendar"],
["2000-05-02T15:23[UTC][foo=bar][u-ca=iso8601]", "with time zone and calendar"],
["2000-05-02T15:23[foo=bar][_foo-bar0=Ignore-This-999999999999]", "with another unknown annotation"],
];
const instance = new Temporal.Calendar("iso8601");
tests.forEach(([arg, description]) => {
const result = instance.eraYear(arg);
assert.sameValue(
result,
undefined,
`unknown annotation (${description})`
);
});