mirror of
https://github.com/typst/typst
synced 2025-05-13 12:36:23 +08:00
24 lines
418 B
XML
24 lines
418 B
XML
// Test the `assert` function.
|
|
// Ref: false
|
|
|
|
---
|
|
#assert(1 + 1 == 2)
|
|
#assert(range(2, 5) == (2, 3, 4))
|
|
#assert(not false)
|
|
|
|
---
|
|
// Test failing assertions.
|
|
// Error: 9-15 assertion failed
|
|
#assert(1 == 2)
|
|
|
|
---
|
|
// Test failing assertions.
|
|
// Error: 9-15 expected boolean, found string
|
|
#assert("true")
|
|
|
|
---
|
|
// Test the `type` function.
|
|
#test(type(1), "integer")
|
|
#test(type(ltr), "direction")
|
|
#test(type(10 / 3), "float")
|