Inside let forms
digikar99 opened this issue · comments
The following does not work:
> (flet ((foo () 5)) (deftest test () (assert-equalp 5 (foo)))) ; looks for (foo) in global env
> (let ((a 4)) (deftest test () (assert-equalp a 4))) ; same issue - a in global environment
Is this a bad practice? This is an "issue" in lisp-unit
as well.
Hi!
I think you have to use fixtures for this to works:
(asdf:make :clunit)
(in-package :clunit)
(defsuite foo ())
(deftest bar (foo)
(assert-true (= 5 (+ a 1))))
(deffixture foo (@body)
(let ((a 4))
@body))
Hi!
FWIW clunit2 will accept your code. :)
Bye!
C.