Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update adjacent enum non-roundtrip tests to match serde-rs/serde#2505 #471

Merged
merged 1 commit into from
Aug 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tests/123_enum_representation.rs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading