Skip to content

Commit

Permalink
test: add unit test for binding arguments to static-method callables
Browse files Browse the repository at this point in the history
  • Loading branch information
arocull committed Feb 1, 2025
1 parent f50d8e7 commit 7e11a42
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions itest/rust/src/builtin_tests/containers/callable_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,21 @@ fn callable_static() {

#[cfg(since_api = "4.3")]
assert_eq!(callable.get_argument_count(), 0); // Consistently doesn't work :)

// Create a bind with some filled parameters
// Within Godot, binded arguments are used in-order AFTER call arguments
let bind = callable.bind(&[
"two".to_variant(),
array![&NodePath::from("three/four")].to_variant(),
RefCounted::new_gd().to_variant(),
]);
assert!(!Variant::is_nil(&bind.to_variant())); // Binded callable should still exist

// Call the binding, filling in the first argument
// let bind_result = bind.call(&[1.to_variant()]);
// assert!(!Variant::is_nil(&bind_result)); // Ensure result also exists (FAILS HERE)
// let bind_result_data: VariantArray = bind_result.to();
// assert_eq!(4, bind_result_data.len()); // Ensure result contains data
}

#[itest]
Expand Down

0 comments on commit 7e11a42

Please sign in to comment.