diff options
author | Blas Rodriguez Irizar <rodrigblas@gmail.com> | 2020-08-20 21:48:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-20 15:48:27 -0400 |
commit | 138eef352671aadffca304d62c69cb2582e64f2a (patch) | |
tree | 884e7c38802a8e19a4d4d438183e384b1046a77b /tokio-test/tests | |
parent | c393236dfd12c13e82badd631d3a3a90481c6f95 (diff) |
test: implement Drop for Mock to panic w/ unconsumed data (#2704)
Diffstat (limited to 'tokio-test/tests')
-rw-r--r-- | tokio-test/tests/io.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tokio-test/tests/io.rs b/tokio-test/tests/io.rs index 948bc323..f164abaf 100644 --- a/tokio-test/tests/io.rs +++ b/tokio-test/tests/io.rs @@ -70,3 +70,17 @@ async fn write_error() { mock.write_all(b"world!").await.expect("write 2"); } + +#[tokio::test] +#[should_panic] +async fn mock_panics_read_data_left() { + use tokio_test::io::Builder; + Builder::new().read(b"read").build(); +} + +#[tokio::test] +#[should_panic] +async fn mock_panics_write_data_left() { + use tokio_test::io::Builder; + Builder::new().write(b"write").build(); +} |