Add more tests.

This commit is contained in:
Bauke 2021-09-27 12:23:50 +02:00
parent 40e9e785b9
commit c146776e8b
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,11 @@
use opml::OPML;
#[test]
#[allow(deprecated)]
fn test_deprecated_functions() {
let xml = r#"<opml version="2.0"><head/><body><outline text="Outline"/></body></opml>"#;
let document = OPML::new(xml).unwrap();
assert_eq!(document.version, "2.0");
assert!(document.to_xml().is_ok());
}

View File

@ -99,3 +99,17 @@ fn test_valid_opml_1_0() {
}
);
}
#[test]
fn test_valid_from_reader() {
let xml = r#"<opml version="2.0"><head/><body><outline text="Outline"/></body></opml>"#;
assert!(OPML::from_reader(&mut xml.as_bytes()).is_ok());
}
#[test]
fn test_valid_to_writer() {
let document = OPML::default();
let mut writer = vec![];
assert!(document.to_writer(&mut writer).is_ok());
assert!(!writer.is_empty());
}