From 8a32d7c6d3c1b7a43127731585f8a4bf9518b171 Mon Sep 17 00:00:00 2001 From: Marco Baringer Date: Wed, 19 Dec 2012 10:50:51 +0100 Subject: [PATCH] Remove in-suite* and def-suite*. --- docs/manual.txt | 25 ++++++------------------- src/suite.lisp | 35 +++++++++-------------------------- t/tests.lisp | 3 ++- 3 files changed, 17 insertions(+), 46 deletions(-) diff --git a/docs/manual.txt b/docs/manual.txt index 69e538b..a059f53 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -275,11 +275,6 @@ putting all your tests into the `T` suite. === Creating Suites === -Suites are created in one of two ways: Either explicitly via the -xref:OP_DEF-SUITE[`def-suite`] macro, or implicity via the -xref:OP_DEF-SUITE-STAR-[`def-suite*`] and/or -xref:OP_IN-SUITE-STAR-[`in-suite*`] macros: - Suites, very much like tests, have a name (which is globally unique) which can be used to retrieve the suite (so that you can run it), and, most of the time, suites are part of a suite (the exception being the @@ -293,7 +288,9 @@ is a sub suite of `:my-project` and set the current suite to -------------------------------- (def-suite :my-project) -(in-suite* :my-db-layer :in :my-project) +(def-suite :my-db-layer :in :my-project) + +(in-suite :my-db-layer) -------------------------------- [[THE_CURRENT_SUITE]] @@ -301,10 +298,8 @@ is a sub suite of `:my-project` and set the current suite to FiveAM also has the concept of a current suite and everytime a test is created it adds itself to the current suite's set of tests. The -`IN-SUITE` and `IN-SUITE*` macros, in a similar fashion to -`IN-PACKAGE`, change the current suite. - -Unless changed via `IN-SUITE` and `IN-SUITE*` the current suite is the +`IN-SUITE` macro, in a similar fashion to `IN-PACKAGE`, changes the +current suite. Unless changed via `IN-SUITE` the current suite is the `T` suite. Having a default current suite allows developers to ignore suites @@ -503,7 +498,7 @@ include::docstrings/OP_DEF-SUITE.txt[] [[OP_IN-SUITE]] [[OP_IN-SUITE-STAR-]] -=== IN-SUITE / IN-SUITE* === +=== IN-SUITE === ================================ ---- @@ -513,14 +508,6 @@ include::docstrings/OP_DEF-SUITE.txt[] include::docstrings/OP_IN-SUITE.txt[] ================================ -================================ ----- -(in-suite* NAME &key IN) ----- - -include::docstrings/OP_IN-SUITE-STAR-.txt[] -================================ - [[OP_IS]] === IS === diff --git a/src/suite.lisp b/src/suite.lisp index 76d6526..c0cac8b 100644 --- a/src/suite.lisp +++ b/src/suite.lisp @@ -46,11 +46,6 @@ will overrwrite any existing suite named `NAME`." ,@(when fixture-p `(:fixture ',fixture))) ',name)) -(defmacro def-suite* (name &rest def-suite-args) - `(progn - (def-suite ,name ,@def-suite-args) - (in-suite ,name))) - (defun remove-from-suites (test-name) (when (get-test test-name) ;; if this suite alruady exists, and its :IN some other suite, remove it. @@ -96,28 +91,16 @@ See also: `DEF-SUITE` and `*SUITE*`. " `(eval-when (:compile-toplevel :load-toplevel :execute) (%in-suite ,suite-name))) -(defmacro in-suite* (suite-name &rest def-suite-args) - "Same effect as `IN-SUITE`, but if `SUITE-NAME` does not exist it -will be created (as per `DEF-SUITE`)" - `(%in-suite ,suite-name - :fail-on-error nil - ,@def-suite-args)) - -(defmacro %in-suite (suite-name &rest def-suite-args &key fail-on-error &allow-other-keys) - (declare (ignore fail-on-error)) +(defmacro %in-suite (suite-name &rest def-suite-args) (with-gensyms (suite) - (let ((fail-on-error (getf def-suite-args :fail-on-error t))) - (remf def-suite-args :fail-on-error) - `(progn - (if-let (,suite (get-test ',suite-name)) - (setf *suite* ,suite) - (progn - (when ,fail-on-error - (cerror "Create a new suite named ~A." - "Unknown suite ~A." ',suite-name)) - (setf (get-test ',suite-name) (make-suite ',suite-name ,@def-suite-args) - *suite* (get-test ',suite-name)))) - ',suite-name)))) + `(progn + (if-let (,suite (get-test ',suite-name)) + (setf *suite* ,suite) + (progn + (cerror "Create a new suite named ~A." "Unknown suite ~A." ',suite-name) + (setf (get-test ',suite-name) (make-suite ',suite-name ,@def-suite-args) + *suite* (get-test ',suite-name)))) + ',suite-name))) ;; Copyright (c) 2002-2003, Edward Marco Baringer ;; All rights reserved. diff --git a/t/tests.lisp b/t/tests.lisp index 27b4229..caba093 100644 --- a/t/tests.lisp +++ b/t/tests.lisp @@ -280,7 +280,8 @@ (def-test add-remove-test-from-suite () (let ((*test* (make-hash-table :test 'eql)) (*suites* (make-hash-table :test 'eql))) - (in-suite* empty :in nil) + (def-suite empty :in nil) + (in-suite empty) (is (null (get-test 'foo))) (def-test foo (:suite nil) t) -- 1.7.10.4