mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 14:04:51 +02:00
Temporal: Add tests for converting a ZonedDateTime to a PlainDate.
This commit is contained in:
parent
715c3ceb16
commit
53d6cd6d46
37
test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.dateadd
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
instance.dateAdd(arg, new Temporal.Duration());
|
||||||
|
assert.compareArray(actual, []);
|
38
test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-zoneddatetime-slots.js
vendored
Normal file
38
test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.dateuntil
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
instance.dateUntil(arg, new Temporal.PlainDate(1977, 11, 19));
|
||||||
|
instance.dateUntil(new Temporal.PlainDate(1977, 11, 19), arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/Calendar/prototype/day/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/Calendar/prototype/day/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.day
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
instance.day(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.dayofweek
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
instance.dayOfWeek(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.dayofyear
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
instance.dayOfYear(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.daysinmonth
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
instance.daysInMonth(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.daysinweek
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
instance.daysInWeek(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.daysinyear
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
instance.daysInYear(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.inleapyear
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
instance.inLeapYear(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/Calendar/prototype/month/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/Calendar/prototype/month/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.month
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
instance.month(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/Calendar/prototype/monthCode/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/Calendar/prototype/monthCode/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.monthcode
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
instance.monthCode(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.monthsinyear
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
instance.monthsInYear(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.weekofyear
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
instance.weekOfYear(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/Calendar/prototype/year/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/Calendar/prototype/year/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.year
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
instance.year(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/Duration/prototype/round/relativeto-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/Duration/prototype/round/relativeto-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.duration.prototype.round
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.Duration(0, 0, 0, 365);
|
||||||
|
instance.round({ relativeTo: arg, largestUnit: "years" });
|
||||||
|
assert.compareArray(actual, []);
|
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.plaindate.compare
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
Temporal.PlainDate.compare(arg, new Temporal.PlainDate(1976, 11, 18));
|
||||||
|
Temporal.PlainDate.compare(new Temporal.PlainDate(1976, 11, 18), arg);
|
||||||
|
assert.compareArray(actual, []);
|
@ -0,0 +1,36 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.plaindate.from
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
Temporal.PlainDate.from(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/PlainDate/prototype/equals/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/PlainDate/prototype/equals/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.plaindate.prototype.equals
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.PlainDate(1976, 11, 18);
|
||||||
|
instance.equals(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/PlainDate/prototype/since/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/PlainDate/prototype/since/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.plaindate.prototype.since
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.PlainDate(1976, 11, 18);
|
||||||
|
instance.since(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/PlainDate/prototype/until/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/PlainDate/prototype/until/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.plaindate.prototype.until
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.PlainDate(1976, 11, 18);
|
||||||
|
instance.until(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.plaindatetime.prototype.withplaindate
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||||
|
instance.withPlainDate(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.plaintime.prototype.toplaindatetime
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||||
|
instance.toPlainDateTime(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.plaintime.prototype.tozoneddatetime
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||||
|
instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" });
|
||||||
|
assert.compareArray(actual, []);
|
37
test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.zoneddatetime.prototype.withplaindate
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC");
|
||||||
|
instance.withPlainDate(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/intl402/Temporal/Calendar/prototype/era/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/intl402/Temporal/Calendar/prototype/era/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.era
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
instance.era(arg);
|
||||||
|
assert.compareArray(actual, []);
|
37
test/intl402/Temporal/Calendar/prototype/eraYear/argument-zoneddatetime-slots.js
vendored
Normal file
37
test/intl402/Temporal/Calendar/prototype/eraYear/argument-zoneddatetime-slots.js
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.calendar.prototype.erayear
|
||||||
|
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const actual = [];
|
||||||
|
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
|
||||||
|
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
|
||||||
|
|
||||||
|
for (const property of getters) {
|
||||||
|
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
|
||||||
|
get() {
|
||||||
|
actual.push(`get ${property}`);
|
||||||
|
const value = prototypeDescrs[property].get.call(this);
|
||||||
|
return {
|
||||||
|
toString() {
|
||||||
|
actual.push(`toString ${property}`);
|
||||||
|
return value.toString();
|
||||||
|
},
|
||||||
|
valueOf() {
|
||||||
|
actual.push(`valueOf ${property}`);
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const arg = new Temporal.ZonedDateTime(0n, "UTC");
|
||||||
|
const instance = new Temporal.Calendar("iso8601");
|
||||||
|
instance.eraYear(arg);
|
||||||
|
assert.compareArray(actual, []);
|
Loading…
x
Reference in New Issue
Block a user