diff --git a/crates/toml_edit/src/document.rs b/crates/toml_edit/src/document.rs index f20e61a9..c1b60088 100644 --- a/crates/toml_edit/src/document.rs +++ b/crates/toml_edit/src/document.rs @@ -111,3 +111,10 @@ impl From for Document { } } } + +#[test] +#[cfg(feature = "parse")] +#[cfg(feature = "display")] +fn default_roundtrip() { + Document::default().to_string().parse::().unwrap(); +} diff --git a/crates/toml_edit/src/item.rs b/crates/toml_edit/src/item.rs index b58806e4..6ca227ef 100644 --- a/crates/toml_edit/src/item.rs +++ b/crates/toml_edit/src/item.rs @@ -390,3 +390,10 @@ pub fn table() -> Item { pub fn array() -> Item { Item::ArrayOfTables(ArrayOfTables::new()) } + +#[test] +#[cfg(feature = "parse")] +#[cfg(feature = "display")] +fn string_roundtrip() { + value("hello").to_string().parse::().unwrap(); +} diff --git a/crates/toml_edit/src/key.rs b/crates/toml_edit/src/key.rs index 2f4c30ae..8ae2dd13 100644 --- a/crates/toml_edit/src/key.rs +++ b/crates/toml_edit/src/key.rs @@ -434,3 +434,10 @@ impl<'k> std::fmt::Display for KeyMut<'k> { std::fmt::Display::fmt(&self.key, f) } } + +#[test] +#[cfg(feature = "parse")] +#[cfg(feature = "display")] +fn string_roundtrip() { + Key::new("hello").to_string().parse::().unwrap(); +} diff --git a/crates/toml_edit/src/value.rs b/crates/toml_edit/src/value.rs index f4164340..5797574e 100644 --- a/crates/toml_edit/src/value.rs +++ b/crates/toml_edit/src/value.rs @@ -376,3 +376,10 @@ mod tests { assert_eq!(features.to_string(), r#"["node", "mouth"]"#); } } + +#[test] +#[cfg(feature = "parse")] +#[cfg(feature = "display")] +fn string_roundtrip() { + Value::from("hello").to_string().parse::().unwrap(); +}