typst/tests/typ/compiler/field.typ
2023-01-20 14:05:35 +01:00

42 lines
619 B
Typst

// 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 list: node => {
test(node.items.len(), 3)
}
- A
- B
- C
---
// Error: 6-13 dictionary does not contain key "invalid"
{(:).invalid}
---
// Error: 2-7 expected dictionary or content, found boolean
{false.ok}
---
// Error: 29-32 unknown field `fun`
#show heading: node => node.fun
= A
---
// Error: 8 expected identifier
// Error: 8 expected semicolon or line break
{false.true}