()
| 1256 | Poll::Ready(()) |
| 1257 | } else { |
| 1258 | self.count += 1; |
| 1259 | cx.waker().wake_by_ref(); |
| 1260 | Poll::Pending |
| 1261 | } |
| 1262 | } |
| 1263 | } |
| 1264 | |
| 1265 | /// Tests that we can spawn futures onto a scope, and that the scope really |
| 1266 | /// does poll wait for the future to complete before returning. |
| 1267 | #[test] |
| 1268 | fn scope_pending_future() { |
| 1269 | static THREAD_POOL: ThreadPool = ThreadPool::new(); |
| 1270 | THREAD_POOL.resize_to_available(); |
| 1271 | |
| 1272 | THREAD_POOL.scope(|scope| scope.spawn(CountFuture::default())); |
| 1273 | |
| 1274 | THREAD_POOL.depopulate(); |
| 1275 | } |
| 1276 | |
| 1277 | /// Tests that a future that sleeps for a nontrivial amount of time does not |
| 1278 | /// cause the scope to exit early. |
| 1279 | #[test] |
| 1280 | fn scope_sleeping_future() { |
| 1281 | static THREAD_POOL: ThreadPool = ThreadPool::new(); |
| 1282 | THREAD_POOL.resize_to_available(); |
nothing calls this directly
no test coverage detected