summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/tests
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdscript/tests')
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/reset_uninit_local_vars.gd21
-rw-r--r--modules/gdscript/tests/scripts/runtime/features/reset_uninit_local_vars.out4
2 files changed, 25 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/runtime/features/reset_uninit_local_vars.gd b/modules/gdscript/tests/scripts/runtime/features/reset_uninit_local_vars.gd
new file mode 100644
index 0000000000..b676ece24b
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/features/reset_uninit_local_vars.gd
@@ -0,0 +1,21 @@
+# GH-89958
+
+func test():
+ if true:
+ @warning_ignore("unused_variable")
+ var a = 1
+ @warning_ignore("unused_variable")
+ var b := 1
+ @warning_ignore("unused_variable")
+ var c := 1
+
+ if true:
+ @warning_ignore("unassigned_variable")
+ var a
+ print(a)
+ @warning_ignore("unassigned_variable")
+ var b
+ print(b)
+ @warning_ignore("unassigned_variable")
+ var c: Object
+ print(c)
diff --git a/modules/gdscript/tests/scripts/runtime/features/reset_uninit_local_vars.out b/modules/gdscript/tests/scripts/runtime/features/reset_uninit_local_vars.out
new file mode 100644
index 0000000000..279ea2d3b1
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/features/reset_uninit_local_vars.out
@@ -0,0 +1,4 @@
+GDTEST_OK
+<null>
+<null>
+<null>