Skip to content

Commit

Permalink
test: doc
Browse files Browse the repository at this point in the history
  • Loading branch information
aatifsyed committed Oct 31, 2024
1 parent 5536c57 commit 1c6c407
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions tests/issues.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,21 @@ use async_compression::tokio::write::ZstdEncoder;
use tokio::io::{AsyncWrite, AsyncWriteExt as _};
use tracing_subscriber::fmt::format::FmtSpan;

/// This issue covers our state machine being invalid when using adapters
/// like [`tokio_util::codec`].
///
/// After the first [`poll_shutdown`] call,
/// we must expect any number of [`poll_flush`] and [`poll_shutdown`] calls,
/// until [`poll_shutdown`] returns [`Poll::Ready`],
/// according to the documentation on [`AsyncWrite`].
///
/// <https://github.com/Nullus157/async-compression/issues/246>
#[tokio::test]
async fn issue_246() {
///
/// [`tokio_util::codec`](https://docs.rs/tokio-util/latest/tokio_util/codec)
/// [`poll_shutdown`](AsyncWrite::poll_shutdown)
/// [`poll_flush`](AsyncWrite::poll_flush)
#[test]
fn issue_246() {
tracing_subscriber::fmt()
.without_time()
.with_ansi(false)
Expand All @@ -23,7 +35,7 @@ async fn issue_246() {
.init();
let mut zstd_encoder =
Transparent::new(Trace::new(ZstdEncoder::new(DelayedShutdown::default())));
zstd_encoder.shutdown().await.unwrap();
futures::executor::block_on(zstd_encoder.shutdown()).unwrap();
}

pin_project_lite::pin_project! {
Expand Down

0 comments on commit 1c6c407

Please sign in to comment.