=== 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
--------------------------------
(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]]
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
[[OP_IN-SUITE]]
[[OP_IN-SUITE-STAR-]]
-=== IN-SUITE / IN-SUITE* ===
+=== IN-SUITE ===
================================
----
include::docstrings/OP_IN-SUITE.txt[]
================================
-================================
-----
-(in-suite* NAME &key IN)
-----
-
-include::docstrings/OP_IN-SUITE-STAR-.txt[]
-================================
-
[[OP_IS]]
=== IS ===
,@(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.
`(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.
(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)