summaryrefslogtreecommitdiffstats
path: root/test/project
diff options
context:
space:
mode:
authorDavid Snopek <dsnopek@gmail.com>2023-06-28 21:55:04 -0500
committerDavid Snopek <dsnopek@gmail.com>2023-09-21 15:17:50 -0500
commitc18c1916c3f465d00800921d527902f18308fbf4 (patch)
tree5ca066cd3e84799c40defebe7923d7785bc20fe6 /test/project
parent4314f91b7dc23d930506f52d3a3c88fae0f5d57d (diff)
downloadredot-cpp-c18c1916c3f465d00800921d527902f18308fbf4.tar.gz
Implement `callable_mp()` and `callable_mp_static()`
Diffstat (limited to 'test/project')
-rw-r--r--test/project/main.gd22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/project/main.gd b/test/project/main.gd
index dbc60f8..f51ef3b 100644
--- a/test/project/main.gd
+++ b/test/project/main.gd
@@ -96,6 +96,28 @@ func _ready():
# String::resize().
assert_equal(example.test_string_resize("What"), "What!?")
+ # mp_callable() with void method.
+ var mp_callable: Callable = example.test_callable_mp()
+ mp_callable.call(example, "void", 36)
+ assert_equal(custom_signal_emitted, ["unbound_method1: Example - void", 36])
+
+ # mp_callable() with return value.
+ var mp_callable_ret: Callable = example.test_callable_mp_ret()
+ assert_equal(mp_callable_ret.call(example, "test", 77), "unbound_method2: Example - test - 77")
+
+ # mp_callable() with const method and return value.
+ var mp_callable_retc: Callable = example.test_callable_mp_retc()
+ assert_equal(mp_callable_retc.call(example, "const", 101), "unbound_method3: Example - const - 101")
+
+ # mp_callable_static() with void method.
+ var mp_callable_static: Callable = example.test_callable_mp_static()
+ mp_callable_static.call(example, "static", 83)
+ assert_equal(custom_signal_emitted, ["unbound_static_method1: Example - static", 83])
+
+ # mp_callable_static() with return value.
+ var mp_callable_static_ret: Callable = example.test_callable_mp_static_ret()
+ assert_equal(mp_callable_static_ret.call(example, "static-ret", 84), "unbound_static_method2: Example - static-ret - 84")
+
# PackedArray iterators
assert_equal(example.test_vector_ops(), 105)