X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Ftest.lisp;h=29e836189709a8f2f445b8f0ce86912a2741c452;hb=5c649363640c2060387ed91132791e52e2c52c11;hp=9aa1039b95dbc08a1afbdda1df9ea020e05cbf5d;hpb=168a8cb290c6d9b3fa40e500fd044ecacebb5429;p=fiveam.git diff --git a/src/test.lisp b/src/test.lisp index 9aa1039..29e8361 100644 --- a/src/test.lisp +++ b/src/test.lisp @@ -24,7 +24,7 @@ "Create a test named NAME. If NAME is a list it must be of the form: - (name &key depends-on suite fixture compile-at) + (name &key depends-on suite fixture compile-at profile) NAME is the symbol which names the test. @@ -45,16 +45,17 @@ If DEPENDS-ON is a symbol it is interpreted as `(AND ,depends-on), this is accomadate the common case of one test depending on another. -FIXTURE specifies a fixtrue to wrap the body in." - +FIXTURE specifies a fixtrue to wrap the body in. + +If PROFILE is T profiling information will be collected as well." (let* ((tmp (gensym)) (suite-arg (getf (cdr (ensure-list name)) :suite tmp)) - (suite (cond - ((eq tmp suite-arg) *suite*) - (t (get-test suite-arg))))) + (suite-form (cond + ((eq tmp suite-arg) '*suite*) + (t `(get-test ',suite-arg))))) (when (consp name) (remf (cdr name) :suite)) - (destructuring-bind (name &key depends-on (compile-at :run-time) fixture) + (destructuring-bind (name &key depends-on (compile-at :run-time) fixture profile) (append (ensure-list name) (default-test-args suite)) (declare (type (member :run-time :definition-time) compile-at)) (let ((description (if (stringp (car body)) @@ -78,8 +79,9 @@ FIXTURE specifies a fixtrue to wrap the body in." ,@effective-body)))))) (:definition-time effective-body))) :description ,description - :depends-on ',depends-on)) - (setf (gethash ',name (tests ,suite)) ',name) + :depends-on ',depends-on + :collect-profiling-info ,profile)) + (setf (gethash ',name (tests ,suite-form)) ',name) (when *run-test-when-defined* (run! ',name)) ',name)))))