Skip to content

Commit

Permalink
Add #530 as test to ensure it remains fixed (#531)
Browse files Browse the repository at this point in the history
  • Loading branch information
juntyr authored Mar 18, 2024
1 parent b707456 commit e8ca8c5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/530_untagged_union.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use std::ops::Bound;

#[derive(serde::Deserialize, serde::Serialize, PartialEq, Eq, Debug)]
#[serde(untagged)]
enum EitherInterval<V> {
B(Interval<V>),
D(V, Option<V>),
}

type Interval<V> = (Bound<V>, Bound<V>);

#[test]
fn serde_roundtrip() {
let interval = EitherInterval::B((Bound::Excluded(0u8), Bound::Unbounded));

let ron: String = ron::ser::to_string(&interval).unwrap();
assert_eq!(ron, "(Excluded(0),Unbounded)");

let de = ron::de::from_str(&ron).unwrap();
assert_eq!(interval, de);
}

0 comments on commit e8ca8c5

Please sign in to comment.