summaryrefslogtreecommitdiff
path: root/tests/lang/typ/array.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-01-31 22:43:11 +0100
committerLaurenz <laurmaedje@gmail.com>2021-01-31 22:43:11 +0100
commit6fcef9973be4253e5b377251dd9d1921f9738fc1 (patch)
treeb849a6a8707d207c5cec5a1dcbeb60e4bf52b73c /tests/lang/typ/array.typ
parente3139ed3ee8c96b89f7f10f4ed72b4893d724689 (diff)
Refresh tests 🔄
Diffstat (limited to 'tests/lang/typ/array.typ')
-rw-r--r--tests/lang/typ/array.typ44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/lang/typ/array.typ b/tests/lang/typ/array.typ
new file mode 100644
index 00000000..f80cc0cd
--- /dev/null
+++ b/tests/lang/typ/array.typ
@@ -0,0 +1,44 @@
+// Test arrays.
+
+---
+// Empty.
+{()}
+
+// Not an array, just a parenthesized expression.
+{(1)}
+
+// One item and trailing comma.
+{(-1,)}
+
+// No trailing comma.
+{(true, false)}
+
+// Multiple lines and items and trailing comma.
+{("one"
+ , 2
+ , #003
+ ,)}
+
+// Error: 3-3 expected closing paren
+{(}
+
+// Error: 2-3 expected expression, found closing paren
+{)}
+
+// Error: 2:4-2:4 expected comma
+// Error: 1:4-1:6 expected expression, found end of block comment
+{(1*/2)}
+
+// Error: 6-8 expected expression, found invalid token
+{(1, 1u 2)}
+
+// Error: 3-4 expected expression, found comma
+{(,1)}
+
+// Missing expression makes named pair incomplete, making this an empty array.
+// Error: 5-5 expected expression
+{(a:)}
+
+// Named pair after this is already identified as an array.
+// Error: 6-10 expected expression, found named pair
+{(1, b: 2)}