From ea7021b8bc505e45fff8d226d8ab7fce6cae0f76 Mon Sep 17 00:00:00 2001 From: Marco Baringer Date: Tue, 26 Jun 2007 13:48:05 +0200 Subject: [PATCH] Removed the default-test-args slot from test-suite. This slot doesn't really do what it's says it does (redefining it doesn't change things the way you'd expect) and it causes no end of headaches by confusing compile-time definitions with run-time definitions. --- src/classes.lisp | 6 +----- src/suite.lisp | 16 ++++++---------- src/test.lisp | 2 +- t/tests.lisp | 4 +--- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/classes.lisp b/src/classes.lisp index 0e7d836..8f11102 100644 --- a/src/classes.lisp +++ b/src/classes.lisp @@ -36,11 +36,7 @@ ((tests :accessor tests :initform (make-hash-table :test 'eql) :documentation "The hash table mapping names to test objects in this suite. The values in this hash table - can be either test-cases or other test-suites.") - (default-test-args :accessor default-test-args :initform '() - :initarg :default-test-args - :documentation "Arguments passed to TEST - macro when using this suite.")) + can be either test-cases or other test-suites.")) (:documentation "A test suite is a collection of tests or test suites. Test suites serve to organize tests into groups so that the diff --git a/src/suite.lisp b/src/suite.lisp index bf1cc10..c09c071 100644 --- a/src/suite.lisp +++ b/src/suite.lisp @@ -16,21 +16,17 @@ ;;;; ** Creating Suits -(defmacro def-suite (name &key description in default-test-args) +(defmacro def-suite (name &key description in) "Define a new test-suite named NAME. IN (a symbol), if provided, causes this suite te be nested in the suite named by IN. NB: This macro is built on top of make-suite, as such it, like make-suite, will overrwrite any existing suite -named NAME. - -DEFAULT-TEST-ARGS, if provided, will ba passed to the TEST forms -defined in this suite." - `(eval-when (:compile-toplevel :load-toplevel :execute) +named NAME." + `(progn (make-suite ',name ,@(when description `(:description ,description)) - ,@(when in `(:in ',in)) - ,@(when default-test-args `(:default-test-args ,default-test-args))) + ,@(when in `(:in ',in))) ',name)) (defmacro def-suite* (name &rest def-suite-args) @@ -38,11 +34,11 @@ defined in this suite." (def-suite ,name ,@def-suite-args) (in-suite ,name))) -(defun make-suite (name &key description in default-test-args) +(defun make-suite (name &key description in) "Create a new test suite object. Overides any existing suite named NAME." - (let ((suite (make-instance 'test-suite :name name :default-test-args default-test-args))) + (let ((suite (make-instance 'test-suite :name name))) (when description (setf (description suite) description)) (loop for i in (ensure-list in) diff --git a/src/test.lisp b/src/test.lisp index 29e8361..aacb11e 100644 --- a/src/test.lisp +++ b/src/test.lisp @@ -56,7 +56,7 @@ If PROFILE is T profiling information will be collected as well." (when (consp name) (remf (cdr name) :suite)) (destructuring-bind (name &key depends-on (compile-at :run-time) fixture profile) - (append (ensure-list name) (default-test-args suite)) + (ensure-list name) (declare (type (member :run-time :definition-time) compile-at)) (let ((description (if (stringp (car body)) (pop body) diff --git a/t/tests.lisp b/t/tests.lisp index f88d1fe..8eadcc2 100644 --- a/t/tests.lisp +++ b/t/tests.lisp @@ -4,9 +4,7 @@ (in-suite :it.bese.FiveAM) -(def-suite test-suite - :description "Suite for tests which should fail." - :default-test-args '(:fixture null-fixture :compile-at :run-time)) +(def-suite test-suite :description "Suite for tests which should fail.") (defmacro with-test-results ((results test-name) &body body) `(let ((,results (with-*test-dribble* nil (run ',test-name)))) -- 1.7.10.4