Browse Source

Add spec edition 15 to the tester (#3957)

pull/3964/head
José Julián Espina 4 months ago committed by GitHub
parent
commit
90c4d0ec0d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 23
      tests/tester/src/edition.rs
  2. 10
      tests/tester/src/main.rs

23
tests/tester/src/edition.rs

@ -115,20 +115,12 @@ static FEATURE_EDITION: phf::Map<&'static str, SpecEdition> = phf::phf_map! {
// https://github.com/tc39/proposal-atomics-microwait
"Atomics.pause" => SpecEdition::ESNext,
// Part of the next ES15 edition
"Atomics.waitAsync" => SpecEdition::ESNext,
"regexp-v-flag" => SpecEdition::ESNext,
"String.prototype.isWellFormed" => SpecEdition::ESNext,
"String.prototype.toWellFormed" => SpecEdition::ESNext,
"resizable-arraybuffer" => SpecEdition::ESNext,
"promise-with-resolvers" => SpecEdition::ESNext,
"array-grouping" => SpecEdition::ESNext,
"set-methods" => SpecEdition::ESNext,
// Standard language features
"AggregateError" => SpecEdition::ES12,
"Atomics.waitAsync" => SpecEdition::ES15,
"align-detached-buffer-semantics-with-web-reality" => SpecEdition::ES12,
"arbitrary-module-namespace-names" => SpecEdition::ES13,
"array-grouping" => SpecEdition::ES15,
"ArrayBuffer" => SpecEdition::ES6,
"array-find-from-last" => SpecEdition::ES14,
"Array.prototype.at" => SpecEdition::ES13,
@ -216,6 +208,7 @@ static FEATURE_EDITION: phf::Map<&'static str, SpecEdition> = phf::phf_map! {
"Promise.any" => SpecEdition::ES12,
"Promise.prototype.finally" => SpecEdition::ES9,
"Proxy" => SpecEdition::ES6,
"promise-with-resolvers" => SpecEdition::ES15,
"proxy-missing-checks" => SpecEdition::ES6,
"Reflect" => SpecEdition::ES6,
"Reflect.construct" => SpecEdition::ES6,
@ -226,6 +219,8 @@ static FEATURE_EDITION: phf::Map<&'static str, SpecEdition> = phf::phf_map! {
"regexp-match-indices" => SpecEdition::ES13,
"regexp-named-groups" => SpecEdition::ES9,
"regexp-unicode-property-escapes" => SpecEdition::ES9,
"regexp-v-flag" => SpecEdition::ES15,
"resizable-arraybuffer" => SpecEdition::ES15,
"rest-parameters" => SpecEdition::ES6,
"Set" => SpecEdition::ES6,
"SharedArrayBuffer" => SpecEdition::ES8,
@ -234,10 +229,13 @@ static FEATURE_EDITION: phf::Map<&'static str, SpecEdition> = phf::phf_map! {
"String.prototype.at" => SpecEdition::ES13,
"String.prototype.endsWith" => SpecEdition::ES6,
"String.prototype.includes" => SpecEdition::ES6,
"String.prototype.isWellFormed" => SpecEdition::ES15,
"String.prototype.matchAll" => SpecEdition::ES11,
"String.prototype.replaceAll" => SpecEdition::ES12,
"String.prototype.toWellFormed" => SpecEdition::ES15,
"String.prototype.trimEnd" => SpecEdition::ES10,
"String.prototype.trimStart" => SpecEdition::ES10,
"set-methods" => SpecEdition::ES15,
"super" => SpecEdition::ES6,
"Symbol" => SpecEdition::ES6,
"symbols-as-weakmap-keys" => SpecEdition::ES14,
@ -335,6 +333,10 @@ pub(crate) enum SpecEdition {
///
/// <https://262.ecma-international.org/14.0>
ES14,
/// ECMAScript 15th Edition
///
/// <https://262.ecma-international.org/15.0>
ES15,
/// The edition being worked on right now.
///
/// A draft is currently available [here](https://tc39.es/ecma262).
@ -398,6 +400,7 @@ impl SpecEdition {
Self::ES12,
Self::ES13,
Self::ES14,
Self::ES15,
Self::ESNext,
]
.into_iter()

10
tests/tester/src/main.rs

@ -606,6 +606,7 @@ struct VersionedStats {
es12: Statistics,
es13: Statistics,
es14: Statistics,
es15: Statistics,
}
impl<'de> Deserialize<'de> for VersionedStats {
@ -626,6 +627,8 @@ impl<'de> Deserialize<'de> for VersionedStats {
es13: Statistics,
#[serde(default)]
es14: Option<Statistics>,
#[serde(default)]
es15: Option<Statistics>,
}
let inner = Inner::deserialize(deserializer)?;
@ -641,8 +644,10 @@ impl<'de> Deserialize<'de> for VersionedStats {
es12,
es13,
es14,
es15,
} = inner;
let es14 = es14.unwrap_or(es13);
let es15 = es15.unwrap_or(es14);
Ok(Self {
es5,
@ -655,6 +660,7 @@ impl<'de> Deserialize<'de> for VersionedStats {
es12,
es13,
es14,
es15,
})
}
}
@ -684,6 +690,7 @@ impl VersionedStats {
SpecEdition::ES12 => self.es12,
SpecEdition::ES13 => self.es13,
SpecEdition::ES14 => self.es14,
SpecEdition::ES15 => self.es15,
SpecEdition::ESNext => return None,
};
Some(stats)
@ -703,6 +710,7 @@ impl VersionedStats {
SpecEdition::ES12 => &mut self.es12,
SpecEdition::ES13 => &mut self.es13,
SpecEdition::ES14 => &mut self.es14,
SpecEdition::ES15 => &mut self.es15,
SpecEdition::ESNext => return None,
};
Some(stats)
@ -724,6 +732,7 @@ impl Add for VersionedStats {
es12: self.es12 + rhs.es12,
es13: self.es13 + rhs.es13,
es14: self.es14 + rhs.es14,
es15: self.es15 + rhs.es15,
}
}
}
@ -740,6 +749,7 @@ impl AddAssign for VersionedStats {
self.es12 += rhs.es12;
self.es13 += rhs.es13;
self.es14 += rhs.es14;
self.es15 += rhs.es15;
}
}

Loading…
Cancel
Save