Skip to content

Commit

Permalink
Add test that checks if custom callables don't crash when Err() is re…
Browse files Browse the repository at this point in the history
…turned.
  • Loading branch information
Yarwin committed Nov 10, 2024
1 parent 8beef9d commit 83b0962
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions itest/rust/src/builtin_tests/containers/callable_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 83b0962

Please sign in to comment.