76 lines
2.1 KiB
Plaintext
76 lines
2.1 KiB
Plaintext
(xcl-test:do-test "simple lexical binding" (= 3 (let ((a 3)) a)))
|
|
|
|
(xcl-test:do-test-group "simple special binding"
|
|
:before (progn
|
|
(defun goo2 () (let ((a 3)(b a))
|
|
(declare (special a))
|
|
b))
|
|
(defun goo () (declare (special a )) a))
|
|
|
|
(xcl-test:do-test "special 1"
|
|
(let ((a 3)) (declare (special a)) (eq (goo) 3)))
|
|
(xcl-test:do-test "special reference in let value form"
|
|
(let ((a 'outer))
|
|
(declare (special a ))
|
|
(eq (goo2) 'outer))))
|
|
|
|
|
|
;; now try with specvars for references.
|
|
|
|
(xcl-test:do-test-group "using il:specvars in declare for bindings."
|
|
:before (progn
|
|
(defun goo2 () (let ((a 3)(b a))
|
|
(declare (il:specvars a))
|
|
b))
|
|
(defun goo () (declare (il:specvars a )) a))
|
|
|
|
(xcl-test:do-test "special 1"
|
|
(let ((a 3)) (declare (il:specvars a)) (eq (goo) 3)))
|
|
(xcl-test:do-test "special reference in let value form"
|
|
(let ((a 'outer))
|
|
(declare (il:specvars a ))
|
|
(eq (goo2) 'outer))))
|
|
|
|
;; from AR's
|
|
|
|
(xcl-test:do-test "#' finding lexical functions AR 5995"
|
|
(equal '(2)
|
|
(flet ((bar (n) (1+ n)))
|
|
(mapcar #'bar '(1)))))
|
|
|
|
(xcl-test:do-test "THROW vs. closures AR 6092"
|
|
(let ((this-one t))
|
|
(catch 'foo
|
|
(let ((closure #'(lambda () (throw 'foo this-one))))
|
|
(funcall closure)
|
|
(values nil)
|
|
)
|
|
)
|
|
))
|
|
|
|
(xcl-test:do-test "Interpreted &ALLOW-OTHER-KEYS AR 6122"
|
|
(eq ((lambda (&key key &allow-other-keys) 'ok)) 'ok)
|
|
)
|
|
|
|
(xcl-test:do-test "Interpreter: invalid keywords ar 6123"
|
|
(xcl-test:expect-errors (error) ((lambda (&key foo) 'foo) :bar 'bar))
|
|
)
|
|
|
|
(xcl-test:do-test "value of eval-when 6252"
|
|
(equal 3 (eval-when(eval) 3)))
|
|
|
|
(xcl-test:do-test "simple special in let* ar 6369"
|
|
(eq t (let* (x) (declare (special x)) t)))
|
|
|
|
|
|
(xcl-test:do-test "shadowing flets ar 6734"
|
|
(eq 4
|
|
(flet ((foo () 3))
|
|
(flet ((foo () 4))
|
|
(foo)))))
|
|
|
|
|
|
(xcl-test:do-test "interaction of FLET and MACROLET AR 7127"
|
|
(= 17 (macrolet ((foo (x) `(bar ,x)))
|
|
(flet ((bar (y) (+ 1 y)))
|
|
(foo 16))))) |