summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests/scripts/analyzer
diff options
context:
space:
mode:
authorAdam Scott <ascott.ca@gmail.com>2022-12-17 16:19:18 -0500
committerAdam Scott <ascott.ca@gmail.com>2022-12-17 17:59:38 -0500
commit7fc814f69783ee5d3bde040bdbb057730e50bc30 (patch)
tree36b80456726d92f6c5e1b1e173574bfc9200ddee /modules/gdscript/tests/scripts/analyzer
parent10bc1d8710e8d6a3f58f2c4f5cc09604ef3ec51f (diff)
Fix external enums not assignable as constants
- Add external enums test - Rename external inner class test - Clean up `GDScriptAnalyzer::reduce_identifier_from_base` class behavior
Diffstat (limited to 'modules/gdscript/tests/scripts/analyzer')
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/external_enum_as_constant.gd6
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/external_enum_as_constant.out3
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/external_enum_as_constant_external.notest.gd4
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/external_inner_class_as_constant.gd (renamed from modules/gdscript/tests/scripts/analyzer/features/inner_class_constant_assignment.gd)2
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/external_inner_class_as_constant.out (renamed from modules/gdscript/tests/scripts/analyzer/features/inner_class_constant_assignment.out)0
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/external_inner_class_as_constant_external.notest.gd (renamed from modules/gdscript/tests/scripts/analyzer/features/inner_class_constant_assignment_external.notest.gd)0
6 files changed, 14 insertions, 1 deletions
diff --git a/modules/gdscript/tests/scripts/analyzer/features/external_enum_as_constant.gd b/modules/gdscript/tests/scripts/analyzer/features/external_enum_as_constant.gd
new file mode 100644
index 0000000000..757744b6f1
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/external_enum_as_constant.gd
@@ -0,0 +1,6 @@
+const External = preload("external_enum_as_constant_external.notest.gd")
+const MyEnum = External.MyEnum
+
+func test():
+ print(MyEnum.WAITING == 0)
+ print(MyEnum.GODOT == 1)
diff --git a/modules/gdscript/tests/scripts/analyzer/features/external_enum_as_constant.out b/modules/gdscript/tests/scripts/analyzer/features/external_enum_as_constant.out
new file mode 100644
index 0000000000..9d111a8322
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/external_enum_as_constant.out
@@ -0,0 +1,3 @@
+GDTEST_OK
+true
+true
diff --git a/modules/gdscript/tests/scripts/analyzer/features/external_enum_as_constant_external.notest.gd b/modules/gdscript/tests/scripts/analyzer/features/external_enum_as_constant_external.notest.gd
new file mode 100644
index 0000000000..7c090844d0
--- /dev/null
+++ b/modules/gdscript/tests/scripts/analyzer/features/external_enum_as_constant_external.notest.gd
@@ -0,0 +1,4 @@
+enum MyEnum {
+ WAITING,
+ GODOT
+}
diff --git a/modules/gdscript/tests/scripts/analyzer/features/inner_class_constant_assignment.gd b/modules/gdscript/tests/scripts/analyzer/features/external_inner_class_as_constant.gd
index ed5fb18b73..18dca109fb 100644
--- a/modules/gdscript/tests/scripts/analyzer/features/inner_class_constant_assignment.gd
+++ b/modules/gdscript/tests/scripts/analyzer/features/external_inner_class_as_constant.gd
@@ -1,4 +1,4 @@
-const External = preload("inner_class_constant_assignment_external.notest.gd")
+const External = preload("external_inner_class_as_constant_external.notest.gd")
const ExternalInnerClass = External.InnerClass
func test():
diff --git a/modules/gdscript/tests/scripts/analyzer/features/inner_class_constant_assignment.out b/modules/gdscript/tests/scripts/analyzer/features/external_inner_class_as_constant.out
index 15666c46ad..15666c46ad 100644
--- a/modules/gdscript/tests/scripts/analyzer/features/inner_class_constant_assignment.out
+++ b/modules/gdscript/tests/scripts/analyzer/features/external_inner_class_as_constant.out
diff --git a/modules/gdscript/tests/scripts/analyzer/features/inner_class_constant_assignment_external.notest.gd b/modules/gdscript/tests/scripts/analyzer/features/external_inner_class_as_constant_external.notest.gd
index 788c99d469..788c99d469 100644
--- a/modules/gdscript/tests/scripts/analyzer/features/inner_class_constant_assignment_external.notest.gd
+++ b/modules/gdscript/tests/scripts/analyzer/features/external_inner_class_as_constant_external.notest.gd