author | Alan Dipert
<alan@dipert.org> 2021-06-27 19:47:07 UTC |
committer | Alan Dipert
<alan@dipert.org> 2021-06-27 19:47:07 UTC |
parent | 205dd9734739995c34730230cd308b15427d9d41 |
jacl-tests.lisp | +12 | -3 |
diff --git a/jacl-tests.lisp b/jacl-tests.lisp index 170dbfc..f660b67 100644 --- a/jacl-tests.lisp +++ b/jacl-tests.lisp @@ -53,16 +53,25 @@ (let ((sym '|Alan|)) (assert= (\. sym |name|) @"Alan")))) -(in-module "Lambda List") +(in-module "Lambda") -(deftest "Keyword arguments" +(deftest "Lambda Expressions" + (assert= ((lambda (x y) (+ x y)) 1 2) 3) + (assert-throws ((lambda (x y z)) 'only-argument))) + +(deftest "Funcall" (assert= (funcall (lambda (&key x) x) :x 123) 123) (assert= (funcall (lambda (a b &key c) (+ a b c)) 1 2 :c 3) 6) (assert= (funcall (lambda (x y &key a b c) (dolist (x (list a b c) c) x)) nil nil) - nil)) + nil) + (assert= (let ((func (lambda () 123))) (funcall func)) 123)) + +(deftest "Apply" + (assert= (apply (lambda (x y) (+ x y)) '(1 2)) 3) + (assert= (apply #'(lambda (x y) (+ x y)) '(1 2)) 3)) ;; (in-module "Macro Lambda List") ;; TODO