X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=t%2Ftests.lisp;h=a5fec51786b9fa52076c15bbe0540118facc9e11;hb=c20dba484e44f476482a9c0e718ec7ba8dd25577;hp=8eadcc2360af502fd0a24d6e3af3a5e5e0f77fc3;hpb=ea7021b8bc505e45fff8d226d8ab7fce6cae0f76;p=fiveam.git diff --git a/t/tests.lisp b/t/tests.lisp index 8eadcc2..a5fec51 100644 --- a/t/tests.lisp +++ b/t/tests.lisp @@ -1,8 +1,8 @@ -;;;; -*- lisp -*- +;;;; -*- Mode: Lisp; indent-tabs-mode: nil -*- -(in-package :it.bese.FiveAM) +(in-package :it.bese.fiveam) -(in-suite :it.bese.FiveAM) +(in-suite :it.bese.fiveam) (def-suite test-suite :description "Suite for tests which should fail.") @@ -10,6 +10,7 @@ `(let ((,results (with-*test-dribble* nil (run ',test-name)))) ,@body)) +(rem-fixture 'null-fixture) (def-fixture null-fixture () `(progn ,@(&body))) @@ -149,6 +150,65 @@ (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)) + +(test (dep-with-symbol-dependencies-not-met :depends-on (not dep-with-symbol-first) + :suite test-suite) + (fail "Error in the test of the test, this should not ever happen")) + +(test (dep-with-symbol-depends-on-ok :depends-on dep-with-symbol-first :suite test-suite) + (pass)) + +(test (dep-with-symbol-depends-on-failed-dependency :depends-on dep-with-symbol-dependencies-not-met + :suite test-suite) + (fail "No, I should not be tested becuase I depend on a test that in its turn has a failed dependecy.")) + +(test dependencies-with-symbol + (with-test-results (results dep-with-symbol-first) + (is (some #'test-passed-p results))) + + (with-test-results (results dep-with-symbol-depends-on-ok) + (is (some #'test-passed-p results))) + + (with-test-results (results dep-with-symbol-dependencies-not-met) + (is (some #'test-skipped-p results))) + + ;; No failure here, because it means the test was run. + (with-test-results (results dep-with-symbol-depends-on-failed-dependency) + (is (not (some #'test-failure-p results))))) + + +;;;; test for-all + (test gen-integer (for-all ((a (gen-integer))) (is (integerp a))))