()
| 3211 | |
| 3212 | #[test] |
| 3213 | fn protocol_stdio_fails_closed_when_detached() -> Result<()> { |
| 3214 | use std::task::{Context, Poll, Waker}; |
| 3215 | use wasmer_wasix::VirtualFile; |
| 3216 | use wasmer_wasix::virtual_fs::AsyncWrite; |
| 3217 | |
| 3218 | let mut file = ProtocolStdioFile::new(); |
| 3219 | let mut cx = Context::from_waker(Waker::noop()); |
| 3220 | |
| 3221 | match Pin::new(&mut file).poll_write_ready(&mut cx) { |
| 3222 | Poll::Ready(Err(err)) => assert_eq!(err.kind(), io::ErrorKind::BrokenPipe), |
| 3223 | other => panic!("unexpected detached write-ready result: {other:?}"), |
| 3224 | } |
| 3225 | match Pin::new(&mut file).poll_write(&mut cx, b"lost bytes") { |
| 3226 | Poll::Ready(Err(err)) => assert_eq!(err.kind(), io::ErrorKind::BrokenPipe), |
| 3227 | other => panic!("unexpected detached write result: {other:?}"), |
| 3228 | } |
| 3229 | match Pin::new(&mut file).poll_flush(&mut cx) { |
| 3230 | Poll::Ready(Err(err)) => assert_eq!(err.kind(), io::ErrorKind::BrokenPipe), |
| 3231 | other => panic!("unexpected detached flush result: {other:?}"), |
| 3232 | } |
| 3233 | |
| 3234 | Ok(()) |
| 3235 | } |
| 3236 | |
| 3237 | #[test] |
| 3238 | fn block_on_tokio_runtime_works_inside_tokio_runtime() -> Result<()> { |
nothing calls this directly
no test coverage detected