summaryrefslogtreecommitdiff
path: root/tests/typ/compiler/break-continue.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-04-13 10:39:45 +0200
committerGitHub <noreply@github.com>2024-04-13 08:39:45 +0000
commit020294fca9a7065d4b9cf4e677f606ebaaa29b00 (patch)
treec0027ad22046e2726c22298461327823d6b88d53 /tests/typ/compiler/break-continue.typ
parent72dd79210602ecc799726fc096b078afbb47f299 (diff)
Better test runner (#3922)
Diffstat (limited to 'tests/typ/compiler/break-continue.typ')
-rw-r--r--tests/typ/compiler/break-continue.typ162
1 files changed, 0 insertions, 162 deletions
diff --git a/tests/typ/compiler/break-continue.typ b/tests/typ/compiler/break-continue.typ
deleted file mode 100644
index 4c4738bb..00000000
--- a/tests/typ/compiler/break-continue.typ
+++ /dev/null
@@ -1,162 +0,0 @@
-// Test break and continue in loops.
-// Ref: false
-
----
-// Test break.
-
-#let var = 0
-#let error = false
-
-#for i in range(10) {
- var += i
- if i > 5 {
- break
- error = true
- }
-}
-
-#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 i = 0
-#let x = 0
-
-#while x < 8 {
- i += 1
- if calc.rem(i, 3) == 0 {
- continue
- }
- x += i
-}
-
-// If continue did not work, this would equal 10.
-#test(x, 12)
-
----
-// Test joining with continue.
-
-#let x = for i in range(5) {
- "a"
- if calc.rem(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
-}
-
-#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.
-
-// Error: 12-20 cannot continue outside of loop
-#let x = { continue }
-
----
-// Error: 2-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(font: "Roboto")
- #show: it => text(fill: color, it)
- #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]
-}
-
----
-// Test second block during break flow.
-// Ref: true
-
-#for i in range(10) {
- table(
- { [A]; break },
- for _ in range(3) [B]
- )
-}
-
----
-// Ref: true
-// Test continue while destructuring.
-// Should output "one = I \ two = II \ one = I".
-#for num in (1, 2, 3, 1) {
- let (word, roman) = if num == 1 {
- ("one", "I")
- } else if num == 2 {
- ("two", "II")
- } else {
- continue
- }
- [#word = #roman \ ]
-}