diff --git a/itest/rust/src/builtin_tests/containers/callable_test.rs b/itest/rust/src/builtin_tests/containers/callable_test.rs index c5e6bded9..3e4eeb52e 100644 --- a/itest/rust/src/builtin_tests/containers/callable_test.rs +++ b/itest/rust/src/builtin_tests/containers/callable_test.rs @@ -109,7 +109,7 @@ fn callable_call_return() { callable.callv(&varray![10]), 10.to_variant().stringify().to_variant() ); - // errors in godot but does not crash + // Errors in Godot, but should not crash. assert_eq!(callable.callv(&varray!["string"]), Variant::nil()); } @@ -190,6 +190,14 @@ pub mod custom_callable { assert_eq!(sum3, 0.to_variant()); } + #[itest] + fn callable_custom_with_err() { + let callable_with_err = + Callable::from_fn("on_error_doesnt_crash", |_args: &[&Variant]| Err(())); + // Errors in Godot, but should not crash. + assert_eq!(callable_with_err.callv(&varray![]), Variant::nil()); + } + #[itest] fn callable_from_fn_eq() { let a = Callable::from_fn("sum", sum);