Skip to content

Commit

Permalink
add unit test for call/cc
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Jan 8, 2024
1 parent 609a849 commit a262c11
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/continuations.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit a262c11

Please sign in to comment.