diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-09-10 17:07:56 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-09-11 18:00:15 +0200 |
commit | 5672d44892c4010cdfbdc46f5fb29259fa51e076 (patch) | |
tree | 3afc2ee6dac2d17746014f7f73a704d793336bc1 /tests/test | |
parent | Add documentation and tests for xdg basedir. (diff) | |
download | calp-5672d44892c4010cdfbdc46f5fb29259fa51e076.tar.gz calp-5672d44892c4010cdfbdc46f5fb29259fa51e076.tar.xz |
Add `break` and `continue` support in `for`.
Diffstat (limited to '')
-rw-r--r-- | tests/test/util.scm | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/tests/test/util.scm b/tests/test/util.scm index 719afbed..b25c9add 100644 --- a/tests/test/util.scm +++ b/tests/test/util.scm @@ -39,15 +39,30 @@ (awhen (memv 0 '(1 2 3 4 5)) (cdr it))) -(test-equal "for simple" - (iota 10) - (for x in (iota 10) - x)) - -(test-equal "for matching" - (iota 12) - (for (x c) in (zip (iota 12) (string->list "Hello, World")) - x)) +(test-group "for" + (test-equal "for simple" + (iota 10) + (for x in (iota 10) + x)) + + (test-equal "for matching" + (iota 12) + (for (x c) in (zip (iota 12) (string->list "Hello, World")) + x)) + + (test-equal "for break" + 'x + (for x in (iota 10) + (break 'x) + (test-assert "This should never happen" #f))) + + (test-equal "for continue" + '(x #f 2) + (for x in (iota 3) + (case x + ((0) (continue 'x)) + ((1) (continue)) + (else x))))) (test-equal "procedure label" 120 |