From ef75e7e7624f52a11e317fb0a8db7057233a45bf Mon Sep 17 00:00:00 2001 From: Henrik Hjelte Date: Thu, 1 Nov 2007 09:15:14 +0100 Subject: [PATCH] added :before depends-on option to be used when you really want to safeguard that some other test has not run first. --- src/run.lisp | 6 +++++- t/tests.lisp | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/run.lisp b/src/run.lisp index bc36025..579db2f 100644 --- a/src/run.lisp +++ b/src/run.lisp @@ -106,7 +106,11 @@ run.")) (ecase (car depends-on) (and (satisfies-depends-p #'every)) (or (satisfies-depends-p #'some)) - (not (satisfies-depends-p #'notany)))))) + (not (satisfies-depends-p #'notany)) + (:before (every #'(lambda (dep) + (let ((status (status (get-test dep)))) + (eql :unknown status))) + (cdr depends-on))))))) (defun results-status (result-list) "Given a list of test results (generated while running a test) diff --git a/t/tests.lisp b/t/tests.lisp index 91d0ac9..a77abf3 100644 --- a/t/tests.lisp +++ b/t/tests.lisp @@ -149,6 +149,33 @@ (signals circular-dependency (run 'circular-2))) + +(def-suite before-test-suite :description "Suite for before test") + +(test (before-0 :suite before-test-suite) + (pass)) + +(test (before-1 :depends-on (:before before-0) + :suite before-test-suite) + (fail)) + +(def-suite before-test-suite-2 :description "Suite for before test") + +(test (before-2 :depends-on (:before before-3) + :suite before-test-suite-2) + (pass)) + +(test (before-3 :suite before-test-suite-2) + (pass)) + +(test before + (with-test-results (results before-test-suite) + (is (some #'test-skipped-p results))) + + (with-test-results (results before-test-suite-2) + (is (every #'test-passed-p results)))) + + ;;;; dependencies with symbol (test (dep-with-symbol-first :suite test-suite) (pass)) -- 1.7.10.4