Problems of verifying era/eraYear in Temporal tests localted under test/built-ins
All tests which part of ECMA402 should be put under test/intl402 and tests outside test/intl402 should not verify any behavior defined in ECMA402.
But in Temporal, because Temporal.*.prototype.era and eraYear are defined in Chapter 15 https://tc39.es/proposal-temporal/#sec-temporal-intl
Behavior of Temporal..prototype.era and eraYear should NOT be test and verify under any tests inside test/built-ins/Temporal. Testing and verifing value of Temporal..prototype.era and eraYear should be moved under test/intl402/Temporal instead.
I found the following helper functions will test era and eraYear
assertPlainDate https://github.com/tc39/test262/blob/main/harness/temporalHelpers.js#L62 assertPlainDateTime https://github.com/tc39/test262/blob/main/harness/temporalHelpers.js#L80 assertPlainYearMonth https://github.com/tc39/test262/blob/main/harness/temporalHelpers.js#L161
Or we dup the test and only verify era and eraYear on the tests under test/intl402/Temporal but not those test under test/built-ins/Temporal
@ptomato , @Ms2ger, @jessealama
I'm confused; are you saying these accessors only exist in Intl? If so, I think that's a mistake in the proposal; they should be defined in 262 and overridden in 402.
I'm confused; are you saying these accessors only exist in Intl?
Why don't you read the Temporal proposal yourself and decide is that case or not.
If so, I think that's a mistake in the proposal; they should be defined in 262 and overridden in 402.
My understanding is calling these getter should always return undefined under 262 but may return different value under 402 as what currently stated in the Temporal. Notice Temporal..prototype.era and Temporal..prototype.eraYear are NOT defined in the first 14 chapters in the propoal.
@sffc @ryzokuken
I just realize the issue is less than I first reported in these tests. ear and earYear are the last two arugment and default to undefined in these 3 functinos so not all the tests use these function will have problem- only those which specify value other than undefined will have problem.
I know the following tests are troublesome:
test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar.js
test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-noniso.js
test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-id.js
test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindate-calendar-same-object.js
test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-iso-calendar.js
Filed https://github.com/tc39/proposal-temporal/issues/2169
I think we also have problem in the harness/temporalHelpers.js
assertPlainDate(date, year, month, monthCode, day, description = "", era = undefined, eraYear = undefined) {
assert(date instanceof Temporal.PlainDate, `${description} instanceof`);
assert.sameValue(date.era, era, `${description} era result`);
assert.sameValue(date.eraYear, eraYear, `${description} eraYear result`);
...
assertPlainDateTime(datetime, year, month, monthCode, day, hour, minute, second, millisecond, microsecond, nanosecond, description = "", era = undefined, eraYear = undefined) {
assert(datetime instanceof Temporal.PlainDateTime, `${description} instanceof`);
assert.sameValue(datetime.era, era, `${description} era result`);
assert.sameValue(datetime.eraYear, eraYear, `${description} eraYear result`);
....
assertPlainYearMonth(yearMonth, year, month, monthCode, description = "", era = undefined, eraYear = undefined, referenceISODay = 1) {
assert(yearMonth instanceof Temporal.PlainYearMonth, `${description} instanceof`);
assert.sameValue(yearMonth.era, era, `${description} era result`);
assert.sameValue(yearMonth.eraYear, eraYear, `${description} eraYear result`);
...
This mean, for any caller to these three assertion methods, it will either assert era/eraYear equal to the explicit specified values, or equal to undefined (if unspecified in the arg)
Now, it is perfectly ok to use them in intl402/Temporal, but when we use them on built-ins/Temporal we are testing against two unspecific getter and these two unspecified getter may return undefined or another value depending on the implementation support intl or not
For example, v8 has two different mode, supporting intl (ECMA402) or not. And both build will test against tests under test/built-ins/ but only the intl build will test against the tests under test/intl402
But the behavior of that two build will be different to Temporal.(PlainDate|PlainDateTime|PlainYearMonth|ZonedDateTime).property.era(Year)?