From abe6d6723219b592829fd9ba2a2c78950c83d64e Mon Sep 17 00:00:00 2001 From: Dmitrii Maganov Date: Sun, 22 Jan 2023 11:07:48 +0200 Subject: GDScript: Fix test for read-only state of constants --- .../tests/scripts/runtime/features/constants_are_read_only.gd | 10 ++++++++++ .../tests/scripts/runtime/features/constants_are_read_only.out | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 modules/gdscript/tests/scripts/runtime/features/constants_are_read_only.gd create mode 100644 modules/gdscript/tests/scripts/runtime/features/constants_are_read_only.out (limited to 'modules/gdscript/tests/scripts/runtime/features') diff --git a/modules/gdscript/tests/scripts/runtime/features/constants_are_read_only.gd b/modules/gdscript/tests/scripts/runtime/features/constants_are_read_only.gd new file mode 100644 index 0000000000..d1746979be --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/constants_are_read_only.gd @@ -0,0 +1,10 @@ +const array: Array = [0] +const dictionary := {1: 2} + +@warning_ignore("assert_always_true") +func test(): + assert(array.is_read_only() == true) + assert(str(array) == '[0]') + assert(dictionary.is_read_only() == true) + assert(str(dictionary) == '{ 1: 2 }') + print('ok') diff --git a/modules/gdscript/tests/scripts/runtime/features/constants_are_read_only.out b/modules/gdscript/tests/scripts/runtime/features/constants_are_read_only.out new file mode 100644 index 0000000000..1b47ed10dc --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/constants_are_read_only.out @@ -0,0 +1,2 @@ +GDTEST_OK +ok -- cgit v1.2.3