tgutu / clunit

CLUnit: A Common Lisp Unit Testing Framework.

Home Page:http://tgutu.github.com/clunit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

commented

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))
commented

Hi!

FWIW clunit2 will accept your code. :)

Bye!
C.