From 62d95399305b8d906dc7d16623e55151824d93f6 Mon Sep 17 00:00:00 2001 From: pfdietz <pfdietz@localhost> Date: Sat, 22 Mar 2003 20:07:57 +0000 Subject: [PATCH] Various simple restart-bind tests. --- ansi-tests/restart-bind.lsp | 59 +++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/ansi-tests/restart-bind.lsp b/ansi-tests/restart-bind.lsp index bb1b38e1..d8b01190 100644 --- a/ansi-tests/restart-bind.lsp +++ b/ansi-tests/restart-bind.lsp @@ -29,6 +29,65 @@ (return-from done 'good))) good) +(deftest restart-bind.6 + (restart-bind ()) + nil) + +(deftest restart-bind.7 + (block done + (restart-bind ((foo #'(lambda () (return-from done 'good)))) + (invoke-restart 'foo) + 'bad)) + good) + +(deftest restart-bind.8 + (block done + (restart-bind ((foo #'(lambda () (return-from done 'good)))) + (let ((restart (find-restart 'foo))) + (and (typep restart 'restart) + (invoke-restart restart))) + 'bad)) + good) + +(deftest restart-bind.9 + (restart-bind ((foo #'(lambda (a b c) (list c a b)))) + (invoke-restart 'foo 1 2 3)) + (3 1 2)) + +(deftest restart-bind.10 + (flet ((%f () (invoke-restart 'foo 'x 'y 'z))) + (restart-bind ((foo #'(lambda (a b c) (list c a b)))) + (%f))) + (z x y)) + +(deftest restart-bind.11 + (restart-bind + ((foo #'(lambda () 'bad))) + (restart-bind + ((foo #'(lambda () 'good))) + (invoke-restart 'foo))) + good) + +(deftest restart-bind.12 + (let ((*x* 'bad)) + (declare (special *x*)) + (restart-bind + ((foo #'(lambda () (declare (special *x*)) *x*))) + (let ((*x* 'good)) + (declare (special *x*)) + (invoke-restart 'foo)))) + good) + +(deftest restart-bind.13 + (restart-bind + ((foo #'(lambda () 'bad))) + (flet ((%f () (invoke-restart 'foo))) + (restart-bind + ((foo #'(lambda () 'good))) + (%f)))) + good) + + -- GitLab