typst/tests/typ/text/whitespace.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

46 lines
940 B
Typst

// Test whitespace handling.
---
// Spacing around let.
A#let x = 1;B #test(x, 1) \
A #let x = 2;B #test(x, 2) \
A#let x = 3; B #test(x, 3)
---
// Spacing around if-else.
A#if true [B]C \
A#if true [B] C \
A #if true{"B"}C \
A #if true{"B"} C \
A#if false [] #else [B]C \
A#if true [B] #else [] C
---
// Spacing around while loop.
#let c = true; A#while c [{c = false}B]C \
#let c = true; A#while c [{c = false}B] C \
#let c = true; A #while c { c = false; "B" }C \
#let c = true; A #while c { c = false; "B" } C
---
// Spacing around for loop.
A#for _ in (none,) [B]C \
A#for _ in (none,) [B] C \
A #for _ in (none,) {"B"}C
---
// Test that a run consisting only of whitespace isn't trimmed.
A#font("PT Sans")[ ]B
---
// Test font change after space.
Left #font("PT Sans")[Right].
---
// Test that space at start of line is not trimmed.
A{"\n"} B
---
// Test that trailing space does not force a line break.
LLLLLLLLLLLLLL R _L_