Skip to content

Commit

Permalink
fix: test_function_release_strong_count
Browse files Browse the repository at this point in the history
  • Loading branch information
Wodann committed Jul 16, 2023
1 parent 42fadbd commit f93d7b1
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions crates/mun_runtime_capi/src/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,11 @@ pub(crate) mod tests {

#[test]
fn test_function_release_strong_count() {
let function = mun_runtime::FunctionDefinition::builder("foo").finish();
let ffi_function: Function = function.into();
let fn_def = mun_runtime::FunctionDefinition::builder("foo").finish();
let ffi_function: Function = fn_def.clone().into();

let fn_def = ManuallyDrop::new(unsafe {
Arc::from_raw(ffi_function.0 as *const mun_runtime::FunctionDefinition)
});
let strong_count = Arc::strong_count(&fn_def);
assert!(strong_count > 0);
assert!(strong_count == 2);

assert!(unsafe { mun_function_release(ffi_function) }.is_ok());

Expand Down

0 comments on commit f93d7b1

Please sign in to comment.