MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / protocol_stdio_fails_closed_when_detached

Function protocol_stdio_fails_closed_when_detached

src/pglite/postgres_mod.rs:3213–3235  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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<()> {

Callers

nothing calls this directly

Calls 3

poll_write_readyMethod · 0.45
poll_writeMethod · 0.45
poll_flushMethod · 0.45

Tested by

no test coverage detected