From 6c1d57b309e7572ce9f7c966ded190b326984c31 Mon Sep 17 00:00:00 2001 From: jedel1043 Date: Wed, 29 Mar 2023 15:11:46 -0600 Subject: [PATCH] Fix deserialization of `SpecEdition` --- Cargo.lock | 12 ++++++++++++ boa_tester/Cargo.toml | 1 + boa_tester/src/edition.rs | 8 ++++---- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 430836c34f8..f49c8c3aef5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -522,6 +522,7 @@ dependencies = [ "regex", "serde", "serde_json", + "serde_repr", "serde_yaml", "toml 0.7.3", ] @@ -3616,6 +3617,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_repr" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.11", +] + [[package]] name = "serde_spanned" version = "0.6.1" diff --git a/boa_tester/Cargo.toml b/boa_tester/Cargo.toml index 3ad26465b29..68c80ceb174 100644 --- a/boa_tester/Cargo.toml +++ b/boa_tester/Cargo.toml @@ -28,6 +28,7 @@ toml = "0.7.3" color-eyre = "0.6.2" phf = { version = "0.11.1", features = ["macros"] } comfy-table = "6.1.4" +serde_repr = "0.1.12" [features] default = ["intl"] diff --git a/boa_tester/src/edition.rs b/boa_tester/src/edition.rs index a9ea5327081..38cd0fd538a 100644 --- a/boa_tester/src/edition.rs +++ b/boa_tester/src/edition.rs @@ -5,7 +5,7 @@ use std::fmt::Display; -use serde::{Deserialize, Serialize}; +use serde_repr::{Deserialize_repr, Serialize_repr}; use crate::read::{MetaData, TestFlag}; @@ -270,11 +270,11 @@ static FEATURE_EDITION: phf::Map<&'static str, SpecEdition> = phf::phf_map! { PartialOrd, Ord, Default, - Serialize, - Deserialize, + Serialize_repr, + Deserialize_repr, clap::ValueEnum, )] -#[serde(untagged)] +#[repr(u8)] pub(crate) enum SpecEdition { /// ECMAScript 5.1 Edition ///