1 #![warn(rust_2018_idioms)] 2 #![cfg(feature = "full")] 3 4 use tokio::io::AsyncReadExt; 5 use tokio_test::assert_ok; 6 7 #[tokio::test] read_to_string()8async fn read_to_string() { 9 let mut buf = String::new(); 10 let mut rd: &[u8] = b"hello world"; 11 12 let n = assert_ok!(rd.read_to_string(&mut buf).await); 13 assert_eq!(n, 11); 14 assert_eq!(buf[..], "hello world"[..]); 15 } 16