Skip to content

Commit

Permalink
added :before depends-on option
Browse files Browse the repository at this point in the history
to be used when you really want to safeguard
that some other test has not run first.
  • Loading branch information
Henrik Hjelte committed Nov 1, 2007
1 parent aeda92b commit ef75e7e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/run.lisp
Expand Up @@ -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)
Expand Down
27 changes: 27 additions & 0 deletions t/tests.lisp
Expand Up @@ -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))
Expand Down

0 comments on commit ef75e7e

Please sign in to comment.