From ad66fbdfa2d39e39c2a7d7411e27cb61ada2b648 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 14 Dec 2022 09:56:24 +0100 Subject: Detect infinite loops --- tests/typ/compiler/while.typ | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/typ/compiler/while.typ b/tests/typ/compiler/while.typ index 5dc5ae41..3c28a32a 100644 --- a/tests/typ/compiler/while.typ +++ b/tests/typ/compiler/while.typ @@ -34,11 +34,13 @@ #while [nope] [nope] --- -// Make sure that we terminate and don't complain multiple times. -#while true { - // Error: 3-7 unknown variable - nope -} +// Error: 8-25 condition is always true +#while 2 < "hello".len() {} + +--- +// Error: 2:1-2:24 loop seems to be infinite +#let i = 1 +#while i > 0 { i += 1 } --- // Error: 7 expected expression -- cgit v1.2.3