From b6937ebfdbd276ec7e332ceade0697184904e4e1 Mon Sep 17 00:00:00 2001 From: Attila Lendvai Date: Sat, 30 Sep 2006 17:53:44 +0200 Subject: [PATCH] Added in-suite* that also defines the suite --- src/packages.lisp | 1 + src/suite.lisp | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/packages.lisp b/src/packages.lisp index 1669ad9..cf5aa26 100644 --- a/src/packages.lisp +++ b/src/packages.lisp @@ -24,6 +24,7 @@ #:make-suite #:def-suite #:in-suite + #:in-suite* #:make-test #:test #:get-test diff --git a/src/suite.lisp b/src/suite.lisp index bed1945..e7aab24 100644 --- a/src/suite.lisp +++ b/src/suite.lisp @@ -59,14 +59,22 @@ after the execution of this form are, unless specified otherwise, in the test-suite named SUITE-NAME. See also: DEF-SUITE *SUITE*" + `(%in-suite ,suite-name)) + +(defmacro in-suite* (suite-name &key in) + "Just like in-suite, but silently creates missing suites." + `(%in-suite ,suite-name :in ,in :fail-on-error nil)) + +(defmacro %in-suite (suite-name &key (fail-on-error t) in) (with-unique-names (suite) `(progn (if-bind ,suite (get-test ',suite-name) (setf *suite* ,suite) (progn - (cerror "Create a new suite named ~A." - "Unkown suite ~A." ',suite-name) - (setf (get-test ',suite-name) (make-suite ',suite-name) + (when ,fail-on-error + (cerror "Create a new suite named ~A." + "Unkown suite ~A." ',suite-name)) + (setf (get-test ',suite-name) (make-suite ',suite-name :in ',in) *suite* (get-test ',suite-name)))) ',suite-name))) -- 1.7.10.4