summaryrefslogtreecommitdiff
path: root/tests/typ
diff options
context:
space:
mode:
Diffstat (limited to 'tests/typ')
-rw-r--r--tests/typ/lang/blocks.typ21
-rw-r--r--tests/typ/lang/bracket-call.typ15
-rw-r--r--tests/typ/lang/expressions.typ37
-rw-r--r--tests/typ/lang/raw.typ23
4 files changed, 96 insertions, 0 deletions
diff --git a/tests/typ/lang/blocks.typ b/tests/typ/lang/blocks.typ
new file mode 100644
index 00000000..cadd30dd
--- /dev/null
+++ b/tests/typ/lang/blocks.typ
@@ -0,0 +1,21 @@
+{1}
+
+// Function calls.
+{f(1)}
+{[[f 1]]}
+
+// Error: 1:2-1:2 expected expression
+{}
+
+// Error: 1:2-1:4 expected expression, found invalid token
+{1u}
+
+// Error: 1:5-1:5 expected closing brace
+{({1) + 2}
+
+// Error: 1:12-1:12 expected closing bracket
+{[*] + [ok*}
+
+// Error: 2:4-2:5 unexpected hex value
+// Error: 1:5-1:6 unexpected opening brace
+{1 #{} _end_
diff --git a/tests/typ/lang/bracket-call.typ b/tests/typ/lang/bracket-call.typ
index 642d6426..79667e61 100644
--- a/tests/typ/lang/bracket-call.typ
+++ b/tests/typ/lang/bracket-call.typ
@@ -41,6 +41,10 @@
// Error: 1:6-1:6 expected function name
[f 1|]
+// Error: 2:5-2:5 expected closing paren
+// Error: 1:8-1:9 expected expression, found closing paren
+[f (|f )]
+
// With actual functions.
[box width: 1cm | image "res/rhino.png"]
@@ -65,6 +69,7 @@
[f (x):1]
---
+// Ref: false
// Error: 2:2-2:3 a value of type string is not callable
#let x = "string";
[x]
@@ -77,6 +82,16 @@
[
---
+// Ref: false
+// Error: 2:2-2:3 expected function name, found closing paren
+// Error: 3:1-3:1 expected closing bracket
+[)
+
+---
+// Error: 3:1-3:1 expected closing bracket
+[f [*]
+
+---
// Error: 3:1-3:1 expected closing bracket
[f][`a]`
diff --git a/tests/typ/lang/expressions.typ b/tests/typ/lang/expressions.typ
new file mode 100644
index 00000000..01725289
--- /dev/null
+++ b/tests/typ/lang/expressions.typ
@@ -0,0 +1,37 @@
+#let a = 2;
+#let b = 4;
+
+// Unary operations.
+{+1}
+{-1}
+{--1}
+
+// Binary operations.
+{"a"+"b"}
+{1-2}
+{a * b}
+{12pt/.4}
+
+// Associativity.
+{1+2+3}
+{1/2*3}
+
+// Precedence.
+{1+2*-3}
+
+// Parentheses.
+{(a)}
+{(2)}
+{(1+2)*3}
+
+// Confusion with floating-point literal.
+{1e+2-1e-2}
+
+// Error: 1:3-1:3 expected expression
+{-}
+
+// Error: 1:4-1:4 expected expression
+{1+}
+
+// Error: 1:4-1:4 expected expression
+{2*}
diff --git a/tests/typ/lang/raw.typ b/tests/typ/lang/raw.typ
new file mode 100644
index 00000000..22eda139
--- /dev/null
+++ b/tests/typ/lang/raw.typ
@@ -0,0 +1,23 @@
+The keyword ``rust let``.
+
+`#let x = 1`
+`[f 1]`
+
+---
+[font 6pt]
+
+``py
+import this
+
+def say_hi():
+ print("Hello World!")
+``
+
+---
+````
+```backticks```
+````
+
+---
+// Error: 2:1-2:1 expected backtick(s)
+`endless