From: Antony Sequeira
Subject: fivem unit test test macro does not work well
Date: 
Message-ID: <mtSdnRXmvNSyEbzanZ2dnUVZ_uGknZ2d@comcast.com>
Hi

I am trying to decide on what to use for unit testing.
So, I was trying the FievAM package from
http://common-lisp.net/project/bese/FiveAM.html

I created the following (actually I ran into this issue and the 
following is a demo of the issue)

The test macro seems not to do the right thing.
FOO20 []:
       Unexpected Error: #<SIMPLE-TYPE-ERROR {1004A6F491}>
Argument X is not a NUMBER: NIL..

Am I doing something wrong or is this a limitation.

I haven't done much CL so don't really know what to call this issue.

Code follows :fiveam-learn
   (:use :common-lisp :basic-stats
	:it.bese.FiveAM))

(in-package :fiveam-learn)


(def-suite fiveam-learn-suite )

(in-suite  fiveam-learn-suite )

(defvar *foo* nil)

(test emptyfoo
   (is (null *foo*)))

(let ((*foo* 20))
   (format t "foo is ~s ~%" *foo*)
   (defun bar ()
     (format t "foo is ~s ~%" *foo*))
   (test foo20
     (is (= *foo* 20))))   ; this fails to get 'proper' value for *foo*

(bar)
(run! 'fiveam-learn-suite)


Thanks,
-Antony
From: Josip Gracin
Subject: Re: fivem unit test test macro does not work well
Date: 
Message-ID: <ffsfen$cpo$1@sunce.iskon.hr>
Antony Sequeira wrote:
> (let ((*foo* 20))
>   (format t "foo is ~s ~%" *foo*)
>   (defun bar ()
>     (format t "foo is ~s ~%" *foo*))
>   (test foo20
>     (is (= *foo* 20))))   ; this fails to get 'proper' value for *foo*

Making the call to TEST a top-level form, i.e.

(test foo20
   (let ((*foo* 20))
     (flet ((bar () ...))
       (is (eql *foo* 20)))))