summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/arrays.pngbin0 -> 3945 bytes
-rw-r--r--tests/ref/dictionaries.pngbin0 -> 2183 bytes
-rw-r--r--tests/typ/arrays.typ37
-rw-r--r--tests/typ/dictionaries.typ18
4 files changed, 55 insertions, 0 deletions
diff --git a/tests/ref/arrays.png b/tests/ref/arrays.png
new file mode 100644
index 00000000..4a95278c
--- /dev/null
+++ b/tests/ref/arrays.png
Binary files differ
diff --git a/tests/ref/dictionaries.png b/tests/ref/dictionaries.png
new file mode 100644
index 00000000..a34b45e0
--- /dev/null
+++ b/tests/ref/dictionaries.png
Binary files differ
diff --git a/tests/typ/arrays.typ b/tests/typ/arrays.typ
new file mode 100644
index 00000000..adab2ad9
--- /dev/null
+++ b/tests/typ/arrays.typ
@@ -0,0 +1,37 @@
+// Empty.
+{()}
+
+// One item and trailing comma.
+{(-1,)}
+
+// No trailing comma.
+{(true, false)}
+
+// Multiple lines and items and trailing comma.
+{("one"
+ , 2
+ , #003
+ ,)}
+
+---
+// Test errors.
+//
+// error: 2:3-2:3 expected closing paren
+// error: 4:4-4:6 expected expression, found end of block comment
+// error: 4:4-4:4 expected comma
+// error: 6:6-6:8 expected expression, found invalid token
+// error: 8:3-8:4 expected expression, found comma
+// error: 10:5-10:5 expected expression
+// error: 12:6-12:10 expected expression, found named pair
+
+{(}
+
+{(1*/2)}
+
+{(1, 1u 2)}
+
+{(,1)}
+
+{(a:)}
+
+{(1, b: 2)}
diff --git a/tests/typ/dictionaries.typ b/tests/typ/dictionaries.typ
new file mode 100644
index 00000000..51e3eb3c
--- /dev/null
+++ b/tests/typ/dictionaries.typ
@@ -0,0 +1,18 @@
+// Empty
+{(:)}
+
+// Two pairs.
+{(one: 1, two: 2)}
+
+---
+// Test errors.
+//
+// error: 2:9-2:10 expected named pair, found expression
+// error: 4:4-4:5 expected named pair, found expression
+// error: 4:5-4:5 expected comma
+// error: 4:12-4:16 expected identifier
+// error: 4:17-4:18 expected expression, found colon
+
+{(a: 1, b)}
+
+{(:1 b:[], true::)}