()
| 1400 | cx: &mut Context<'_>, |
| 1401 | ) -> Poll<Self::Output> { |
| 1402 | if self.count == 128 { |
| 1403 | Poll::Ready(()) |
| 1404 | } else { |
| 1405 | self.count += 1; |
| 1406 | cx.waker().wake_by_ref(); |
| 1407 | Poll::Pending |
| 1408 | } |
| 1409 | } |
| 1410 | } |
| 1411 | |
| 1412 | /// Tests that we can spawn futures onto a scope, and that the scope really |
| 1413 | /// does poll wait for the future to complete before returning. |
| 1414 | #[test] |
| 1415 | fn scope_pending_future() { |
| 1416 | static THREAD_POOL: ThreadPool = ThreadPool::new(); |
| 1417 | THREAD_POOL.resize_to_available(); |
| 1418 | |
| 1419 | THREAD_POOL.scope(|scope| scope.spawn(CountFuture::default())); |
| 1420 | |
| 1421 | THREAD_POOL.depopulate(); |
| 1422 | } |
| 1423 | |
| 1424 | /// Tests that a future that sleeps for a nontrivial amount of time does not |
| 1425 | /// cause the scope to exit early. |
| 1426 | #[test] |
nothing calls this directly
no test coverage detected