File: test_weird_poll.rs

package info (click to toggle)
rust-actix-web 4.11.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,748 kB
  • sloc: makefile: 2
file content (30 lines) | stat: -rw-r--r-- 881 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//! Regression test for https://github.com/actix/actix-web/issues/1321

// use actix_http::body::{BodyStream, MessageBody};
// use bytes::Bytes;
// use futures_channel::oneshot;
// use futures_util::{
//     stream::once,
//     task::{noop_waker, Context},
// };

// #[test]
// fn weird_poll() {
//     let (sender, receiver) = oneshot::channel();
//     let mut body_stream = Ok(BodyStream::new(once(async {
//         let x = Box::new(0);
//         let y = &x;
//         receiver.await.unwrap();
//         let _z = **y;
//         Ok::<_, ()>(Bytes::new())
//     })));

//     let waker = noop_waker();
//     let mut cx = Context::from_waker(&waker);

//     let _ = body_stream.as_mut().unwrap().poll_next(&mut cx);
//     sender.send(()).unwrap();
//     let _ = std::mem::replace(&mut body_stream, Err([0; 32]))
//         .unwrap()
//         .poll_next(&mut cx);
// }