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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
// Test foundational functions.
// Ref: false
---
#test(type(1), "integer")
#test(type(ltr), "direction")
#test(type(10 / 3), "float")
---
#test(repr(ltr), "ltr")
#test(repr((1, 2, false, )), "(1, 2, false)")
---
// Test panic.
// Error: 7-9 panicked
#panic()
---
// Test panic.
// Error: 7-12 panicked with: 123
#panic(123)
---
// Test panic.
// Error: 7-24 panicked with: "this is wrong"
#panic("this is wrong")
---
// Test failing assertions.
// Error: 8-16 assertion failed
#assert(1 == 2)
---
// Test failing assertions.
// Error: 8-51 assertion failed: two is smaller than one
#assert(2 < 1, message: "two is smaller than one")
---
// Test failing assertions.
// Error: 9-15 expected boolean, found string
#assert("true")
---
// Test failing assertions.
// Error: 11-19 equality assertion failed: value 10 was not equal to 11
#assert.eq(10, 11)
---
// Test failing assertions.
// Error: 11-55 equality assertion failed: 10 and 12 are not equal
#assert.eq(10, 12, message: "10 and 12 are not equal")
---
// Test failing assertions.
// Error: 11-19 inequality assertion failed: value 11 was equal to 11
#assert.ne(11, 11)
---
// Test failing assertions.
// Error: 11-57 inequality assertion failed: must be different from 11
#assert.ne(11, 11, message: "must be different from 11")
---
// Test successful assertions.
#assert(5 > 3)
#assert.eq(15, 15)
#assert.ne(10, 12)
---
// Test the `type` function.
#test(type(1), "integer")
#test(type(ltr), "direction")
#test(type(10 / 3), "float")
---
#eval("[_Hello" + " World!_]")
---
// Error: 7-12 expected identifier
#eval("let")
---
#show raw: it => text(font: "PT Sans", eval("[" + it.text + "]"))
Interacting
```
#set text(blue)
Blue #move(dy: -0.15em)[🌊]
```
---
// Error: 7-17 cannot continue outside of loop
#eval("continue")
---
// Error: 7-32 cannot access file system from here
#eval("include \"../coma.typ\"")
---
// Error: 7-30 cannot access file system from here
#eval("image(\"/tiger.jpg\")")
---
// Error: 23-30 cannot access file system from here
#show raw: it => eval(it.text)
```
image("/tiger.jpg")
```
---
// Error: 23-42 cannot access file system from here
#show raw: it => eval("[" + it.text + "]")
```
#show emph: _ => image("/giraffe.jpg")
_No relative giraffe!_
```
---
// Error: 7-12 expected semicolon or line break
#eval("1 2")
|