From e20c4067dcfc50bd560b859bd4ec0190b1a4fc6a Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Mon, 4 Feb 2019 16:38:21 +0100 Subject: [PATCH] futures: Add a test for creating multiple futures from the same promise --- crates/futures/tests/tests.rs | 7 +++++++ 1 file changed, 7 insertions(+) mode change 100644 => 100755 crates/futures/tests/tests.rs diff --git a/crates/futures/tests/tests.rs b/crates/futures/tests/tests.rs old mode 100644 new mode 100755 index e8e6bbf4267..d8ea2674e6b --- a/crates/futures/tests/tests.rs +++ b/crates/futures/tests/tests.rs @@ -108,3 +108,10 @@ fn spawn_local_err_no_exception() -> impl Future { }) } +#[wasm_bindgen_test(async)] +fn can_create_multiple_futures_from_same_promise() -> impl Future { + let promise = js_sys::Promise::resolve(&JsValue::null()); + let a = JsFuture::from(promise.clone()); + let b = JsFuture::from(promise); + futures::future::join_all(vec![a, b]).map(|_| ()) +}