File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ (import (rnrs)
2+ (sagittarius continuations)
3+ (srfi :64))
4+
5+ (test-begin " Continuations" )
6+
7+ (test-assert " continuation? (call/cc)"
8+ (continuation? (call/cc (lambda (k ) k))))
9+ (test-assert " continuation? (call/comp)"
10+ (continuation?
11+ (call/prompt
12+ (lambda ()
13+ (call/comp (lambda (k ) k))))))
14+ (test-assert " continuation? (call/delimited-cc)"
15+ (continuation?
16+ (call/prompt
17+ (lambda ()
18+ (call/delimited-cc (lambda (k ) k))))))
19+
20+ (test-assert " continuation? (symbol)" (not (continuation? 'a )))
21+ (test-assert " continuation? (symbol)" (not (continuation? (lambda args args))))
22+
23+ (test-assert (continuation-prompt-tag? (default-continuation-prompt-tag)))
24+ (test-assert (continuation-prompt-tag? (make-continuation-prompt-tag)))
25+
26+ (let ((p1 (make-continuation-prompt-tag 'p1 )))
27+ (define (check )
28+ (let ((k (call-with-continuation-prompt
29+ (lambda ()
30+ ((call/delimited-cc
31+ (lambda (k ) (lambda () k))
32+ p1)))
33+ p1
34+ (lambda (x ) (display x) (newline) x))))
35+ (call-with-continuation-prompt
36+ (lambda () (k (lambda () 'invoked)))
37+ p1
38+ (lambda (x ) 'outer x))))
39+ (test-equal 'invoked (check)))
40+
41+ (test-end)
You can’t perform that action at this time.
0 commit comments