X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fcontrol.lisp;h=fba89568ad6e0a53d388172d42be179c86d8ebb9;hb=cfd9e0ce078d53d0665aea0b2e445432721f99b7;hp=7fc405549fa1eae6ed4a3819398c36f18283aa4d;hpb=5a0b7f2b07309fb122742b648af7b9578b1cd29f;p=jscl.git diff --git a/tests/control.lisp b/tests/control.lisp index 7fc4055..fba8956 100644 --- a/tests/control.lisp +++ b/tests/control.lisp @@ -21,3 +21,31 @@ (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))) + +;; COMPLEMENT +(test (funcall (complement #'zerop) 1)) +;; FIXME: Uncomment whenever characterp is defined +;(test (not (funcall (complement #'characterp) #\A))) +(test (not (funcall (complement #'member) 'a '(a b c)))) +(test (funcall (complement #'member) 'd '(a b c)))