diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-05-09 00:03:57 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-05-09 00:03:57 +0200 |
| commit | 1927cc86dae1df300b3472c52f1777baf637dc6f (patch) | |
| tree | fb156dd4c1a73d2f6880d10e53dd4f1b911fbd95 /tests/typ/code/break-continue.typ | |
| parent | bfaf5447a789cd0dbbb1e418bea62fef9edc2b7d (diff) | |
Set, show, wrap in code blocks
Diffstat (limited to 'tests/typ/code/break-continue.typ')
| -rw-r--r-- | tests/typ/code/break-continue.typ | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/tests/typ/code/break-continue.typ b/tests/typ/code/break-continue.typ index 60dac44d..02c221a4 100644 --- a/tests/typ/code/break-continue.typ +++ b/tests/typ/code/break-continue.typ @@ -66,13 +66,28 @@ --- // Test break outside of loop. - #let f() = { // Error: 3-8 cannot break outside of loop break } -#f() +#for i in range(1) { + f() +} + +--- +// Test break in function call. +#let identity(x) = x +#let out = for i in range(5) { + "A" + identity({ + "B" + break + }) + "C" +} + +#test(out, "AB") --- // Test continue outside of loop. @@ -81,5 +96,41 @@ #let x = { continue } --- -// Error: 1-10 unexpected keyword `continue` +// Error: 1-10 cannot continue outside of loop #continue + +--- +// Ref: true +// Should output `Hello World 🌎`. +#for _ in range(10) { + [Hello ] + [World { + [🌎] + break + }] +} + +--- +// Ref: true +// Should output `Some` in red, `Some` in blue and `Last` in green. +// Everything should be in smallcaps. +#for color in (red, blue, green, yellow) [ + #set text("Roboto") + #wrap body in text(fill: color, body) + #smallcaps(if color != green [ + Some + ] else [ + Last + #break + ]) +] + +--- +// Ref: true +// Test break in set rule. +// Should output `Hi` in blue. +#for i in range(10) { + [Hello] + set text(blue, ..break) + [Not happening] +} |
