Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added :before depends-on option

to be used when you really want to safeguard
that some other test has not run first.
  • Loading branch information...
commit ef75e7e7624f52a11e317fb0a8db7057233a45bf 1 parent aeda92b
Henrik Hjelte authored
Showing with 32 additions and 1 deletion.
  1. +5 −1 src/run.lisp
  2. +27 −0 t/tests.lisp
View
6 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)
View
27 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))
Please sign in to comment.
Something went wrong with that request. Please try again.