From a262c111f44a04e10c661a0aedea47cac753454b Mon Sep 17 00:00:00 2001 From: Jakub Jankiewicz Date: Tue, 9 Jan 2024 00:42:10 +0100 Subject: [PATCH] add unit test for call/cc --- tests/continuations.scm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/continuations.scm b/tests/continuations.scm index 5e93b5a02..d8bd709d0 100644 --- a/tests/continuations.scm +++ b/tests/continuations.scm @@ -9,6 +9,25 @@ (t.is (x 4) 6))) +(test.failing "continuations: make-range" + (lambda (t) + (define (make-range from to) + (call/cc + (lambda (return) + (let ((result '())) + (let ((loop (call/cc (lambda (k) k)))) + (set! result (cons (call/cc + (lambda (append) + (if (< from to) + (append from) + (return (reverse result))))) + result)) + (set! from (+ from 1)) + (loop loop)))))) + + (t.is (make-range 0 10) '(0 1 2 3 4 5 6 7 8 9)) + (t.is (make-range 10 20) '(10 11 12 13 14 15 16 17 18 19)))) + (test.failing "continuations: return" (lambda (t) (let ((called #f))