2 ;;;; continuations.test --- test suite for continutations
4 ;;;; Copyright (C) 2003, 2006 Free Software Foundation, Inc.
6 ;;;; This library is free software; you can redistribute it and/or
7 ;;;; modify it under the terms of the GNU Lesser General Public
8 ;;;; License as published by the Free Software Foundation; either
9 ;;;; version 3 of the License, or (at your option) any later version.
11 ;;;; This library is distributed in the hope that it will be useful,
12 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 ;;;; Lesser General Public License for more details.
16 ;;;; You should have received a copy of the GNU Lesser General Public
17 ;;;; License along with this library; if not, write to the Free Software
18 ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 (define-module (test-suite test-continuations)
21 :use-module (test-suite lib))
23 (define (block-reentry body)
34 (define (catch-tag body)
37 (lambda (tag . args) tag)))
42 (block-reentry (lambda () (call/cc identity))))))
44 (define (dont-crash-please)
45 (let ((k (check-cont)))
50 (with-test-prefix "continuations"
52 (pass-if "throwing to a rewound catch context"
53 (eq? (dont-crash-please) 'no-reentry))
55 (with-debugging-evaluator
57 (pass-if "make a stack from a continuation"
58 (stack? (call-with-current-continuation make-stack)))
60 (pass-if "get a continuation's stack ID"
61 (let ((id (call-with-current-continuation stack-id)))
62 (or (boolean? id) (symbol? id))))
64 (pass-if "get a continuation's innermost frame"
65 (pair? (call-with-current-continuation last-stack-frame))))