From 3fecd0154c9e48ffbaf8d839ce5728b1c833d3de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Fri, 22 Jun 2018 23:07:02 +0200 Subject: [PATCH] Add an explicit wait for the test to finish (#445) --- tokio-fs/tests/file.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tokio-fs/tests/file.rs b/tokio-fs/tests/file.rs index 05e46d299..c8185c1f2 100644 --- a/tokio-fs/tests/file.rs +++ b/tokio-fs/tests/file.rs @@ -63,15 +63,20 @@ fn read_write() { assert_eq!(dst, contents); + let (tx, rx) = oneshot::channel(); + pool.spawn({ File::open(file_path) .and_then(|file| io::read_to_end(file, vec![])) .then(move |res| { let (_, buf) = res.unwrap(); assert_eq!(buf, contents); + tx.send(()).unwrap(); Ok(()) }) }); + + rx.wait().unwrap(); } #[test]