Skip to content

Commit

Permalink
test: fix concurrent calls
Browse files Browse the repository at this point in the history
  • Loading branch information
jost-s committed Jan 10, 2024
1 parent b1e5afa commit fb54445
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions test/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,31 +265,27 @@ pub mod tests {
let call_1 = thread::spawn({
let some_struct = some_struct.clone();
move || {
let result: SomeStruct = guest::call(
guest::call::<_, SomeStruct>(
&mut store_1.lock().as_store_mut(),
instance_1,
"native_type",
some_struct.clone(),
)
.expect("native type handling");
assert_eq!(some_struct, result);
}
});
let call_2 = thread::spawn({
let some_struct = some_struct.clone();
move || {
let result: SomeStruct = guest::call(
guest::call::<_, SomeStruct>(
&mut store_2.lock().as_store_mut(),
instance_2,
"native_type",
some_struct.clone(),
)
.expect("native type handling");
assert_eq!(some_struct, result);
}
});
assert!(matches!(call_1.join(), Ok(())));
assert!(matches!(call_2.join(), Ok(())));
assert!(matches!(call_1.join(), Ok(SomeStruct)));
assert!(matches!(call_2.join(), Ok(SomeStruct)));
}

#[test]
Expand Down

0 comments on commit fb54445

Please sign in to comment.