Skip to content

Commit

Permalink
futures: Add a test for creating multiple futures from the same promise
Browse files Browse the repository at this point in the history
  • Loading branch information
fitzgen committed Feb 4, 2019
1 parent bf8a380 commit e20c406
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/futures/tests/tests.rs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,10 @@ fn spawn_local_err_no_exception() -> impl Future<Item = (), Error = JsValue> {
})
}

#[wasm_bindgen_test(async)]
fn can_create_multiple_futures_from_same_promise() -> impl Future<Item = (), Error = JsValue> {
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(|_| ())
}

0 comments on commit e20c406

Please sign in to comment.