Browse Source

Enable Temporal tests and error message fix (#3620)

pull/3626/head
Kevin 9 months ago committed by GitHub
parent
commit
750962dd5a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 30
      core/engine/src/builtins/temporal/plain_date/mod.rs
  2. 3
      test262_config.toml

30
core/engine/src/builtins/temporal/plain_date/mod.rs

@ -240,7 +240,7 @@ impl PlainDate {
.as_object() .as_object()
.and_then(JsObject::downcast_ref::<Self>) .and_then(JsObject::downcast_ref::<Self>)
.ok_or_else(|| { .ok_or_else(|| {
JsNativeError::typ().with_message("the this object must be an instant object.") JsNativeError::typ().with_message("the this object must be a PlainDate object.")
})?; })?;
Ok(JsString::from(date.inner.calendar().identifier(context)?).into()) Ok(JsString::from(date.inner.calendar().identifier(context)?).into())
@ -252,7 +252,7 @@ impl PlainDate {
.as_object() .as_object()
.and_then(JsObject::downcast_ref::<Self>) .and_then(JsObject::downcast_ref::<Self>)
.ok_or_else(|| { .ok_or_else(|| {
JsNativeError::typ().with_message("the this object must be an instant object.") JsNativeError::typ().with_message("the this object must be a PlainDate object.")
})?; })?;
Ok(date.inner.contextual_year(context)?.into()) Ok(date.inner.contextual_year(context)?.into())
@ -264,7 +264,7 @@ impl PlainDate {
.as_object() .as_object()
.and_then(JsObject::downcast_ref::<Self>) .and_then(JsObject::downcast_ref::<Self>)
.ok_or_else(|| { .ok_or_else(|| {
JsNativeError::typ().with_message("the this object must be an instant object.") JsNativeError::typ().with_message("the this object must be a PlainDate object.")
})?; })?;
Ok(date.inner.contextual_month(context)?.into()) Ok(date.inner.contextual_month(context)?.into())
@ -276,7 +276,7 @@ impl PlainDate {
.as_object() .as_object()
.and_then(JsObject::downcast_ref::<Self>) .and_then(JsObject::downcast_ref::<Self>)
.ok_or_else(|| { .ok_or_else(|| {
JsNativeError::typ().with_message("the this object must be an instant object.") JsNativeError::typ().with_message("the this object must be a PlainDate object.")
})?; })?;
Ok(JsString::from(date.inner.contextual_month_code(context)?.as_str()).into()) Ok(JsString::from(date.inner.contextual_month_code(context)?.as_str()).into())
@ -288,7 +288,7 @@ impl PlainDate {
.as_object() .as_object()
.and_then(JsObject::downcast_ref::<Self>) .and_then(JsObject::downcast_ref::<Self>)
.ok_or_else(|| { .ok_or_else(|| {
JsNativeError::typ().with_message("the this object must be an instant object.") JsNativeError::typ().with_message("the this object must be a PlainDate object.")
})?; })?;
Ok(date.inner.contextual_day(context)?.into()) Ok(date.inner.contextual_day(context)?.into())
@ -300,7 +300,7 @@ impl PlainDate {
.as_object() .as_object()
.and_then(JsObject::downcast_ref::<Self>) .and_then(JsObject::downcast_ref::<Self>)
.ok_or_else(|| { .ok_or_else(|| {
JsNativeError::typ().with_message("the this object must be an instant object.") JsNativeError::typ().with_message("the this object must be a PlainDate object.")
})?; })?;
Ok(date.inner.contextual_day_of_week(context)?.into()) Ok(date.inner.contextual_day_of_week(context)?.into())
@ -312,7 +312,7 @@ impl PlainDate {
.as_object() .as_object()
.and_then(JsObject::downcast_ref::<Self>) .and_then(JsObject::downcast_ref::<Self>)
.ok_or_else(|| { .ok_or_else(|| {
JsNativeError::typ().with_message("the this object must be an instant object.") JsNativeError::typ().with_message("the this object must be a PlainDate object.")
})?; })?;
Ok(date.inner.contextual_day_of_year(context)?.into()) Ok(date.inner.contextual_day_of_year(context)?.into())
@ -324,7 +324,7 @@ impl PlainDate {
.as_object() .as_object()
.and_then(JsObject::downcast_ref::<Self>) .and_then(JsObject::downcast_ref::<Self>)
.ok_or_else(|| { .ok_or_else(|| {
JsNativeError::typ().with_message("the this object must be an instant object.") JsNativeError::typ().with_message("the this object must be a PlainDate object.")
})?; })?;
Ok(date.inner.contextual_week_of_year(context)?.into()) Ok(date.inner.contextual_week_of_year(context)?.into())
@ -336,7 +336,7 @@ impl PlainDate {
.as_object() .as_object()
.and_then(JsObject::downcast_ref::<Self>) .and_then(JsObject::downcast_ref::<Self>)
.ok_or_else(|| { .ok_or_else(|| {
JsNativeError::typ().with_message("the this object must be an instant object.") JsNativeError::typ().with_message("the this object must be a PlainDate object.")
})?; })?;
Ok(date.inner.contextual_year_of_week(context)?.into()) Ok(date.inner.contextual_year_of_week(context)?.into())
@ -348,7 +348,7 @@ impl PlainDate {
.as_object() .as_object()
.and_then(JsObject::downcast_ref::<Self>) .and_then(JsObject::downcast_ref::<Self>)
.ok_or_else(|| { .ok_or_else(|| {
JsNativeError::typ().with_message("the this object must be an instant object.") JsNativeError::typ().with_message("the this object must be a PlainDate object.")
})?; })?;
Ok(date.inner.contextual_days_in_week(context)?.into()) Ok(date.inner.contextual_days_in_week(context)?.into())
@ -364,7 +364,7 @@ impl PlainDate {
.as_object() .as_object()
.and_then(JsObject::downcast_ref::<Self>) .and_then(JsObject::downcast_ref::<Self>)
.ok_or_else(|| { .ok_or_else(|| {
JsNativeError::typ().with_message("the this object must be an instant object.") JsNativeError::typ().with_message("the this object must be a PlainDate object.")
})?; })?;
Ok(date.inner.contextual_days_in_month(context)?.into()) Ok(date.inner.contextual_days_in_month(context)?.into())
@ -376,7 +376,7 @@ impl PlainDate {
.as_object() .as_object()
.and_then(JsObject::downcast_ref::<Self>) .and_then(JsObject::downcast_ref::<Self>)
.ok_or_else(|| { .ok_or_else(|| {
JsNativeError::typ().with_message("the this object must be an instant object.") JsNativeError::typ().with_message("the this object must be a PlainDate object.")
})?; })?;
Ok(date.inner.contextual_days_in_year(context)?.into()) Ok(date.inner.contextual_days_in_year(context)?.into())
@ -392,7 +392,7 @@ impl PlainDate {
.as_object() .as_object()
.and_then(JsObject::downcast_ref::<Self>) .and_then(JsObject::downcast_ref::<Self>)
.ok_or_else(|| { .ok_or_else(|| {
JsNativeError::typ().with_message("the this object must be an instant object.") JsNativeError::typ().with_message("the this object must be a PlainDate object.")
})?; })?;
Ok(date.inner.contextual_months_in_year(context)?.into()) Ok(date.inner.contextual_months_in_year(context)?.into())
@ -404,7 +404,7 @@ impl PlainDate {
.as_object() .as_object()
.and_then(JsObject::downcast_ref::<Self>) .and_then(JsObject::downcast_ref::<Self>)
.ok_or_else(|| { .ok_or_else(|| {
JsNativeError::typ().with_message("the this object must be an instant object.") JsNativeError::typ().with_message("the this object must be a PlainDate object.")
})?; })?;
Ok(date.inner.contextual_in_leap_year(context)?.into()) Ok(date.inner.contextual_in_leap_year(context)?.into())
@ -438,7 +438,7 @@ impl PlainDate {
.as_object() .as_object()
.and_then(JsObject::downcast_ref::<Self>) .and_then(JsObject::downcast_ref::<Self>)
.ok_or_else(|| { .ok_or_else(|| {
JsNativeError::typ().with_message("the this object must be an instant object.") JsNativeError::typ().with_message("the this object must be a PlainDate object.")
})?; })?;
create_temporal_calendar(date.inner.calendar().clone(), None, context) create_temporal_calendar(date.inner.calendar().clone(), None, context)

3
test262_config.toml

@ -38,9 +38,6 @@ features = [
# https://github.com/tc39/proposal-arraybuffer-transfer # https://github.com/tc39/proposal-arraybuffer-transfer
"arraybuffer-transfer", "arraybuffer-transfer",
# https://github.com/tc39/proposal-temporal
"Temporal",
# https://github.com/tc39/proposal-realms # https://github.com/tc39/proposal-realms
"ShadowRealm", "ShadowRealm",

Loading…
Cancel
Save