Skip to content

Commit

Permalink
Add a test for tafia#280
Browse files Browse the repository at this point in the history
  • Loading branch information
dralley committed Aug 17, 2021
1 parent ad3d9c2 commit b201e6d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
21 changes: 21 additions & 0 deletions tests/serde_roundtrip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,27 @@ struct Nodes {
items: Vec<Node>,
}

#[derive(Debug, PartialEq, Deserialize, Serialize)]
pub struct NamesList {
pub names: Vec<String>,
}

#[ignore]
#[test]
fn struct_with_vec_string() {
let names = NamesList {
names: ["pickaxe", "torch", "bow"]
.iter()
.map(|s| s.to_string())
.collect(),
};

let serialized = to_string(&names).unwrap();
let deserialized: NamesList = from_str(&serialized).unwrap();

assert_eq!(names, deserialized);
}

#[test]
fn basic_struct() {
let src = r#"<Item><name>Banana</name><source>Store</source></Item>"#;
Expand Down
5 changes: 4 additions & 1 deletion tests/unit_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,10 @@ fn test_write_attrs() -> Result<()> {
}

let result = writer.into_inner().into_inner();
assert_eq!(result, expected.as_bytes());
assert_eq!(
std::str::from_utf8(&result).unwrap(),
std::str::from_utf8(expected.as_bytes()).unwrap()
);

Ok(())
}
Expand Down

0 comments on commit b201e6d

Please sign in to comment.