summaryrefslogtreecommitdiff
path: root/tests/typ/code/repr.typ
blob: 35a47e497cc900d7f4d6a68f35d3360921bddbff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Test representation of values in the document.

---
// Variables.
#let name = "Typst"
#let ke-bab = "Kebab!"
#let α = "Alpha"

{name} \
{ke-bab} \
{α}

---
// 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}

---
// Colors.
#rgb("f7a20500")

---
// Strings and escaping.
{"hi"} \
{"a\n[]\"\u{1F680}string"}

---
// Templates.
{[*{"H" + "i"} there*]}

---
// Functions
#let f(x) = x

{rect} \
{f} \
{() => none}

---
// Test using the `repr` function.

// Returns a string.
#test(repr((1, 2, false, )), "(1, 2, false)")

// Not in monospace
#repr(23deg)