Skip to content

Commit

Permalink
test(common): add basic test for AlertOnEos
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkarw committed Aug 19, 2022
1 parent d61db23 commit 0ec027e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/common/buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,16 @@ impl<B: Buf> Buf for AlertOnEos<B> {

#[cfg(test)]
mod tests {
use crate::common::buf::AlertOnEos;
use hyper::body::{Buf, Bytes};
use std::time::Duration;

}
#[tokio::test]
async fn test_get_notified() {
let buf = Bytes::from_static(b"abc");
let (mut buf, signaler) = AlertOnEos::new(buf);
buf.advance(3);
let result = tokio::time::timeout(Duration::from_secs(1), signaler.wait_till_eos()).await;
assert_eq!(result, Ok(()));
}
}

0 comments on commit 0ec027e

Please sign in to comment.