diff --git a/Cargo.toml b/Cargo.toml index 02ba05d4..95d9d3f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -129,3 +129,7 @@ required-features = ["serialize"] [[test]] name = "serde-migrated" required-features = ["serialize"] + +[[test]] +name = "async_test" +required-features = ["async"] diff --git a/tests/async_test.rs b/tests/async_test.rs new file mode 100644 index 00000000..50f8b1d0 --- /dev/null +++ b/tests/async_test.rs @@ -0,0 +1,25 @@ +use std::path::PathBuf; + +use pretty_assertions::assert_eq; +use quick_xml::events::Event::*; +use quick_xml::Reader; + +#[tokio::test] +async fn test_sample() { + let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + let mut reader = Reader::from_file_async(path.join("tests/documents/sample_rss.xml")) + .await + .unwrap(); + let mut buf = Vec::new(); + let mut count = 0; + loop { + match reader.read_event_into(&mut buf).await.unwrap() { + Start(_) => count += 1, + Decl(e) => println!("{:?}", e.version()), + Eof => break, + _ => (), + } + buf.clear(); + } + println!("{}", count); +}