summaryrefslogtreecommitdiffstats
path: root/tokio/tests/io_lines.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tokio/tests/io_lines.rs')
-rw-r--r--tokio/tests/io_lines.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/tokio/tests/io_lines.rs b/tokio/tests/io_lines.rs
index e85fbff7..83240d62 100644
--- a/tokio/tests/io_lines.rs
+++ b/tokio/tests/io_lines.rs
@@ -3,10 +3,24 @@
use tokio::io::AsyncBufReadExt;
use tokio_test::assert_ok;
-use futures_util::StreamExt;
+#[tokio::test]
+async fn lines_inherent() {
+ let rd: &[u8] = b"hello\r\nworld\n\n";
+ let mut st = rd.lines();
+
+ let b = assert_ok!(st.next_line().await).unwrap();
+ assert_eq!(b, "hello");
+ let b = assert_ok!(st.next_line().await).unwrap();
+ assert_eq!(b, "world");
+ let b = assert_ok!(st.next_line().await).unwrap();
+ assert_eq!(b, "");
+ assert!(assert_ok!(st.next_line().await).is_none());
+}
#[tokio::test]
-async fn lines() {
+async fn lines_stream() {
+ use futures::StreamExt;
+
let rd: &[u8] = b"hello\r\nworld\n\n";
let mut st = rd.lines();