mirror of
https://github.com/tc39/test262.git
synced 2025-07-26 23:44:27 +02:00
Test TypeError is thrown when getOffsetNanosecondsFor is not callable
Tests for the normative changes made to Temporal in https://github.com/tc39/proposal-temporal/pull/1829 In a previous version of the specification, there was a fallback to the intrinsic getOffsetNanosecondsFor when it was undefined.
This commit is contained in:
parent
171d4382de
commit
ae53326189
@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const calendar = new Temporal.Calendar("iso8601");
|
||||
const duration = new Temporal.Duration(1);
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => calendar.dateAdd(datetime, duration),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,27 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const calendar = new Temporal.Calendar("iso8601");
|
||||
const date = new Temporal.PlainDate(2000, 5, 2);
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => calendar.dateUntil(datetime, date),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => calendar.dateUntil(date, datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const calendar = new Temporal.Calendar("iso8601");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => calendar.day(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const calendar = new Temporal.Calendar("iso8601");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => calendar.dayOfWeek(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const calendar = new Temporal.Calendar("iso8601");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => calendar.dayOfYear(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const calendar = new Temporal.Calendar("iso8601");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => calendar.daysInMonth(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const calendar = new Temporal.Calendar("iso8601");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => calendar.daysInWeek(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const calendar = new Temporal.Calendar("iso8601");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => calendar.daysInYear(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const calendar = new Temporal.Calendar("iso8601");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => calendar.inLeapYear(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const calendar = new Temporal.Calendar("iso8601");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => calendar.month(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const calendar = new Temporal.Calendar("iso8601");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => calendar.monthCode(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const calendar = new Temporal.Calendar("iso8601");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => calendar.monthsInYear(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const calendar = new Temporal.Calendar("iso8601");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => calendar.weekOfYear(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const calendar = new Temporal.Calendar("iso8601");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => calendar.year(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-temporal.duration.compare
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach(notCallable => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const duration1 = new Temporal.Duration(1);
|
||||
const duration2 = new Temporal.Duration(1, 1);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.Duration.compare(duration1, duration2, { relativeTo: { year: 2000, month: 5, day: 2, hour: 12, timeZone } }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-temporal.duration.compare
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach(notCallable => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const relativeTo = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
const duration1 = new Temporal.Duration(1);
|
||||
const duration2 = new Temporal.Duration(1, 1);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.Duration.compare(duration1, duration2, { relativeTo }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.add
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const duration = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 987, 654, 321);
|
||||
const other = new Temporal.Duration(2);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => duration.add(other, { relativeTo: { year: 2000, month: 5, day: 2, hour: 12, timeZone } }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.add
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const duration = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 987, 654, 321);
|
||||
const other = new Temporal.Duration(2);
|
||||
const relativeTo = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => duration.add(other, { relativeTo }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.round
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const duration = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 987, 654, 321);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => duration.round({ smallestUnit: "seconds", relativeTo: { year: 2000, month: 5, day: 2, hour: 12, timeZone } }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.round
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const duration = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 987, 654, 321);
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => duration.round({ smallestUnit: "seconds", relativeTo: datetime }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.subtract
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const duration = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 987, 654, 321);
|
||||
const other = new Temporal.Duration(0, 3);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => duration.subtract(other, { relativeTo: { year: 2000, month: 5, day: 2, hour: 12, timeZone } }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.subtract
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const duration = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 987, 654, 321);
|
||||
const other = new Temporal.Duration(0, 3);
|
||||
const relativeTo = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => duration.subtract(other, { relativeTo }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.total
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const duration = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 987, 654, 321);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => duration.total({ unit: "seconds", relativeTo: { year: 2000, month: 5, day: 2, hour: 12, timeZone } }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.total
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const duration = new Temporal.Duration(1, 2, 3, 4, 5, 6, 7, 987, 654, 321);
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => duration.total({ unit: "seconds", relativeTo: datetime }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.instant.prototype.tojson
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Instant(1_000_000_000_987_654_321n);
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
Temporal.TimeZone.prototype.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => instance.toJSON(),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.instant.prototype.tostring
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const instant = new Temporal.Instant(1_000_000_000_987_654_321n);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => instant.toString({ timeZone }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-temporal.now.plaindate
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach(notCallable => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.Now.plainDate('iso8601', timeZone),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-temporal.now.plaindateiso
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach(notCallable => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.Now.plainDateISO(timeZone),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-temporal.now.plaindatetime
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach(notCallable => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.Now.plainDateTime('iso8601', timeZone),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-temporal.now.plaindatetimeiso
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach(notCallable => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.Now.plainDateTimeISO(timeZone),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-temporal.now.plaintimeiso
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach(notCallable => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.Now.plainTimeISO(timeZone),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,25 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
const date = new Temporal.PlainDate(2000, 5, 2);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.PlainDate.compare(datetime, date),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.PlainDate.compare(date, datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach(notCallable => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.PlainDate.from(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const date = new Temporal.PlainDate(2000, 5, 2);
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => date.equals(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const date = new Temporal.PlainDate(2000, 5, 2);
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => date.since(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const date = new Temporal.PlainDate(2000, 5, 2);
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => date.toPlainDateTime(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const date = new Temporal.PlainDate(2000, 5, 2);
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => date.toZonedDateTime({ plainTime: datetime, timeZone: "UTC" }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,23 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const date = new Temporal.PlainDate(2000, 5, 2);
|
||||
const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
timeZone.getPossibleInstantsFor = function () {
|
||||
return [];
|
||||
};
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => date.toZonedDateTime({ plainTime, timeZone }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const date = new Temporal.PlainDate(2000, 5, 2);
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => date.until(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,25 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
const plain = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.PlainDateTime.compare(datetime, plain),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.PlainDateTime.compare(plain, datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach(notCallable => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.PlainDateTime.from(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const plain = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
const zoned = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => plain.equals(zoned),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const plain = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
const zoned = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => plain.since(zoned),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,22 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindatetime.prototype.tozoneddatetime
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
timeZone.getPossibleInstantsFor = function () {
|
||||
return [];
|
||||
};
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.toZonedDateTime(timeZone),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const plain = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
const zoned = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => plain.until(zoned),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const plain = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
const zoned = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => plain.withPlainDate(zoned),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const plain = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
const zoned = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => plain.withPlainTime(zoned),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,25 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
const time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.PlainTime.compare(datetime, time),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.PlainTime.compare(time, datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach(notCallable => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.PlainTime.from(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => time.equals(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => time.since(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => time.toPlainDateTime(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => time.toZonedDateTime({ plainDate: datetime, timeZone: "UTC" }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,23 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
const plainDate = new Temporal.PlainDate(2000, 5, 2);
|
||||
timeZone.getPossibleInstantsFor = function () {
|
||||
return [];
|
||||
};
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => time.toZonedDateTime({ plainDate, timeZone }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const time = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => time.until(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
const builtinTimeZone = new Temporal.TimeZone("UTC");
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => builtinTimeZone.getInstantFor(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -1,13 +0,0 @@
|
||||
// Copyright (C) 2020 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: Fall back to calling intrinsic getOffsetNanosecondsFor() when method is deleted
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instant = Temporal.Instant.from("1975-02-02T14:25:36.123456789Z");
|
||||
const timeZone = Temporal.TimeZone.from("Europe/Madrid");
|
||||
timeZone.getOffsetNanosecondsFor = undefined;
|
||||
assert.sameValue(timeZone.getOffsetStringFor(instant), "+01:00");
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const instant = new Temporal.Instant(1_000_000_000_987_654_321n);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => timeZone.getOffsetStringFor(instant),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -1,15 +0,0 @@
|
||||
// Copyright (C) 2020 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: Fall back to calling intrinsic getOffsetNanosecondsFor() when method is deleted
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instant = Temporal.Instant.from("1975-02-02T14:25:36.123456789Z");
|
||||
const timeZone = Temporal.TimeZone.from("Europe/Madrid");
|
||||
timeZone.getOffsetNanosecondsFor = undefined;
|
||||
const result = timeZone.getPlainDateTimeFor(instant);
|
||||
TemporalHelpers.assertPlainDateTime(result, 1975, 2, "M02", 2, 15, 25, 36, 123, 456, 789);
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const instant = new Temporal.Instant(1_000_000_000_987_654_321n);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => timeZone.getPlainDateTimeFor(instant),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
const builtinTimeZone = new Temporal.TimeZone("UTC");
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => builtinTimeZone.getPossibleInstantsFor(datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,28 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
Temporal.TimeZone.prototype.getPossibleInstantsFor = function () {
|
||||
return [];
|
||||
};
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.ZonedDateTime.compare({ year: 2000, month: 5, day: 2, hour: 12, timeZone }, datetime),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.ZonedDateTime.compare(datetime, { year: 2000, month: 5, day: 2, hour: 12, timeZone }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,32 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach(notCallable => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, hour: 12, offset: "+00:00", timeZone }, { offset: "prefer" }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError (in offset=prefer and no disambiguation case)`
|
||||
);
|
||||
|
||||
const badTimeZone = {
|
||||
getPossibleInstantsFor() { return []; },
|
||||
getOffsetNanosecondsFor: notCallable,
|
||||
};
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, hour: 12, offset: "+00:00", timeZone: badTimeZone }, { offset: "ignore" }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError (in offset=ignore and no possible instants case)`
|
||||
);
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, hour: 12, offset: "+00:00", timeZone: badTimeZone }, { offset: "prefer" }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError (in offset=prefer and no possible instants case)`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.add
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const duration = new Temporal.Duration(1);
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.add(duration),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.day
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.day,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.dayofweek
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.dayOfWeek,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.dayofyear
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.dayOfYear,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.daysinmonth
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.daysInMonth,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.daysinweek
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.daysInWeek,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.daysinyear
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.daysInYear,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,22 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, "UTC");
|
||||
timeZone.getPossibleInstantsFor = function () {
|
||||
return [];
|
||||
};
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.equals({ year: 2000, month: 5, day: 2, hour: 12, timeZone }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.getisofields
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.getISOFields(),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.hour
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.hour,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.hoursinday
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.hoursInDay,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.inleapyear
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.inLeapYear,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.microsecond
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.microsecond,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.millisecond
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.millisecond,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.minute
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.minute,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.month
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.month,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.monthcode
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.monthCode,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.monthsinyear
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.monthsInYear,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.nanosecond
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.nanosecond,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.offset
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.offset,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.offsetnanoseconds
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.offsetNanoseconds,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.round
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.round({ smallestUnit: "second" }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.second
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.second,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,23 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, "UTC");
|
||||
const properties = { year: 2004, month: 11, day: 9, hour: 11, minute: 33, second: 20, timeZone };
|
||||
timeZone.getPossibleInstantsFor = function () {
|
||||
return [];
|
||||
};
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.since(properties, { largestUnit: "days" }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
const other = new Temporal.ZonedDateTime(1_100_000_000_123_456_789n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.since(other, { largestUnit: "days" }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.startofday
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.startOfDay(),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.subtract
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const duration = new Temporal.Duration(1);
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.subtract(duration),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.tojson
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.toJSON(),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.toplaindate
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.toPlainDate(),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.toplaindatetime
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.toPlainDateTime(),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.toplainmonthday
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.toPlainMonthDay(),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.toplaintime
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.toPlainTime(),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.toplainyearmonth
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.toPlainYearMonth(),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.tostring
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.toString(),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,23 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, "UTC");
|
||||
const properties = { year: 2004, month: 11, day: 9, hour: 11, minute: 33, second: 20, timeZone };
|
||||
timeZone.getPossibleInstantsFor = function () {
|
||||
return [];
|
||||
};
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.until(properties, { largestUnit: "days" }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2021 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: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
const other = new Temporal.ZonedDateTime(1_100_000_000_123_456_789n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.until(other, { largestUnit: "days" }),
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.zoneddatetime.prototype.weekofyear
|
||||
description: TypeError thrown if timeZone.getOffsetNanosecondsFor is not callable
|
||||
features: [BigInt, Symbol, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
[undefined, null, true, Math.PI, 'string', Symbol('sym'), 42n, {}].forEach((notCallable) => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const datetime = new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone);
|
||||
timeZone.getOffsetNanosecondsFor = notCallable;
|
||||
assert.throws(
|
||||
TypeError,
|
||||
() => datetime.weekOfYear,
|
||||
`Uncallable ${typeof notCallable} ${notCallable} getOffsetNanosecondsFor should throw TypeError`
|
||||
);
|
||||
});
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user