diff options
| author | Martin Haug <mhaug@live.de> | 2022-02-28 14:36:02 +0100 |
|---|---|---|
| committer | Martin Haug <mhaug@live.de> | 2022-02-28 15:41:38 +0100 |
| commit | 4f09233bdae8f79ebafed43e8135f1a0285bd370 (patch) | |
| tree | ae79152aba0a7b863be3574dd16d5d12e1e311df /tests/typ/code/break-continue.typ | |
| parent | 9fde38a6f82106e4c3a47f1bc34343650d8aad5b (diff) | |
Enable join collection for control flow constructs
Diffstat (limited to 'tests/typ/code/break-continue.typ')
| -rw-r--r-- | tests/typ/code/break-continue.typ | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/tests/typ/code/break-continue.typ b/tests/typ/code/break-continue.typ index e54651f1..60dac44d 100644 --- a/tests/typ/code/break-continue.typ +++ b/tests/typ/code/break-continue.typ @@ -4,8 +4,8 @@ --- // Test break. -#let error = false #let var = 0 +#let error = false #for i in range(10) { var += i @@ -15,18 +15,32 @@ } } -#test(error, false) #test(var, 21) +#test(error, false) + +--- +// Test joining with break. + +#let i = 0 +#let x = while true { + i += 1 + str(i) + if i >= 5 { + "." + break + } +} + +#test(x, "12345.") --- // Test continue. -#let x = 0 #let i = 0 +#let x = 0 #while x < 8 { i += 1 - if mod(i, 3) == 0 { continue } @@ -37,12 +51,27 @@ #test(x, 12) --- +// Test joining with continue. + +#let x = for i in range(5) { + "a" + if mod(i, 3) == 0 { + "_" + continue + } + str(i) +} + +#test(x, "a_a1a2a_a4") + +--- // Test break outside of loop. #let f() = { // Error: 3-8 cannot break outside of loop break } + #f() --- |
