summaryrefslogtreecommitdiff
path: root/tests/typ/code/field.typ
blob: b63a8768ff7a0773cd53c8e35311a36bf7dbbb60 (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
// Test field access.
// Ref: false

---
// Test field on dictionary.
#let dict = (nothing: "ness", hello: "world")
#test(dict.nothing, "ness")
{
  let world = dict
    .hello

  test(world, "world")
}

---
// Test field on node.
#show node: list as {
  test(node.items.len(), 3)
}

- A
- B
- C

---
// Error: 6-13 dictionary does not contain key "invalid"
{(:).invalid}

---
// Error: 2-7 cannot access field on boolean
{false.ok}

---
// Error: 29-32 unknown field "fun"
#show node: heading as node.fun
= A

---
// Error: 8-12 expected identifier, found boolean
{false.true}