summaryrefslogtreecommitdiff
path: root/tests/typ/code/repr.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-05-18 00:36:11 +0200
committerLaurenz <laurmaedje@gmail.com>2021-05-18 00:36:11 +0200
commit8b58171d7ca036d71b32749286c251cc91bdd10e (patch)
tree4594ab5088edf8eec44f3bafe3fb8fecb13ac61b /tests/typ/code/repr.typ
parent8d67c0ca5eb3486dde97fd281bd4a51d535c600c (diff)
Reorganize test cases
Diffstat (limited to 'tests/typ/code/repr.typ')
-rw-r--r--tests/typ/code/repr.typ57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/typ/code/repr.typ b/tests/typ/code/repr.typ
new file mode 100644
index 00000000..f2404510
--- /dev/null
+++ b/tests/typ/code/repr.typ
@@ -0,0 +1,57 @@
+// Test representation of values in the document.
+
+---
+// Variables.
+
+#let name = "Typst"
+#let ke-bab = "Kebab!"
+#let α = "Alpha"
+
+{name} \
+{ke-bab} \
+{α}
+
+// Error: 2-3 unknown variable
+{_}
+
+---
+// Literal values.
+{none} (empty) \
+{true} \
+{false}
+
+---
+// Numerical values.
+{1} \
+{1.0e-4} \
+{3.15} \
+{1e-10} \
+{50.368%} \
+{0.0000012345pt} \
+{4.5cm} \
+{12e1pt} \
+{2.5rad} \
+{45deg} \
+// Not in monospace via repr.
+#repr(45deg)
+
+---
+// Colors.
+{#f7a20500}
+
+---
+// Strings and escaping.
+{"hi"} \
+{"a\n[]\"\u{1F680}string"}
+
+---
+// Templates.
+{[*{"H" + "i"} there*]}
+
+---
+// Functions
+#let f(x) = x
+
+{rect} \
+{f} \
+{() => none}