Skip to content

Commit

Permalink
Add borrowing rules test
Browse files Browse the repository at this point in the history
  • Loading branch information
intendednull committed Oct 31, 2022
1 parent 02c6434 commit 013f009
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions crates/yewdux/src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,23 @@ mod tests {
assert!(old != new);
}

#[cfg(feature = "future")]
#[async_std::test]
async fn reduce_future_does_not_clash() {
use std::time::Duration;

let dispatch = Dispatch::<TestState>::new();

dispatch
.reduce_future(|state| async move {
async_std::task::sleep(Duration::from_millis(100)).await;
state
})
.await;

dispatch.reduce(|s| s);
}

#[test]
fn reduce_mut_changes_value() {
let old = get::<TestState>();
Expand Down

0 comments on commit 013f009

Please sign in to comment.