diff options
author | Dmitrii Maganov <vonagam@gmail.com> | 2022-12-27 05:06:11 +0200 |
---|---|---|
committer | Dmitrii Maganov <vonagam@gmail.com> | 2022-12-28 23:04:40 +0200 |
commit | b6aa4840d827f2679d5f21591cc41222a96385bf (patch) | |
tree | 7fb388a49fbc1a373ec3c733e919668a20732c78 /modules/gdscript/tests/scripts/analyzer | |
parent | 7e1bd3f95a10acf60e07a8a6518cc80bfee6fbbf (diff) |
Fix usage of Enum as constant
Diffstat (limited to 'modules/gdscript/tests/scripts/analyzer')
-rw-r--r-- | modules/gdscript/tests/scripts/analyzer/features/enum_as_const.gd | 29 | ||||
-rw-r--r-- | modules/gdscript/tests/scripts/analyzer/features/enum_as_const.out | 17 |
2 files changed, 46 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/analyzer/features/enum_as_const.gd b/modules/gdscript/tests/scripts/analyzer/features/enum_as_const.gd new file mode 100644 index 0000000000..2ce588373b --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/enum_as_const.gd @@ -0,0 +1,29 @@ +class Outer: + enum OuterEnum { OuterValue = 3 } + const OuterConst := OuterEnum + + class Inner: + enum InnerEnum { InnerValue = 7 } + const InnerConst := InnerEnum + + static func test() -> void: + print(OuterEnum.size()); + print(OuterEnum.OuterValue); + print(OuterConst.size()); + print(OuterConst.OuterValue); + print(Outer.OuterEnum.size()); + print(Outer.OuterEnum.OuterValue); + print(Outer.OuterConst.size()); + print(Outer.OuterConst.OuterValue); + + print(InnerEnum.size()); + print(InnerEnum.InnerValue); + print(InnerConst.size()); + print(InnerConst.InnerValue); + print(Inner.InnerEnum.size()); + print(Inner.InnerEnum.InnerValue); + print(Inner.InnerConst.size()); + print(Inner.InnerConst.InnerValue); + +func test(): + Outer.Inner.test() diff --git a/modules/gdscript/tests/scripts/analyzer/features/enum_as_const.out b/modules/gdscript/tests/scripts/analyzer/features/enum_as_const.out new file mode 100644 index 0000000000..e049f85b6e --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/enum_as_const.out @@ -0,0 +1,17 @@ +GDTEST_OK +1 +3 +1 +3 +1 +3 +1 +3 +1 +7 +1 +7 +1 +7 +1 +7 |