Skip to content

Commit

Permalink
Fix deserialization of SpecEdition (#2762)
Browse files Browse the repository at this point in the history
`boa_tester` wasn't deserializing `SpecEdition` correcly. This was because the attribute `serde(untagged)` just removes the u8 tag instead of trying to deserialize as a number. This PR fixes this using the `serde_repr` crate.

This needs #2763 to be merged for it to pass CI.
  • Loading branch information
jedel1043 committed Mar 29, 2023
1 parent cf85843 commit ceaea32
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
12 changes: 12 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions boa_tester/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
8 changes: 4 additions & 4 deletions boa_tester/src/edition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use std::fmt::Display;

use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};

use crate::read::{MetaData, TestFlag};

Expand Down Expand Up @@ -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
///
Expand Down

0 comments on commit ceaea32

Please sign in to comment.