diff options
Diffstat (limited to 'modules/gdscript/tests/scripts/runtime/features')
5 files changed, 49 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/runtime/features/const_class_reference.gd b/modules/gdscript/tests/scripts/runtime/features/const_class_reference.gd new file mode 100644 index 0000000000..c7553769da --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/const_class_reference.gd @@ -0,0 +1,16 @@ +# https://github.com/godotengine/godot/issues/61636 + +const External := preload("const_class_reference_external.notest.gd") + +class Class1: + class Class2: + pass + +const Class1Alias = Class1 +const Class1Class2Alias = Class1.Class2 + +const ExternalAlias = External +const ExternalClassAlias = External.Class + +func test(): + pass diff --git a/modules/gdscript/tests/scripts/runtime/features/const_class_reference.out b/modules/gdscript/tests/scripts/runtime/features/const_class_reference.out new file mode 100644 index 0000000000..d73c5eb7cd --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/const_class_reference.out @@ -0,0 +1 @@ +GDTEST_OK diff --git a/modules/gdscript/tests/scripts/runtime/features/const_class_reference_external.notest.gd b/modules/gdscript/tests/scripts/runtime/features/const_class_reference_external.notest.gd new file mode 100644 index 0000000000..050e8a0960 --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/const_class_reference_external.notest.gd @@ -0,0 +1,2 @@ +class Class: + pass diff --git a/modules/gdscript/tests/scripts/runtime/features/typed_argument_is_null.gd b/modules/gdscript/tests/scripts/runtime/features/typed_argument_is_null.gd new file mode 100644 index 0000000000..277242156d --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/typed_argument_is_null.gd @@ -0,0 +1,27 @@ +# https://github.com/godotengine/godot/issues/72967 + +class CustomNode: + extends Node + + static func test_custom_node(n: CustomNode): + if not n: + print("null node") + +func test(): + test_typed_argument_is_null() + +func get_custom_node() -> CustomNode: + return null + +func test_typed_argument_is_null(): + var node: Node = Node.new() + print_node_name(node.get_parent()) + node.free() + test_custom_node() + +func test_custom_node(): + CustomNode.test_custom_node(get_custom_node()) + +func print_node_name(n: Node): + if not n: + print("null node") diff --git a/modules/gdscript/tests/scripts/runtime/features/typed_argument_is_null.out b/modules/gdscript/tests/scripts/runtime/features/typed_argument_is_null.out new file mode 100644 index 0000000000..41560003d6 --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/typed_argument_is_null.out @@ -0,0 +1,3 @@ +GDTEST_OK +null node +null node |