Skip to content

Commit

Permalink
Update adjacent enum non-roundtrip tests to match serde-rs/serde#2505
Browse files Browse the repository at this point in the history
  • Loading branch information
juntyr committed Aug 6, 2023
1 parent f692c63 commit 1d4067c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions tests/123_enum_representation.rs
Expand Up @@ -108,14 +108,14 @@ fn test_adjacently_a_ser() {
bar: 2,
different: Inner::Foo,
};
let e = "(type:\"VariantA\",content:(foo:1,bar:2,different:Foo))";
let e = "(type:VariantA,content:(foo:1,bar:2,different:Foo))";
test_ser(&v, e);
}

#[test]
fn test_adjacently_b_ser() {
let v = EnumStructAdjacently::VariantB { foo: 1, bar: 2 };
let e = "(type:\"VariantB\",content:(foo:1,bar:2))";
let e = "(type:VariantB,content:(foo:1,bar:2))";
test_ser(&v, e);
}

Expand Down Expand Up @@ -175,7 +175,7 @@ fn test_internally_b_de() {

#[test]
fn test_adjacently_a_de() {
let s = "(type:\"VariantA\",content:(foo:1,bar:2,different:Foo))";
let s = "(type:VariantA,content:(foo:1,bar:2,different:Foo))";
let e = EnumStructAdjacently::VariantA {
foo: 1,
bar: 2,
Expand All @@ -186,7 +186,7 @@ fn test_adjacently_a_de() {

#[test]
fn test_adjacently_b_de() {
let s = "(type:\"VariantB\",content:(foo:1,bar:2))";
let s = "(type:VariantB,content:(foo:1,bar:2))";
let e = EnumStructAdjacently::VariantB { foo: 1, bar: 2 };
test_de(s, e);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/207_adjacently_tagged_enum.rs
Expand Up @@ -14,7 +14,7 @@ fn test_adjacently_tagged() {

let ron_string = to_string(&source).unwrap();

assert_eq!(ron_string, "(type:\"Index\",data:1)");
assert_eq!(ron_string, "(type:Index,data:1)");

let deserialized = from_str::<TestEnum>(&ron_string).unwrap();

Expand Down
4 changes: 2 additions & 2 deletions tests/393_serde_errors.rs
Expand Up @@ -188,13 +188,13 @@ fn test_adjacently_tagged_enum() {
// the enum as a struct

assert_eq!(
ron::from_str::<TestEnumAdjacent>("(type: \"StructVariant\", content: (d: 4))"),
ron::from_str::<TestEnumAdjacent>("(type: StructVariant, content: (d: 4))"),
Err(SpannedError {
code: Error::MissingStructField {
field: "a",
outer: Some(String::from("TestEnumAdjacent")),
},
position: Position { line: 1, col: 39 },
position: Position { line: 1, col: 37 },
})
);
}
Expand Down
8 changes: 4 additions & 4 deletions tests/449_tagged_enum.rs
Expand Up @@ -165,7 +165,7 @@ fn test_enum_in_adjacently_tagged_roundtrip() {

let ron = ron::to_string(&outer).unwrap();

assert_eq!(ron, "(tag:\"Variant\",c:(field:Unit))");
assert_eq!(ron, "(tag:Variant,c:(field:Unit))");

let de = ron::from_str::<OuterEnumAdjacent>(&ron);

Expand All @@ -178,7 +178,7 @@ fn test_enum_in_adjacently_tagged_roundtrip() {

let ron = ron::to_string(&outer).unwrap();

assert_eq!(ron, "(tag:\"Sum\",c:(field:Newtype(true),value:42))");
assert_eq!(ron, "(tag:Sum,c:(field:Newtype(true),value:42))");

let de = ron::from_str::<OuterEnumAdjacent>(&ron);

Expand All @@ -191,7 +191,7 @@ fn test_enum_in_adjacently_tagged_roundtrip() {

let ron = ron::to_string(&outer).unwrap();

assert_eq!(ron, "(tag:\"Sum\",c:(field:Tuple(true,24),value:42))");
assert_eq!(ron, "(tag:Sum,c:(field:Tuple(true,24),value:42))");

let de = ron::from_str::<OuterEnumAdjacent>(&ron);

Expand All @@ -204,7 +204,7 @@ fn test_enum_in_adjacently_tagged_roundtrip() {

let ron = ron::to_string(&outer).unwrap();

assert_eq!(ron, "(tag:\"Sum\",c:(field:Struct(field:'🦀'),value:42))");
assert_eq!(ron, "(tag:Sum,c:(field:Struct(field:'🦀'),value:42))");

let de = ron::from_str::<OuterEnumAdjacent>(&ron);

Expand Down

0 comments on commit 1d4067c

Please sign in to comment.