mirror of https://github.com/tc39/test262.git
Temporal: Test custom calendar operations.
This commit is contained in:
parent
da19e0a50c
commit
56ed1a0f82
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.plaindate.prototype.dayofweek
|
||||
description: Custom calendar tests for dayOfWeek().
|
||||
includes: [compareArray.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
let calls = 0;
|
||||
class CustomCalendar extends Temporal.Calendar {
|
||||
constructor() {
|
||||
super("iso8601");
|
||||
}
|
||||
dayOfWeek(...args) {
|
||||
++calls;
|
||||
assert.compareArray(args, [pd], "dayOfWeek arguments");
|
||||
return "7";
|
||||
}
|
||||
}
|
||||
|
||||
const calendar = new CustomCalendar();
|
||||
const pd = new Temporal.PlainDate(1830, 8, 25, calendar);
|
||||
const result = pd.dayOfWeek;
|
||||
assert.sameValue(result, "7", "result");
|
||||
assert.sameValue(calls, 1, "calls");
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.plaindate.prototype.dayofyear
|
||||
description: Custom calendar tests for dayOfYear().
|
||||
includes: [compareArray.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
let calls = 0;
|
||||
class CustomCalendar extends Temporal.Calendar {
|
||||
constructor() {
|
||||
super("iso8601");
|
||||
}
|
||||
dayOfYear(...args) {
|
||||
++calls;
|
||||
assert.compareArray(args, [pd], "dayOfYear arguments");
|
||||
return "7";
|
||||
}
|
||||
}
|
||||
|
||||
const calendar = new CustomCalendar();
|
||||
const pd = new Temporal.PlainDate(1830, 8, 25, calendar);
|
||||
const result = pd.dayOfYear;
|
||||
assert.sameValue(result, "7", "result");
|
||||
assert.sameValue(calls, 1, "calls");
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.plaindate.prototype.daysinmonth
|
||||
description: Custom calendar tests for daysInMonth().
|
||||
includes: [compareArray.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
let calls = 0;
|
||||
class CustomCalendar extends Temporal.Calendar {
|
||||
constructor() {
|
||||
super("iso8601");
|
||||
}
|
||||
daysInMonth(...args) {
|
||||
++calls;
|
||||
assert.compareArray(args, [pd], "daysInMonth arguments");
|
||||
return "7";
|
||||
}
|
||||
}
|
||||
|
||||
const calendar = new CustomCalendar();
|
||||
const pd = new Temporal.PlainDate(1830, 8, 25, calendar);
|
||||
const result = pd.daysInMonth;
|
||||
assert.sameValue(result, "7", "result");
|
||||
assert.sameValue(calls, 1, "calls");
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.plaindate.prototype.daysinweek
|
||||
description: Custom calendar tests for daysInWeek().
|
||||
includes: [compareArray.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
let calls = 0;
|
||||
class CustomCalendar extends Temporal.Calendar {
|
||||
constructor() {
|
||||
super("iso8601");
|
||||
}
|
||||
daysInWeek(...args) {
|
||||
++calls;
|
||||
assert.compareArray(args, [pd], "daysInWeek arguments");
|
||||
return "7";
|
||||
}
|
||||
}
|
||||
|
||||
const calendar = new CustomCalendar();
|
||||
const pd = new Temporal.PlainDate(1830, 8, 25, calendar);
|
||||
const result = pd.daysInWeek;
|
||||
assert.sameValue(result, "7", "result");
|
||||
assert.sameValue(calls, 1, "calls");
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.plaindate.prototype.daysinyear
|
||||
description: Custom calendar tests for daysInYear().
|
||||
includes: [compareArray.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
let calls = 0;
|
||||
class CustomCalendar extends Temporal.Calendar {
|
||||
constructor() {
|
||||
super("iso8601");
|
||||
}
|
||||
daysInYear(...args) {
|
||||
++calls;
|
||||
assert.compareArray(args, [pd], "daysInYear arguments");
|
||||
return "7";
|
||||
}
|
||||
}
|
||||
|
||||
const calendar = new CustomCalendar();
|
||||
const pd = new Temporal.PlainDate(1830, 8, 25, calendar);
|
||||
const result = pd.daysInYear;
|
||||
assert.sameValue(result, "7", "result");
|
||||
assert.sameValue(calls, 1, "calls");
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.plaindate.prototype.inleapyear
|
||||
description: Custom calendar tests for inLeapYear().
|
||||
includes: [compareArray.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
let calls = 0;
|
||||
class CustomCalendar extends Temporal.Calendar {
|
||||
constructor() {
|
||||
super("iso8601");
|
||||
}
|
||||
inLeapYear(...args) {
|
||||
++calls;
|
||||
assert.compareArray(args, [pd], "inLeapYear arguments");
|
||||
return "7";
|
||||
}
|
||||
}
|
||||
|
||||
const calendar = new CustomCalendar();
|
||||
const pd = new Temporal.PlainDate(1830, 8, 25, calendar);
|
||||
const result = pd.inLeapYear;
|
||||
assert.sameValue(result, "7", "result");
|
||||
assert.sameValue(calls, 1, "calls");
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.plaindate.prototype.monthsinyear
|
||||
description: Custom calendar tests for monthsInYear().
|
||||
includes: [compareArray.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
let calls = 0;
|
||||
class CustomCalendar extends Temporal.Calendar {
|
||||
constructor() {
|
||||
super("iso8601");
|
||||
}
|
||||
monthsInYear(...args) {
|
||||
++calls;
|
||||
assert.compareArray(args, [pd], "monthsInYear arguments");
|
||||
return "7";
|
||||
}
|
||||
}
|
||||
|
||||
const calendar = new CustomCalendar();
|
||||
const pd = new Temporal.PlainDate(1830, 8, 25, calendar);
|
||||
const result = pd.monthsInYear;
|
||||
assert.sameValue(result, "7", "result");
|
||||
assert.sameValue(calls, 1, "calls");
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.plaindate.prototype.weekofyear
|
||||
description: Custom calendar tests for weekOfYear().
|
||||
includes: [compareArray.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
let calls = 0;
|
||||
class CustomCalendar extends Temporal.Calendar {
|
||||
constructor() {
|
||||
super("iso8601");
|
||||
}
|
||||
weekOfYear(...args) {
|
||||
++calls;
|
||||
assert.compareArray(args, [pd], "weekOfYear arguments");
|
||||
return "7";
|
||||
}
|
||||
}
|
||||
|
||||
const calendar = new CustomCalendar();
|
||||
const pd = new Temporal.PlainDate(1830, 8, 25, calendar);
|
||||
const result = pd.weekOfYear;
|
||||
assert.sameValue(result, "7", "result");
|
||||
assert.sameValue(calls, 1, "calls");
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.plaindatetime.prototype.dayofweek
|
||||
description: Custom calendar tests for dayOfWeek().
|
||||
includes: [compareArray.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
let calls = 0;
|
||||
class CustomCalendar extends Temporal.Calendar {
|
||||
constructor() {
|
||||
super("iso8601");
|
||||
}
|
||||
dayOfWeek(...args) {
|
||||
++calls;
|
||||
assert.compareArray(args, [pdt], "dayOfWeek arguments");
|
||||
return "7";
|
||||
}
|
||||
}
|
||||
|
||||
const calendar = new CustomCalendar();
|
||||
const pdt = new Temporal.PlainDateTime(1830, 8, 25, 20, 0, 0, 0, 0, 0, calendar);
|
||||
const result = pdt.dayOfWeek;
|
||||
assert.sameValue(result, "7", "result");
|
||||
assert.sameValue(calls, 1, "calls");
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.plaindatetime.prototype.dayofyear
|
||||
description: Custom calendar tests for dayOfYear().
|
||||
includes: [compareArray.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
let calls = 0;
|
||||
class CustomCalendar extends Temporal.Calendar {
|
||||
constructor() {
|
||||
super("iso8601");
|
||||
}
|
||||
dayOfYear(...args) {
|
||||
++calls;
|
||||
assert.compareArray(args, [pdt], "dayOfYear arguments");
|
||||
return "7";
|
||||
}
|
||||
}
|
||||
|
||||
const calendar = new CustomCalendar();
|
||||
const pdt = new Temporal.PlainDateTime(1830, 8, 25, 20, 0, 0, 0, 0, 0, calendar);
|
||||
const result = pdt.dayOfYear;
|
||||
assert.sameValue(result, "7", "result");
|
||||
assert.sameValue(calls, 1, "calls");
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.plaindatetime.prototype.daysinmonth
|
||||
description: Custom calendar tests for daysInMonth().
|
||||
includes: [compareArray.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
let calls = 0;
|
||||
class CustomCalendar extends Temporal.Calendar {
|
||||
constructor() {
|
||||
super("iso8601");
|
||||
}
|
||||
daysInMonth(...args) {
|
||||
++calls;
|
||||
assert.compareArray(args, [pdt], "daysInMonth arguments");
|
||||
return "7";
|
||||
}
|
||||
}
|
||||
|
||||
const calendar = new CustomCalendar();
|
||||
const pdt = new Temporal.PlainDateTime(1830, 8, 25, 20, 0, 0, 0, 0, 0, calendar);
|
||||
const result = pdt.daysInMonth;
|
||||
assert.sameValue(result, "7", "result");
|
||||
assert.sameValue(calls, 1, "calls");
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.plaindatetime.prototype.daysinweek
|
||||
description: Custom calendar tests for daysInWeek().
|
||||
includes: [compareArray.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
let calls = 0;
|
||||
class CustomCalendar extends Temporal.Calendar {
|
||||
constructor() {
|
||||
super("iso8601");
|
||||
}
|
||||
daysInWeek(...args) {
|
||||
++calls;
|
||||
assert.compareArray(args, [pdt], "daysInWeek arguments");
|
||||
return "7";
|
||||
}
|
||||
}
|
||||
|
||||
const calendar = new CustomCalendar();
|
||||
const pdt = new Temporal.PlainDateTime(1830, 8, 25, 20, 0, 0, 0, 0, 0, calendar);
|
||||
const result = pdt.daysInWeek;
|
||||
assert.sameValue(result, "7", "result");
|
||||
assert.sameValue(calls, 1, "calls");
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.plaindatetime.prototype.daysinyear
|
||||
description: Custom calendar tests for daysInYear().
|
||||
includes: [compareArray.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
let calls = 0;
|
||||
class CustomCalendar extends Temporal.Calendar {
|
||||
constructor() {
|
||||
super("iso8601");
|
||||
}
|
||||
daysInYear(...args) {
|
||||
++calls;
|
||||
assert.compareArray(args, [pdt], "daysInYear arguments");
|
||||
return "7";
|
||||
}
|
||||
}
|
||||
|
||||
const calendar = new CustomCalendar();
|
||||
const pdt = new Temporal.PlainDateTime(1830, 8, 25, 20, 0, 0, 0, 0, 0, calendar);
|
||||
const result = pdt.daysInYear;
|
||||
assert.sameValue(result, "7", "result");
|
||||
assert.sameValue(calls, 1, "calls");
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.plaindatetime.prototype.inleapyear
|
||||
description: Custom calendar tests for inLeapYear().
|
||||
includes: [compareArray.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
let calls = 0;
|
||||
class CustomCalendar extends Temporal.Calendar {
|
||||
constructor() {
|
||||
super("iso8601");
|
||||
}
|
||||
inLeapYear(...args) {
|
||||
++calls;
|
||||
assert.compareArray(args, [pdt], "inLeapYear arguments");
|
||||
return "7";
|
||||
}
|
||||
}
|
||||
|
||||
const calendar = new CustomCalendar();
|
||||
const pdt = new Temporal.PlainDateTime(1830, 8, 25, 20, 0, 0, 0, 0, 0, calendar);
|
||||
const result = pdt.inLeapYear;
|
||||
assert.sameValue(result, "7", "result");
|
||||
assert.sameValue(calls, 1, "calls");
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.plaindatetime.prototype.monthsinyear
|
||||
description: Custom calendar tests for monthsInYear().
|
||||
includes: [compareArray.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
let calls = 0;
|
||||
class CustomCalendar extends Temporal.Calendar {
|
||||
constructor() {
|
||||
super("iso8601");
|
||||
}
|
||||
monthsInYear(...args) {
|
||||
++calls;
|
||||
assert.compareArray(args, [pdt], "monthsInYear arguments");
|
||||
return "7";
|
||||
}
|
||||
}
|
||||
|
||||
const calendar = new CustomCalendar();
|
||||
const pdt = new Temporal.PlainDateTime(1830, 8, 25, 20, 0, 0, 0, 0, 0, calendar);
|
||||
const result = pdt.monthsInYear;
|
||||
assert.sameValue(result, "7", "result");
|
||||
assert.sameValue(calls, 1, "calls");
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-get-temporal.plaindatetime.prototype.weekofyear
|
||||
description: Custom calendar tests for weekOfYear().
|
||||
includes: [compareArray.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
let calls = 0;
|
||||
class CustomCalendar extends Temporal.Calendar {
|
||||
constructor() {
|
||||
super("iso8601");
|
||||
}
|
||||
weekOfYear(...args) {
|
||||
++calls;
|
||||
assert.compareArray(args, [pdt], "weekOfYear arguments");
|
||||
return "7";
|
||||
}
|
||||
}
|
||||
|
||||
const calendar = new CustomCalendar();
|
||||
const pdt = new Temporal.PlainDateTime(1830, 8, 25, 20, 0, 0, 0, 0, 0, calendar);
|
||||
const result = pdt.weekOfYear;
|
||||
assert.sameValue(result, "7", "result");
|
||||
assert.sameValue(calls, 1, "calls");
|
Loading…
Reference in New Issue