summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests/scripts/parser/features/array.gd
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2021-04-19 20:50:52 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2021-09-14 18:42:08 +0200
commitc0083c0f90238f0eec01604dd9c952c8c5dc3c22 (patch)
treee7efc33ba4a25d8195f8089bf08be19311722da6 /modules/gdscript/tests/scripts/parser/features/array.gd
parenta9b600bac0a9a8fdd3b217c6d3cb6639ae80c1f8 (diff)
Add dozens of new integration tests to the GDScript test suite
This also ignores `.out` files in the file format static checks.
Diffstat (limited to 'modules/gdscript/tests/scripts/parser/features/array.gd')
-rw-r--r--modules/gdscript/tests/scripts/parser/features/array.gd16
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/parser/features/array.gd b/modules/gdscript/tests/scripts/parser/features/array.gd
new file mode 100644
index 0000000000..828ce8d134
--- /dev/null
+++ b/modules/gdscript/tests/scripts/parser/features/array.gd
@@ -0,0 +1,16 @@
+func test():
+ # Indexing from the beginning:
+ print([1, 2, 3][0])
+ print([1, 2, 3][1])
+ print([1, 2, 3][2])
+
+ # Indexing from the end:
+ print([1, 2, 3][-1])
+ print([1, 2, 3][-2])
+ print([1, 2, 3][-3])
+
+ # Float indices are currently allowed, but should probably be an error?
+ print([1, 2, 3][0.4])
+ print([1, 2, 3][0.8])
+ print([1, 2, 3][1.0])
+ print([1, 2, 3][-1.0])