summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests
diff options
context:
space:
mode:
authorGeorge Marques <george@gmarqu.es>2021-10-14 19:58:10 -0300
committerGeorge Marques <george@gmarqu.es>2021-10-14 19:58:10 -0300
commit056a54db7be5b63685f221e34c17cc4b72964080 (patch)
tree5b787da4abbf649e650085dc674947818324fd7b /modules/gdscript/tests
parentd36213bab8d71575b39c4d5d96622f3e91dc09ee (diff)
GDScript: Properly return value with await on non-coroutine
If the keyword `await` is used without a coroutine, it should still return the value synchronally.
Diffstat (limited to 'modules/gdscript/tests')
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/await_without_coroutine.gd8
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/await_without_coroutine.out6
2 files changed, 14 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/runtime/features/await_without_coroutine.gd b/modules/gdscript/tests/scripts/runtime/features/await_without_coroutine.gd
new file mode 100644
index 0000000000..9da61ab184
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/features/await_without_coroutine.gd
@@ -0,0 +1,8 @@
+# https://github.com/godotengine/godot/issues/50894
+
+func test():
+ print(await not_coroutine())
+
+
+func not_coroutine():
+ return "awaited"
diff --git a/modules/gdscript/tests/scripts/runtime/features/await_without_coroutine.out b/modules/gdscript/tests/scripts/runtime/features/await_without_coroutine.out
new file mode 100644
index 0000000000..c2ac488e9b
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/features/await_without_coroutine.out
@@ -0,0 +1,6 @@
+GDTEST_OK
+>> WARNING
+>> Line: 4
+>> REDUNDANT_AWAIT
+>> "await" keyword not needed in this case, because the expression isn't a coroutine nor a signal.
+awaited