Skip to content

Commit 0ec027e

Browse files
committed
test(common): add basic test for AlertOnEos
1 parent d61db23 commit 0ec027e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/common/buf.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,16 @@ impl<B: Buf> Buf for AlertOnEos<B> {
6161

6262
#[cfg(test)]
6363
mod tests {
64+
use crate::common::buf::AlertOnEos;
65+
use hyper::body::{Buf, Bytes};
66+
use std::time::Duration;
6467

65-
}
68+
#[tokio::test]
69+
async fn test_get_notified() {
70+
let buf = Bytes::from_static(b"abc");
71+
let (mut buf, signaler) = AlertOnEos::new(buf);
72+
buf.advance(3);
73+
let result = tokio::time::timeout(Duration::from_secs(1), signaler.wait_till_eos()).await;
74+
assert_eq!(result, Ok(()));
75+
}
76+
}

0 commit comments

Comments
 (0)