summaryrefslogtreecommitdiff
path: root/tests/typ
diff options
context:
space:
mode:
Diffstat (limited to 'tests/typ')
-rw-r--r--tests/typ/lang/bracket-call.typ86
-rw-r--r--tests/typ/lang/comments.typ2
2 files changed, 87 insertions, 1 deletions
diff --git a/tests/typ/lang/bracket-call.typ b/tests/typ/lang/bracket-call.typ
new file mode 100644
index 00000000..642d6426
--- /dev/null
+++ b/tests/typ/lang/bracket-call.typ
@@ -0,0 +1,86 @@
+// Basic call, whitespace insignificant.
+[f], [ f ], [
+ f
+]
+
+[f bold]
+
+[f 1,]
+
+[f a:2]
+
+[f 1, a: (3, 4), 2, b: "5"]
+
+---
+// Body and no body.
+[f][[f]]
+
+// Lots of potential bodies.
+[f][f][f]
+
+// Multi-paragraph body.
+[box][
+ First
+
+ Second
+]
+
+---
+// Chained.
+[f | f]
+
+// Multi-chain.
+[f|f|f]
+
+// With body.
+[f | box][💕]
+
+// Error: 1:2-1:2 expected function name
+[|f true]
+
+// Error: 1:6-1:6 expected function name
+[f 1|]
+
+// With actual functions.
+[box width: 1cm | image "res/rhino.png"]
+
+---
+// Error: 1:4-1:6 expected expression, found end of block comment
+[f */]
+
+// Error: 1:7-1:8 expected expression, found colon
+[f a:1:]
+
+// Error: 1:5-1:5 expected comma
+[f 1 2]
+
+// Error: 2:4-2:5 expected identifier
+// Error: 1:6-1:6 expected expression
+[f 1:]
+
+// Error: 1:4-1:5 expected identifier
+[f 1:2]
+
+// Error: 1:4-1:7 expected identifier
+[f (x):1]
+
+---
+// Error: 2:2-2:3 a value of type string is not callable
+#let x = "string";
+[x]
+
+// Error: 1:2-1:3 expected function name, found hex value
+[# 1]
+
+// Error: 4:1-4:1 expected function name
+// Error: 3:1-3:1 expected closing bracket
+[
+
+---
+// Error: 3:1-3:1 expected closing bracket
+[f][`a]`
+
+---
+// Error: 3:1-3:1 expected quote
+// Error: 2:1-2:1 expected closing bracket
+[f "]
diff --git a/tests/typ/lang/comments.typ b/tests/typ/lang/comments.typ
index 56906d0c..c5b04967 100644
--- a/tests/typ/lang/comments.typ
+++ b/tests/typ/lang/comments.typ
@@ -8,7 +8,7 @@ C/*
*/D
// Test in expressions.
-[dump /*1*/ a: "b" //
+[f /*1*/ a: "b" //
, 1]
// Error: 1:7-1:9 unexpected end of block comment