diff --git a/dsp-meta/tests/json-toml.rs b/dsp-meta/tests/json-toml.rs index 68122544..a033b2aa 100644 --- a/dsp-meta/tests/json-toml.rs +++ b/dsp-meta/tests/json-toml.rs @@ -74,9 +74,9 @@ pub struct Project { pub end_date: Option, pub contact_point: Option, pub how_to_cite: String, - pub publications: Option>, - pub grants: Option>, - pub alternative_names: Option>, + pub publications: Option>, + pub grants: Option>, + pub alternative_names: Option>, } #[derive(Debug, Serialize, Deserialize, PartialEq)] @@ -266,11 +266,12 @@ pub enum TextOrUrl { #[derive(Debug, Serialize, Deserialize, PartialEq)] pub struct Untagged { - text_or_url: NonEmpty, + the_enum: NonEmpty, } #[derive(Debug, Serialize, Deserialize, PartialEq)] pub struct P { + some_str: Option, p: Untagged, } @@ -279,15 +280,16 @@ fn untagged_enum() { let mut val = NonEmpty::new( UrlValue(Url { - url: "url".to_string(), + url: "http://example.com".to_string(), text: Some("text".to_string()), url_type: UrlType::URL, })); val.push(TextValue(Text([("en".to_string(), "English".to_string())].iter().cloned().collect()))); let un = P { + some_str: None, p: Untagged { - text_or_url: val - } + the_enum: val + }, }; let foo = toml::to_string(&un).expect("To TOML"); println!("{}", foo);