File tree 2 files changed +29
-0
lines changed
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -129,3 +129,7 @@ required-features = ["serialize"]
129
129
[[test ]]
130
130
name = " serde-migrated"
131
131
required-features = [" serialize" ]
132
+
133
+ [[test ]]
134
+ name = " async_test"
135
+ required-features = [" async" ]
Original file line number Diff line number Diff line change
1
+ use std:: path:: PathBuf ;
2
+
3
+ use pretty_assertions:: assert_eq;
4
+ use quick_xml:: events:: Event :: * ;
5
+ use quick_xml:: Reader ;
6
+
7
+ #[ tokio:: test]
8
+ async fn test_sample ( ) {
9
+ let path = PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
10
+ let mut reader = Reader :: from_file_async ( path. join ( "tests/documents/sample_rss.xml" ) )
11
+ . await
12
+ . unwrap ( ) ;
13
+ let mut buf = Vec :: new ( ) ;
14
+ let mut count = 0 ;
15
+ loop {
16
+ match reader. read_event_into ( & mut buf) . await . unwrap ( ) {
17
+ Start ( _) => count += 1 ,
18
+ Decl ( e) => println ! ( "{:?}" , e. version( ) ) ,
19
+ Eof => break ,
20
+ _ => ( ) ,
21
+ }
22
+ buf. clear ( ) ;
23
+ }
24
+ println ! ( "{}" , count) ;
25
+ }
You can’t perform that action at this time.
0 commit comments