mirror of
https://github.com/tc39/test262.git
synced 2025-07-22 21:45:04 +02:00
Temporal: Get receiver's time units from internal slots in with()
This commit is contained in:
parent
4b4de778d4
commit
4155594804
@ -18,16 +18,10 @@ const expected = [
|
|||||||
// PrepareTemporalFields on receiver
|
// PrepareTemporalFields on receiver
|
||||||
"get this.calendar.day",
|
"get this.calendar.day",
|
||||||
"call this.calendar.day",
|
"call this.calendar.day",
|
||||||
"get this.hour",
|
|
||||||
"get this.microsecond",
|
|
||||||
"get this.millisecond",
|
|
||||||
"get this.minute",
|
|
||||||
"get this.calendar.month",
|
"get this.calendar.month",
|
||||||
"call this.calendar.month",
|
"call this.calendar.month",
|
||||||
"get this.calendar.monthCode",
|
"get this.calendar.monthCode",
|
||||||
"call this.calendar.monthCode",
|
"call this.calendar.monthCode",
|
||||||
"get this.nanosecond",
|
|
||||||
"get this.second",
|
|
||||||
"get this.calendar.year",
|
"get this.calendar.year",
|
||||||
"call this.calendar.year",
|
"call this.calendar.year",
|
||||||
// PrepareTemporalFields on argument
|
// PrepareTemporalFields on argument
|
||||||
|
@ -20,14 +20,6 @@ const expected = [
|
|||||||
"call this.timeZone.getOffsetNanosecondsFor",
|
"call this.timeZone.getOffsetNanosecondsFor",
|
||||||
"get this.calendar.day",
|
"get this.calendar.day",
|
||||||
"call this.calendar.day",
|
"call this.calendar.day",
|
||||||
"get this.timeZone.getOffsetNanosecondsFor", // ZonedDateTime.p.hour
|
|
||||||
"call this.timeZone.getOffsetNanosecondsFor",
|
|
||||||
"get this.timeZone.getOffsetNanosecondsFor", // ZonedDateTime.p.microsecond
|
|
||||||
"call this.timeZone.getOffsetNanosecondsFor",
|
|
||||||
"get this.timeZone.getOffsetNanosecondsFor", // ZonedDateTime.p.millisecond
|
|
||||||
"call this.timeZone.getOffsetNanosecondsFor",
|
|
||||||
"get this.timeZone.getOffsetNanosecondsFor", // ZonedDateTime.p.minute
|
|
||||||
"call this.timeZone.getOffsetNanosecondsFor",
|
|
||||||
"get this.timeZone.getOffsetNanosecondsFor",
|
"get this.timeZone.getOffsetNanosecondsFor",
|
||||||
"call this.timeZone.getOffsetNanosecondsFor",
|
"call this.timeZone.getOffsetNanosecondsFor",
|
||||||
"get this.calendar.month",
|
"get this.calendar.month",
|
||||||
@ -36,16 +28,13 @@ const expected = [
|
|||||||
"call this.timeZone.getOffsetNanosecondsFor",
|
"call this.timeZone.getOffsetNanosecondsFor",
|
||||||
"get this.calendar.monthCode",
|
"get this.calendar.monthCode",
|
||||||
"call this.calendar.monthCode",
|
"call this.calendar.monthCode",
|
||||||
"get this.timeZone.getOffsetNanosecondsFor", // ZonedDateTime.p.nanosecond
|
|
||||||
"call this.timeZone.getOffsetNanosecondsFor",
|
|
||||||
"get this.timeZone.getOffsetNanosecondsFor", // ZonedDateTime.p.offset
|
|
||||||
"call this.timeZone.getOffsetNanosecondsFor",
|
|
||||||
"get this.timeZone.getOffsetNanosecondsFor", // ZonedDateTime.p.second
|
|
||||||
"call this.timeZone.getOffsetNanosecondsFor",
|
|
||||||
"get this.timeZone.getOffsetNanosecondsFor",
|
"get this.timeZone.getOffsetNanosecondsFor",
|
||||||
"call this.timeZone.getOffsetNanosecondsFor",
|
"call this.timeZone.getOffsetNanosecondsFor",
|
||||||
"get this.calendar.year",
|
"get this.calendar.year",
|
||||||
"call this.calendar.year",
|
"call this.calendar.year",
|
||||||
|
// GetOffsetNanosecondsFor on receiver
|
||||||
|
"get this.timeZone.getOffsetNanosecondsFor",
|
||||||
|
"call this.timeZone.getOffsetNanosecondsFor",
|
||||||
// PrepareTemporalFields on argument
|
// PrepareTemporalFields on argument
|
||||||
"get fields.day",
|
"get fields.day",
|
||||||
"get fields.day.valueOf",
|
"get fields.day.valueOf",
|
||||||
|
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
/*---
|
/*---
|
||||||
esid: sec-temporal.zoneddatetime.protoype.with
|
esid: sec-temporal.zoneddatetime.protoype.with
|
||||||
description: TypeError thrown when the offset field of the receiver is broken
|
description: >
|
||||||
|
TypeError thrown when the offset field of the argument or the object returned
|
||||||
|
from mergeFields is broken
|
||||||
info: |
|
info: |
|
||||||
7. Let _fieldNames_ be ? CalendarFields(_calendar_, « *"day"*, *"month"*, *"monthCode"*, *"year"* »).
|
7. Let _fieldNames_ be ? CalendarFields(_calendar_, « *"day"*, *"month"*, *"monthCode"*, *"year"* »).
|
||||||
8. Append *"hour"*, *"microsecond"*, *"millisecond"*, *"minute"*, *"nanosecond"*, *"offset"*, and *"second"* to _fieldNames_.
|
8. Append *"hour"*, *"microsecond"*, *"millisecond"*, *"minute"*, *"nanosecond"*, *"offset"*, and *"second"* to _fieldNames_.
|
||||||
@ -52,21 +54,3 @@ assert.throws(TypeError, () => dateTime.with({ year: 2002 }), "conversion failur
|
|||||||
assert.sameValue(calendar.mergeFieldsCalled, 1, "calendar.mergeFields was called once");
|
assert.sameValue(calendar.mergeFieldsCalled, 1, "calendar.mergeFields was called once");
|
||||||
|
|
||||||
calendar.resetCalls();
|
calendar.resetCalls();
|
||||||
|
|
||||||
// Test throw in step 9
|
|
||||||
|
|
||||||
Object.defineProperty(dateTime, "offset", { value: Symbol("can't convert to string"), configurable: true });
|
|
||||||
|
|
||||||
assert.throws(TypeError, () => dateTime.with({ year: 2002 }), "conversion failure on sabotaged offset field of receiver");
|
|
||||||
assert.sameValue(calendar.mergeFieldsCalled, 0, "calendar.mergeFields should not be called");
|
|
||||||
|
|
||||||
calendar.resetCalls();
|
|
||||||
|
|
||||||
// Test offset being required in step 9
|
|
||||||
|
|
||||||
Object.defineProperty(dateTime, "offset", { value: undefined });
|
|
||||||
|
|
||||||
assert.throws(TypeError, () => dateTime.with({ year: 2002 }), "offset property is required on receiver");
|
|
||||||
assert.sameValue(calendar.mergeFieldsCalled, 0, "calendar.mergeFields should not be called");
|
|
||||||
|
|
||||||
calendar.resetCalls();
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user