From 809c6817be1c0ccaf5482baad9c19615d6777c1f Mon Sep 17 00:00:00 2001 From: kobewi Date: Mon, 8 Apr 2024 19:12:01 +0200 Subject: [PATCH] Add tests for signal await with parameters --- .../features/await_signal_with_parameters.gd | 25 +++++++++++++++++++ .../features/await_signal_with_parameters.out | 4 +++ 2 files changed, 29 insertions(+) create mode 100644 modules/gdscript/tests/scripts/runtime/features/await_signal_with_parameters.gd create mode 100644 modules/gdscript/tests/scripts/runtime/features/await_signal_with_parameters.out diff --git a/modules/gdscript/tests/scripts/runtime/features/await_signal_with_parameters.gd b/modules/gdscript/tests/scripts/runtime/features/await_signal_with_parameters.gd new file mode 100644 index 00000000000..ff0001676da --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/await_signal_with_parameters.gd @@ -0,0 +1,25 @@ +signal no_parameters() +signal one_parameter(number) +signal two_parameters(number1, number2) + +func await_no_parameters(): + var result = await no_parameters + print(result) + +func await_one_parameter(): + var result = await one_parameter + print(result) + +func await_two_parameters(): + var result = await two_parameters + print(result) + +func test(): + await_no_parameters() + no_parameters.emit() + + await_one_parameter() + one_parameter.emit(1) + + await_two_parameters() + two_parameters.emit(1, 2) diff --git a/modules/gdscript/tests/scripts/runtime/features/await_signal_with_parameters.out b/modules/gdscript/tests/scripts/runtime/features/await_signal_with_parameters.out new file mode 100644 index 00000000000..9e203c601c2 --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/await_signal_with_parameters.out @@ -0,0 +1,4 @@ +GDTEST_OK + +1 +[1, 2]