diff options
| author | Mel <mel@rnrd.eu> | 2025-07-22 19:29:21 +0200 |
|---|---|---|
| committer | Mel <mel@rnrd.eu> | 2025-07-23 03:56:24 +0200 |
| commit | b0acce3b858715a04fba154a23c6ea5fac083a74 (patch) | |
| tree | ba0695ef0b8ecad3993f49f803ac7060622ef2a0 /boot/tests/parse/loops.cskt | |
| parent | 52a6c142d7c85520b09e300283154b7ec9c6b9f3 (diff) | |
| download | catskill-b0acce3b858715a04fba154a23c6ea5fac083a74.tar.zst catskill-b0acce3b858715a04fba154a23c6ea5fac083a74.zip | |
Add option to test suite to auto-adjust expected output in definition
Signed-off-by: Mel <mel@rnrd.eu>
Diffstat (limited to 'boot/tests/parse/loops.cskt')
| -rw-r--r-- | boot/tests/parse/loops.cskt | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/boot/tests/parse/loops.cskt b/boot/tests/parse/loops.cskt new file mode 100644 index 0000000..45b1040 --- /dev/null +++ b/boot/tests/parse/loops.cskt @@ -0,0 +1,31 @@ +looping structures! + +<<< + +for i uint = 0..10 { + print(i) +} + +for x uint = 0, x < 10, x++ { + print(r) +} + +var y uint = 0 +while y < 10 { + print(y) + y++ +} + +>>> + +(loop for-each (declaration i (type name uint) (initializer (expr (binary .. (expr 0) (expr 10))))) (block + (expr (call (expr (name print)) (arg (expr (name i))))) +)) +(loop c-style (declaration x (type name uint) (initializer (expr 0))) (condition (expr (binary < (expr (name x)) (expr 10)))) (iteration (expr (increment/decrement ++ postfix (expr (name x))))) (block + (expr (call (expr (name print)) (arg (expr (name r))))) +)) +(variable (declaration y (type name uint) (initializer (expr 0)))) +(loop while (condition (expr (binary < (expr (name y)) (expr 10)))) (block + (expr (call (expr (name print)) (arg (expr (name y))))) + (expr (increment/decrement ++ postfix (expr (name y)))) +)) \ No newline at end of file |
