From: David Vázquez Date: Wed, 1 May 2013 21:40:54 +0000 (+0100) Subject: Merge tests/return-from.lisp into tests/control.lisp X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=343b5129802d801f084f48f6199a04e292ace1af;p=jscl.git Merge tests/return-from.lisp into tests/control.lisp --- diff --git a/tests/control.lisp b/tests/control.lisp index 7fc4055..5e010e3 100644 --- a/tests/control.lisp +++ b/tests/control.lisp @@ -21,3 +21,24 @@ (test (foo-2 nil)) + +(test (equal (flet ((foo () (return-from foo 42))) + (foo)) + 42)) + +(test (equal (let ((out (list))) + (labels ((zfoo (n rf i) + (if (> n 0) + (progn + (push (lambda () (return-from zfoo n)) rf) + (push n out) + (zfoo (1- n) rf i) + (push (- n) out)) + (progn + (push 999 out) + (funcall (nth i (reverse rf))) + (push -999 out))))) + (let ((rf (list))) + (zfoo 5 rf 3) + out))) + '(-5 -4 -3 999 1 2 3 4 5))) diff --git a/tests/return-from.lisp b/tests/return-from.lisp deleted file mode 100644 index 0d423ff..0000000 --- a/tests/return-from.lisp +++ /dev/null @@ -1,20 +0,0 @@ -(test (equal (flet ((foo () (return-from foo 42))) - (foo)) - 42)) - -(test (equal (let ((out (list))) - (labels ((zfoo (n rf i) - (if (> n 0) - (progn - (push (lambda () (return-from zfoo n)) rf) - (push n out) - (zfoo (1- n) rf i) - (push (- n) out)) - (progn - (push 999 out) - (funcall (nth i (reverse rf))) - (push -999 out))))) - (let ((rf (list))) - (zfoo 5 rf 3) - out))) - '(-5 -4 -3 999 1 2 3 4 5)))