typst/tests/typ/code/array.typ
Laurenz 1ee1d078e2 Fatal errors
- Makes errors fatal, so that a phase is only reached when all previous phases were error-free
- Parsing still recovers and can produce multiple errors
- Evaluation fails fast and can thus produce only a single error (except for parse errors due to an import)
- The single error that could occur during execution is removed for now
- Removes Value::Error variant
2021-07-30 18:49:19 +02:00

45 lines
826 B
XML

// Test arrays.
---
// Empty.
{()}
// Not an array, just a parenthesized expression.
{(1)}
// One item and trailing comma.
{(-1,)}
// No trailing comma.
{(true, false)}
// Multiple lines and items and trailing comma.
{("1"
, rgb("002")
,)}
---
// Error: 3 expected closing paren
{(}
// Error: 2-3 expected expression, found closing paren
{)}
// Error: 4 expected comma
// Error: 4-6 expected expression, found end of block comment
{(1*/2)}
// Error: 6-8 expected expression, found invalid token
{(1, 1u 2)}
// Error: 3-4 expected expression, found comma
{(,1)}
// Missing expression makes named pair incomplete, making this an empty array.
// Error: 5 expected expression
{(a:)}
// Named pair after this is already identified as an array.
// Error: 6-10 expected expression, found named pair
{(1, b: 2)}