summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/tests
diff options
context:
space:
mode:
authorDanil Alexeev <danil@alexeev.xyz>2023-09-22 10:10:22 +0300
committerDanil Alexeev <danil@alexeev.xyz>2023-09-22 17:30:00 +0300
commit10b00bc2eaa5d6e49ed68eb5eb832abfdeff5f1a (patch)
tree2bb1dd0056fe26cfff5bb32cc9a620ebb75be22e /modules/gdscript/tests
parentfe5b1c8d49313d63fbe91cb7cdf463e10fb86afa (diff)
downloadredot-engine-10b00bc2eaa5d6e49ed68eb5eb832abfdeff5f1a.tar.gz
GDScript: Prevent constructing and inheriting engine singletons
Diffstat (limited to 'modules/gdscript/tests')
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/engine_singleton_instantiate.gd2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/engine_singleton_instantiate.out2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/extend_engine_singleton.gd6
-rw-r--r--modules/gdscript/tests/scripts/analyzer/errors/extend_engine_singleton.out2
4 files changed, 12 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/engine_singleton_instantiate.gd b/modules/gdscript/tests/scripts/analyzer/errors/engine_singleton_instantiate.gd
new file mode 100644
index 0000000000..7e1efb8d1b
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/engine_singleton_instantiate.gd
@@ -0,0 +1,2 @@
+func test():
+ Time.new()
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/engine_singleton_instantiate.out b/modules/gdscript/tests/scripts/analyzer/errors/engine_singleton_instantiate.out
new file mode 100644
index 0000000000..bc4875d908
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/engine_singleton_instantiate.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Cannot construct native class "Time" because it is an engine singleton.
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/extend_engine_singleton.gd b/modules/gdscript/tests/scripts/analyzer/errors/extend_engine_singleton.gd
new file mode 100644
index 0000000000..a46b6d8658
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/extend_engine_singleton.gd
@@ -0,0 +1,6 @@
+# GH-82081
+
+extends Time
+
+func test():
+ pass
diff --git a/modules/gdscript/tests/scripts/analyzer/errors/extend_engine_singleton.out b/modules/gdscript/tests/scripts/analyzer/errors/extend_engine_singleton.out
new file mode 100644
index 0000000000..7c26dea56e
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/errors/extend_engine_singleton.out
@@ -0,0 +1,2 @@
+GDTEST_ANALYZER_ERROR
+Cannot inherit native class "Time" because it is an engine singleton.