Skip to content

Commit

Permalink
test(edit): Verify display/from_str behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Feb 7, 2024
1 parent a20848d commit 06dfa30
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/toml_edit/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,10 @@ impl From<Table> for Document {
}
}
}

#[test]
#[cfg(feature = "parse")]
#[cfg(feature = "display")]
fn default_roundtrip() {
Document::default().to_string().parse::<Document>().unwrap();
}
7 changes: 7 additions & 0 deletions crates/toml_edit/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Item>().unwrap();
}
7 changes: 7 additions & 0 deletions crates/toml_edit/src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Key>().unwrap();
}
7 changes: 7 additions & 0 deletions crates/toml_edit/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Value>().unwrap();
}

0 comments on commit 06dfa30

Please sign in to comment.