typst/tests/lang/typ/expressions.typ
Laurenz cc5f14193c Flip test directory structure 🔃
Move full/lang/library to the top-level as that's more ergonomic to use.
2021-01-16 15:39:25 +01:00

38 lines
404 B
Typst

#let a = 2;
#let b = 4;
// Unary operations.
{+1}
{-1}
{--1}
// Binary operations.
{"a"+"b"}
{1-2}
{a * b}
{12pt/.4}
// Associativity.
{1+2+3}
{1/2*3}
// Precedence.
{1+2*-3}
// Parentheses.
{(a)}
{(2)}
{(1+2)*3}
// Confusion with floating-point literal.
{1e+2-1e-2}
// Error: 1:3-1:3 expected expression
{-}
// Error: 1:4-1:4 expected expression
{1+}
// Error: 1:4-1:4 expected expression
{2*}