Skip to content

Commit 1c6c407

Browse files
committed
test: doc
1 parent 5536c57 commit 1c6c407

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

tests/issues.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,21 @@ use async_compression::tokio::write::ZstdEncoder;
1010
use tokio::io::{AsyncWrite, AsyncWriteExt as _};
1111
use tracing_subscriber::fmt::format::FmtSpan;
1212

13+
/// This issue covers our state machine being invalid when using adapters
14+
/// like [`tokio_util::codec`].
15+
///
16+
/// After the first [`poll_shutdown`] call,
17+
/// we must expect any number of [`poll_flush`] and [`poll_shutdown`] calls,
18+
/// until [`poll_shutdown`] returns [`Poll::Ready`],
19+
/// according to the documentation on [`AsyncWrite`].
20+
///
1321
/// <https://github.com/Nullus157/async-compression/issues/246>
14-
#[tokio::test]
15-
async fn issue_246() {
22+
///
23+
/// [`tokio_util::codec`](https://docs.rs/tokio-util/latest/tokio_util/codec)
24+
/// [`poll_shutdown`](AsyncWrite::poll_shutdown)
25+
/// [`poll_flush`](AsyncWrite::poll_flush)
26+
#[test]
27+
fn issue_246() {
1628
tracing_subscriber::fmt()
1729
.without_time()
1830
.with_ansi(false)
@@ -23,7 +35,7 @@ async fn issue_246() {
2335
.init();
2436
let mut zstd_encoder =
2537
Transparent::new(Trace::new(ZstdEncoder::new(DelayedShutdown::default())));
26-
zstd_encoder.shutdown().await.unwrap();
38+
futures::executor::block_on(zstd_encoder.shutdown()).unwrap();
2739
}
2840

2941
pin_project_lite::pin_project! {

0 commit comments

Comments
 (0)