From 85a53e8e1fa4974224ff5c8cbf21ddb5796403bc Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Mon, 18 Nov 2019 12:44:00 +0100 Subject: [PATCH] test(runtime-core) Test closures in `Func::new`. --- lib/runtime-core/src/typed_func.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/runtime-core/src/typed_func.rs b/lib/runtime-core/src/typed_func.rs index d2fe59a61..87003612e 100644 --- a/lib/runtime-core/src/typed_func.rs +++ b/lib/runtime-core/src/typed_func.rs @@ -819,8 +819,14 @@ mod tests { vec![$($x),*].iter().sum() } - let _func = Func::new(with_vmctx); - let _func = Func::new(without_vmctx); + let _ = Func::new(with_vmctx); + let _ = Func::new(without_vmctx); + let _ = Func::new(|_: &mut vm::Ctx, $($x: i32),*| -> i32 { + vec![$($x),*].iter().sum() + }); + let _ = Func::new(|$($x: i32),*| -> i32 { + vec![$($x),*].iter().sum() + }); } } } @@ -837,6 +843,8 @@ mod tests { let _ = Func::new(foo); let _ = Func::new(bar); + let _ = Func::new(|_: &mut vm::Ctx| -> i32 { 0 }); + let _ = Func::new(|| -> i32 { 0 }); } test_func_arity_n!(test_func_arity_1, a);