2 ;;;; continuations.test --- test suite for continutations
4 ;;;; Copyright (C) 2003, 2006 Free Software Foundation, Inc.
6 ;;;; This program is free software; you can redistribute it and/or modify
7 ;;;; it under the terms of the GNU General Public License as published by
8 ;;;; the Free Software Foundation; either version 2, or (at your option)
9 ;;;; any later version.
11 ;;;; This program 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
14 ;;;; GNU General Public License for more details.
16 ;;;; You should have received a copy of the GNU General Public License
17 ;;;; along with this software; see the file COPYING. If not, write to
18 ;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 ;;;; Boston, MA 02110-1301 USA
21 (define-module (test-suite test-continuations)
22 :use-module (test-suite lib))
24 (define (block-reentry body)
35 (define (catch-tag body)
38 (lambda (tag . args) tag)))
43 (block-reentry (lambda () (call/cc identity))))))
45 (define (dont-crash-please)
46 (let ((k (check-cont)))
51 (with-test-prefix "continuations"
53 (pass-if "throwing to a rewound catch context"
54 (eq? (dont-crash-please) 'no-reentry))
56 (with-debugging-evaluator
58 (pass-if "make a stack from a continuation"
59 (stack? (call-with-current-continuation make-stack)))
61 (pass-if "get a continuation's stack ID"
62 (let ((id (call-with-current-continuation stack-id)))
63 (or (boolean? id) (symbol? id))))
65 (pass-if "get a continuation's innermost frame"
66 (pair? (call-with-current-continuation last-stack-frame))))