diff options
author | Eric Huss <eric@huss.org> | 2019-05-08 17:45:39 -0700 |
---|---|---|
committer | Eric Huss <eric@huss.org> | 2019-05-08 17:45:39 -0700 |
commit | 0fca4dd2d30a2044af454cf55211e67cf76f333c (patch) | |
tree | 6a41d4f9ce2fba536d02325fff70076f00910a8d /test-suite/tests/display-tricky.rs | |
parent | 6c162e6562c3e432bf04c82a3d1d789d80761a86 (diff) | |
download | milf-rs-0fca4dd2d30a2044af454cf55211e67cf76f333c.tar.gz milf-rs-0fca4dd2d30a2044af454cf55211e67cf76f333c.zip |
cargo fmt
Diffstat (limited to 'test-suite/tests/display-tricky.rs')
-rw-r--r-- | test-suite/tests/display-tricky.rs | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/test-suite/tests/display-tricky.rs b/test-suite/tests/display-tricky.rs index 069e0f9..0daa10e 100644 --- a/test-suite/tests/display-tricky.rs +++ b/test-suite/tests/display-tricky.rs @@ -1,5 +1,6 @@ extern crate toml; -#[macro_use] extern crate serde_derive; +#[macro_use] +extern crate serde_derive; #[derive(Debug, Serialize, Deserialize)] pub struct Recipe { @@ -8,41 +9,47 @@ pub struct Recipe { #[serde(default)] pub modules: Vec<Modules>, #[serde(default)] - pub packages: Vec<Packages> + pub packages: Vec<Packages>, } #[derive(Debug, Serialize, Deserialize)] pub struct Modules { pub name: String, - pub version: Option<String> + pub version: Option<String>, } #[derive(Debug, Serialize, Deserialize)] pub struct Packages { pub name: String, - pub version: Option<String> + pub version: Option<String>, } #[test] fn both_ends() { - let recipe_works = toml::from_str::<Recipe>(r#" + let recipe_works = toml::from_str::<Recipe>( + r#" name = "testing" description = "example" modules = [] [[packages]] name = "base" - "#).unwrap(); + "#, + ) + .unwrap(); toml::to_string(&recipe_works).unwrap(); - let recipe_fails = toml::from_str::<Recipe>(r#" + let recipe_fails = toml::from_str::<Recipe>( + r#" name = "testing" description = "example" packages = [] [[modules]] name = "base" - "#).unwrap(); + "#, + ) + .unwrap(); let recipe_toml = toml::Value::try_from(recipe_fails).unwrap(); recipe_toml.to_string(); |