Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

GDScript: Cover not validated native static calls in the test suite

HolonProduction1735972c72c3
diff --git a/modules/gdscript/tests/scripts/runtime/features/call_native_static_method.gd b/modules/gdscript/tests/scripts/runtime/features/call_native_static_method.gd
new file mode 100644
index 00000000000..2d67fb21a0b
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/features/call_native_static_method.gd
@@ -0,0 +1,18 @@
+func run(param):
+ # Validated native static call with return value.
+ print(FileAccess.file_exists("some_file"))
+
+ # Validated native static call without return value.
+ Node.print_orphan_nodes()
+
+ # Not validated native static call with return value.
+ @warning_ignore("unsafe_call_argument")
+ print(FileAccess.file_exists(param))
+
+ # Not validated native static call without return value.
+ FileDialog.set_favorite_list([param])
+ print(FileDialog.get_favorite_list())
+ FileDialog.set_favorite_list([])
+
+func test():
+ run("some_file")
diff --git a/modules/gdscript/tests/scripts/runtime/features/call_native_static_method.out b/modules/gdscript/tests/scripts/runtime/features/call_native_static_method.out
new file mode 100644
index 00000000000..f9854de2f36
--- /dev/null
+++ b/modules/gdscript/tests/scripts/runtime/features/call_native_static_method.out
@@ -0,0 +1,4 @@
+GDTEST_OK
+false
+false
+["some_file/"]
diff --git a/modules/gdscript/tests/scripts/runtime/features/call_native_static_method_validated.gd b/modules/gdscript/tests/scripts/runtime/features/call_native_static_method_validated.gd
deleted file mode 100644
index a1a9e350b06..00000000000
--- a/modules/gdscript/tests/scripts/runtime/features/call_native_static_method_validated.gd
+++ /dev/null
@@ -1,6 +0,0 @@
-func test():
- # Validated native static call with return value.
- print(FileAccess.file_exists("some_file"))
-
- # Validated native static call without return value.
- Node.print_orphan_nodes()
diff --git a/modules/gdscript/tests/scripts/runtime/features/call_native_static_method_validated.out b/modules/gdscript/tests/scripts/runtime/features/call_native_static_method_validated.out
deleted file mode 100644
index 44302c81378..00000000000
--- a/modules/gdscript/tests/scripts/runtime/features/call_native_static_method_validated.out
+++ /dev/null
@@ -1,2 +0,0 @@
-GDTEST_OK
-false