From 48e297c1443b38c9a3f2176a593d77d135cc1d87 Mon Sep 17 00:00:00 2001 From: HolonProduction Date: Sun, 2 Jun 2024 15:52:21 +0200 Subject: [PATCH] Add more autocompletion tests --- .../scripts/completion/common/identifiers.cfg | 21 +++++++++++++++++++ .../scripts/completion/common/identifiers.gd | 16 ++++++++++++++ .../tests/scripts/completion/common/self.cfg | 21 +++++++++++++++++++ .../tests/scripts/completion/common/self.gd | 16 ++++++++++++++ .../completion/filter/organized_export.cfg | 6 ++++++ .../completion/filter/organized_export.gd | 8 +++++++ .../completion/filter/usage_internal.cfg | 4 ++++ .../completion/filter/usage_internal.gd | 3 +++ .../completion/types/local/interfered.cfg | 12 +++++++++++ .../completion/types/local/interfered.gd | 8 +++++++ .../completion/types/local/no_type.cfg | 12 +++++++++++ .../scripts/completion/types/local/no_type.gd | 8 +++++++ .../completion/types/local/typehint.cfg | 12 +++++++++++ .../completion/types/local/typehint.gd | 8 +++++++ .../completion/types/local/typehint_broad.cfg | 12 +++++++++++ .../completion/types/local/typehint_broad.gd | 8 +++++++ .../types/local/typehint_incompatible.cfg | 12 +++++++++++ .../types/local/typehint_incompatible.gd | 8 +++++++ .../completion/types/member/interfered.cfg | 12 +++++++++++ .../completion/types/member/interfered.gd | 9 ++++++++ .../completion/types/member/no_type.cfg | 12 +++++++++++ .../completion/types/member/no_type.gd | 9 ++++++++ .../completion/types/member/typehint.cfg | 12 +++++++++++ .../completion/types/member/typehint.gd | 9 ++++++++ .../types/member/typehint_broad.cfg | 13 ++++++++++++ .../completion/types/member/typehint_broad.gd | 9 ++++++++ .../types/member/typehint_incompatible.cfg | 12 +++++++++++ .../types/member/typehint_incompatible.gd | 9 ++++++++ 28 files changed, 301 insertions(+) create mode 100644 modules/gdscript/tests/scripts/completion/common/identifiers.cfg create mode 100644 modules/gdscript/tests/scripts/completion/common/identifiers.gd create mode 100644 modules/gdscript/tests/scripts/completion/common/self.cfg create mode 100644 modules/gdscript/tests/scripts/completion/common/self.gd create mode 100644 modules/gdscript/tests/scripts/completion/filter/organized_export.cfg create mode 100644 modules/gdscript/tests/scripts/completion/filter/organized_export.gd create mode 100644 modules/gdscript/tests/scripts/completion/filter/usage_internal.cfg create mode 100644 modules/gdscript/tests/scripts/completion/filter/usage_internal.gd create mode 100644 modules/gdscript/tests/scripts/completion/types/local/interfered.cfg create mode 100644 modules/gdscript/tests/scripts/completion/types/local/interfered.gd create mode 100644 modules/gdscript/tests/scripts/completion/types/local/no_type.cfg create mode 100644 modules/gdscript/tests/scripts/completion/types/local/no_type.gd create mode 100644 modules/gdscript/tests/scripts/completion/types/local/typehint.cfg create mode 100644 modules/gdscript/tests/scripts/completion/types/local/typehint.gd create mode 100644 modules/gdscript/tests/scripts/completion/types/local/typehint_broad.cfg create mode 100644 modules/gdscript/tests/scripts/completion/types/local/typehint_broad.gd create mode 100644 modules/gdscript/tests/scripts/completion/types/local/typehint_incompatible.cfg create mode 100644 modules/gdscript/tests/scripts/completion/types/local/typehint_incompatible.gd create mode 100644 modules/gdscript/tests/scripts/completion/types/member/interfered.cfg create mode 100644 modules/gdscript/tests/scripts/completion/types/member/interfered.gd create mode 100644 modules/gdscript/tests/scripts/completion/types/member/no_type.cfg create mode 100644 modules/gdscript/tests/scripts/completion/types/member/no_type.gd create mode 100644 modules/gdscript/tests/scripts/completion/types/member/typehint.cfg create mode 100644 modules/gdscript/tests/scripts/completion/types/member/typehint.gd create mode 100644 modules/gdscript/tests/scripts/completion/types/member/typehint_broad.cfg create mode 100644 modules/gdscript/tests/scripts/completion/types/member/typehint_broad.gd create mode 100644 modules/gdscript/tests/scripts/completion/types/member/typehint_incompatible.cfg create mode 100644 modules/gdscript/tests/scripts/completion/types/member/typehint_incompatible.gd diff --git a/modules/gdscript/tests/scripts/completion/common/identifiers.cfg b/modules/gdscript/tests/scripts/completion/common/identifiers.cfg new file mode 100644 index 000000000000..871a404e3ad4 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/common/identifiers.cfg @@ -0,0 +1,21 @@ +scene="res://completion/get_node/get_node.tscn" +[output] +include=[ + ; Node + {"display": "add_child"}, + {"display": "owner"}, + {"display": "child_entered_tree"}, + + ; GDScript: class_a.notest.gd + {"display": "property_of_a"}, + {"display": "func_of_a"}, + {"display": "signal_of_a"}, + + ; GDScript: self.gd + {"display": "test_signal_1"}, + {"display": "test_signal_2"}, + {"display": "test_var_1"}, + {"display": "test_var_2"}, + {"display": "test_func_1"}, + {"display": "test_func_2"}, +] diff --git a/modules/gdscript/tests/scripts/completion/common/identifiers.gd b/modules/gdscript/tests/scripts/completion/common/identifiers.gd new file mode 100644 index 000000000000..efbafbee8e13 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/common/identifiers.gd @@ -0,0 +1,16 @@ +extends "res://completion/class_a.notest.gd" + +signal test_signal_1(a) +signal test_signal_2(a: int) + +var test_var_1 +var test_var_2: int + +func test_func_1(t): + pass + +func test_func_2(t: int) -> void: + pass + +func _init(): + t➡ diff --git a/modules/gdscript/tests/scripts/completion/common/self.cfg b/modules/gdscript/tests/scripts/completion/common/self.cfg new file mode 100644 index 000000000000..871a404e3ad4 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/common/self.cfg @@ -0,0 +1,21 @@ +scene="res://completion/get_node/get_node.tscn" +[output] +include=[ + ; Node + {"display": "add_child"}, + {"display": "owner"}, + {"display": "child_entered_tree"}, + + ; GDScript: class_a.notest.gd + {"display": "property_of_a"}, + {"display": "func_of_a"}, + {"display": "signal_of_a"}, + + ; GDScript: self.gd + {"display": "test_signal_1"}, + {"display": "test_signal_2"}, + {"display": "test_var_1"}, + {"display": "test_var_2"}, + {"display": "test_func_1"}, + {"display": "test_func_2"}, +] diff --git a/modules/gdscript/tests/scripts/completion/common/self.gd b/modules/gdscript/tests/scripts/completion/common/self.gd new file mode 100644 index 000000000000..9ad2fbea519b --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/common/self.gd @@ -0,0 +1,16 @@ +extends "res://completion/class_a.notest.gd" + +signal test_signal_1(a) +signal test_signal_2(a: int) + +var test_var_1 +var test_var_2: int + +func test_func_1(t): + pass + +func test_func_2(t: int) -> void: + pass + +func _init(): + self.➡ diff --git a/modules/gdscript/tests/scripts/completion/filter/organized_export.cfg b/modules/gdscript/tests/scripts/completion/filter/organized_export.cfg new file mode 100644 index 000000000000..961a9ea58d41 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/filter/organized_export.cfg @@ -0,0 +1,6 @@ +[output] +exclude=[ + {"display": "Test Category"}, + {"display": "Test Group"}, + {"display": "Test Subgroup"}, +] diff --git a/modules/gdscript/tests/scripts/completion/filter/organized_export.gd b/modules/gdscript/tests/scripts/completion/filter/organized_export.gd new file mode 100644 index 000000000000..189608904cfd --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/filter/organized_export.gd @@ -0,0 +1,8 @@ +extends CPUParticles2D + +@export_category("Test Category") +@export_group("Test Group") +@export_subgroup("Test Subgroup") + +func _init(): + ➡ diff --git a/modules/gdscript/tests/scripts/completion/filter/usage_internal.cfg b/modules/gdscript/tests/scripts/completion/filter/usage_internal.cfg new file mode 100644 index 000000000000..8c5bff5eac04 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/filter/usage_internal.cfg @@ -0,0 +1,4 @@ +[output] +exclude=[ + {"display": "messages"}, +] diff --git a/modules/gdscript/tests/scripts/completion/filter/usage_internal.gd b/modules/gdscript/tests/scripts/completion/filter/usage_internal.gd new file mode 100644 index 000000000000..484c1c0d101d --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/filter/usage_internal.gd @@ -0,0 +1,3 @@ +func test(): + var trans = Translation.new() + trans.➡ diff --git a/modules/gdscript/tests/scripts/completion/types/local/interfered.cfg b/modules/gdscript/tests/scripts/completion/types/local/interfered.cfg new file mode 100644 index 000000000000..8b68d51a8930 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/local/interfered.cfg @@ -0,0 +1,12 @@ +[output] +include=[ + ; Node + {"display": "add_child"}, + {"display": "owner"}, + {"display": "child_entered_tree"}, + + ; GDScript: class_a.notest.gd + {"display": "property_of_a"}, + {"display": "func_of_a"}, + {"display": "signal_of_a"}, +] diff --git a/modules/gdscript/tests/scripts/completion/types/local/interfered.gd b/modules/gdscript/tests/scripts/completion/types/local/interfered.gd new file mode 100644 index 000000000000..f003c366a486 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/local/interfered.gd @@ -0,0 +1,8 @@ +extends Node + +const A := preload("res://completion/class_a.notest.gd") + +func a(): + var test := A.new() + test.➡ + pass diff --git a/modules/gdscript/tests/scripts/completion/types/local/no_type.cfg b/modules/gdscript/tests/scripts/completion/types/local/no_type.cfg new file mode 100644 index 000000000000..8b68d51a8930 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/local/no_type.cfg @@ -0,0 +1,12 @@ +[output] +include=[ + ; Node + {"display": "add_child"}, + {"display": "owner"}, + {"display": "child_entered_tree"}, + + ; GDScript: class_a.notest.gd + {"display": "property_of_a"}, + {"display": "func_of_a"}, + {"display": "signal_of_a"}, +] diff --git a/modules/gdscript/tests/scripts/completion/types/local/no_type.gd b/modules/gdscript/tests/scripts/completion/types/local/no_type.gd new file mode 100644 index 000000000000..f6b5ae3aef17 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/local/no_type.gd @@ -0,0 +1,8 @@ +extends Node + +const A := preload("res://completion/class_a.notest.gd") + +func a(): + var test = A.new() + test.➡ + pass diff --git a/modules/gdscript/tests/scripts/completion/types/local/typehint.cfg b/modules/gdscript/tests/scripts/completion/types/local/typehint.cfg new file mode 100644 index 000000000000..8b68d51a8930 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/local/typehint.cfg @@ -0,0 +1,12 @@ +[output] +include=[ + ; Node + {"display": "add_child"}, + {"display": "owner"}, + {"display": "child_entered_tree"}, + + ; GDScript: class_a.notest.gd + {"display": "property_of_a"}, + {"display": "func_of_a"}, + {"display": "signal_of_a"}, +] diff --git a/modules/gdscript/tests/scripts/completion/types/local/typehint.gd b/modules/gdscript/tests/scripts/completion/types/local/typehint.gd new file mode 100644 index 000000000000..24bcfc04fca5 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/local/typehint.gd @@ -0,0 +1,8 @@ +extends Node + +const A := preload("res://completion/class_a.notest.gd") + +func a(): + var test: A + test.➡ + pass diff --git a/modules/gdscript/tests/scripts/completion/types/local/typehint_broad.cfg b/modules/gdscript/tests/scripts/completion/types/local/typehint_broad.cfg new file mode 100644 index 000000000000..8b68d51a8930 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/local/typehint_broad.cfg @@ -0,0 +1,12 @@ +[output] +include=[ + ; Node + {"display": "add_child"}, + {"display": "owner"}, + {"display": "child_entered_tree"}, + + ; GDScript: class_a.notest.gd + {"display": "property_of_a"}, + {"display": "func_of_a"}, + {"display": "signal_of_a"}, +] diff --git a/modules/gdscript/tests/scripts/completion/types/local/typehint_broad.gd b/modules/gdscript/tests/scripts/completion/types/local/typehint_broad.gd new file mode 100644 index 000000000000..88b4812c3096 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/local/typehint_broad.gd @@ -0,0 +1,8 @@ +extends Node + +const A := preload("res://completion/class_a.notest.gd") + +func a(): + var test: Node = A.new() + test.➡ + pass diff --git a/modules/gdscript/tests/scripts/completion/types/local/typehint_incompatible.cfg b/modules/gdscript/tests/scripts/completion/types/local/typehint_incompatible.cfg new file mode 100644 index 000000000000..8b68d51a8930 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/local/typehint_incompatible.cfg @@ -0,0 +1,12 @@ +[output] +include=[ + ; Node + {"display": "add_child"}, + {"display": "owner"}, + {"display": "child_entered_tree"}, + + ; GDScript: class_a.notest.gd + {"display": "property_of_a"}, + {"display": "func_of_a"}, + {"display": "signal_of_a"}, +] diff --git a/modules/gdscript/tests/scripts/completion/types/local/typehint_incompatible.gd b/modules/gdscript/tests/scripts/completion/types/local/typehint_incompatible.gd new file mode 100644 index 000000000000..8e226546f3a2 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/local/typehint_incompatible.gd @@ -0,0 +1,8 @@ +extends Node + +const A := preload("res://completion/class_a.notest.gd") + +func a(): + var test: A = Node.new() + test.➡ + pass diff --git a/modules/gdscript/tests/scripts/completion/types/member/interfered.cfg b/modules/gdscript/tests/scripts/completion/types/member/interfered.cfg new file mode 100644 index 000000000000..8b68d51a8930 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/member/interfered.cfg @@ -0,0 +1,12 @@ +[output] +include=[ + ; Node + {"display": "add_child"}, + {"display": "owner"}, + {"display": "child_entered_tree"}, + + ; GDScript: class_a.notest.gd + {"display": "property_of_a"}, + {"display": "func_of_a"}, + {"display": "signal_of_a"}, +] diff --git a/modules/gdscript/tests/scripts/completion/types/member/interfered.gd b/modules/gdscript/tests/scripts/completion/types/member/interfered.gd new file mode 100644 index 000000000000..069abd7891d9 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/member/interfered.gd @@ -0,0 +1,9 @@ +extends Node + +const A := preload("res://completion/class_a.notest.gd") + +var test := A.new() + +func a(): + test.➡ + pass diff --git a/modules/gdscript/tests/scripts/completion/types/member/no_type.cfg b/modules/gdscript/tests/scripts/completion/types/member/no_type.cfg new file mode 100644 index 000000000000..8b68d51a8930 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/member/no_type.cfg @@ -0,0 +1,12 @@ +[output] +include=[ + ; Node + {"display": "add_child"}, + {"display": "owner"}, + {"display": "child_entered_tree"}, + + ; GDScript: class_a.notest.gd + {"display": "property_of_a"}, + {"display": "func_of_a"}, + {"display": "signal_of_a"}, +] diff --git a/modules/gdscript/tests/scripts/completion/types/member/no_type.gd b/modules/gdscript/tests/scripts/completion/types/member/no_type.gd new file mode 100644 index 000000000000..9bb9549e970d --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/member/no_type.gd @@ -0,0 +1,9 @@ +extends Node + +const A := preload("res://completion/class_a.notest.gd") + +var test = A.new() + +func a(): + test.➡ + pass diff --git a/modules/gdscript/tests/scripts/completion/types/member/typehint.cfg b/modules/gdscript/tests/scripts/completion/types/member/typehint.cfg new file mode 100644 index 000000000000..8b68d51a8930 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/member/typehint.cfg @@ -0,0 +1,12 @@ +[output] +include=[ + ; Node + {"display": "add_child"}, + {"display": "owner"}, + {"display": "child_entered_tree"}, + + ; GDScript: class_a.notest.gd + {"display": "property_of_a"}, + {"display": "func_of_a"}, + {"display": "signal_of_a"}, +] diff --git a/modules/gdscript/tests/scripts/completion/types/member/typehint.gd b/modules/gdscript/tests/scripts/completion/types/member/typehint.gd new file mode 100644 index 000000000000..7763a2e89816 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/member/typehint.gd @@ -0,0 +1,9 @@ +extends Node + +const A := preload("res://completion/class_a.notest.gd") + +var test: A + +func a(): + test.➡ + pass diff --git a/modules/gdscript/tests/scripts/completion/types/member/typehint_broad.cfg b/modules/gdscript/tests/scripts/completion/types/member/typehint_broad.cfg new file mode 100644 index 000000000000..81401316ec8e --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/member/typehint_broad.cfg @@ -0,0 +1,13 @@ +[output] +include=[ + ; Node + {"display": "add_child"}, + {"display": "owner"}, + {"display": "child_entered_tree"}, +] +exclude=[ + ; GDScript: class_a.notest.gd + {"display": "property_of_a"}, + {"display": "func_of_a"}, + {"display": "signal_of_a"}, +] diff --git a/modules/gdscript/tests/scripts/completion/types/member/typehint_broad.gd b/modules/gdscript/tests/scripts/completion/types/member/typehint_broad.gd new file mode 100644 index 000000000000..a8506705a1b4 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/member/typehint_broad.gd @@ -0,0 +1,9 @@ +extends Node + +const A := preload("res://completion/class_a.notest.gd") + +var test: Node = A.new() + +func a(): + test.➡ + pass diff --git a/modules/gdscript/tests/scripts/completion/types/member/typehint_incompatible.cfg b/modules/gdscript/tests/scripts/completion/types/member/typehint_incompatible.cfg new file mode 100644 index 000000000000..8b68d51a8930 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/member/typehint_incompatible.cfg @@ -0,0 +1,12 @@ +[output] +include=[ + ; Node + {"display": "add_child"}, + {"display": "owner"}, + {"display": "child_entered_tree"}, + + ; GDScript: class_a.notest.gd + {"display": "property_of_a"}, + {"display": "func_of_a"}, + {"display": "signal_of_a"}, +] diff --git a/modules/gdscript/tests/scripts/completion/types/member/typehint_incompatible.gd b/modules/gdscript/tests/scripts/completion/types/member/typehint_incompatible.gd new file mode 100644 index 000000000000..8b5a80cfb392 --- /dev/null +++ b/modules/gdscript/tests/scripts/completion/types/member/typehint_incompatible.gd @@ -0,0 +1,9 @@ +extends Node + +const A := preload("res://completion/class_a.notest.gd") + +var test: A = Node.new() + +func a(): + test.➡ + pass