(deftest+ name & body)Like clojure.core/deftest, with one added ability to use testing-only.
This will eventually call the clojure.core/deftest to make sure it works seaminglessly
with cloure.core/test runner.
The only thing it does is it walks the body to check if it contains at least one testing-only.
The result is bound to deftest-has-only?, it's later used in testing and testing-only to decide
whether or not to executes its body.
Like `clojure.core/deftest`, with one added ability to use `testing-only`. This will eventually call the `clojure.core/deftest` to make sure it works seaminglessly with `cloure.core/test` runner. The only thing it does is it walks the `body` to check if it contains at least one `testing-only`. The result is bound to *deftest-has-only?*, it's later used in `testing` and `testing-only` to decide whether or not to executes its body.
(install!)Install test-plus.
It'll replaces:
clojure.core/deftest with test-plus.core/deftest+clojure.core/testing with test-plus.core/testing+
And introduce a new clojure.core/testing-only macro.Install `test-plus`. It'll replaces: - `clojure.core/deftest` with `test-plus.core/deftest+` - `clojure.core/testing` with `test-plus.core/testing+` And introduce a new `clojure.core/testing-only` macro.
(testing+ string & body)Like clojure.test/testing, but this testing+ could not be executed if all of these conditions are met:
testing-only inside the parent deftesttesting+ are not nested under a testing-onlyLike `clojure.test/testing`, but this `testing+` could not be executed if all of these conditions are met: - There is a `testing-only` inside the parent `deftest` - This `testing+` are not nested under a `testing-only`
(testing-only string & body)Mark a testing to be run only. The test runner will skip others testing that are not nested under a testing-only.
(t/deftest simple-test (with-random-user user (t/testing "user has firstname?" ;; <- skip (t/is (some? (:first-name user))))
(t/testing-only "user has lastname?" ;; <- executed
(t/is (some? (:last-name user)))
(t/testing "last-name has at least 4 chars" ;; <- executed
(t/is (>= 4 (count (:last-name user))))))
(t/testing "user has password?" ;; <- skip
(t/is (some? (:password user))))))
Mark a `testing` to be run only. The test runner will skip others `testing` that are not nested under a `testing-only`.
(t/deftest simple-test
(with-random-user user
(t/testing "user has firstname?" ;; <- skip
(t/is (some? (:first-name user))))
(t/testing-only "user has lastname?" ;; <- executed
(t/is (some? (:last-name user)))
(t/testing "last-name has at least 4 chars" ;; <- executed
(t/is (>= 4 (count (:last-name user))))))
(t/testing "user has password?" ;; <- skip
(t/is (some? (:password user))))))
(wrap-testing has-nested-only? f)A testing will be executed if one of these conditions are met:
testing-only in the same deftesttesting are nested inside a testing-onlytesting has one testing-only nested inside itA `testing` will be executed if one of these conditions are met: - There are no `testing-only` in the same `deftest` - The current `testing` are nested inside a `testing-only` - The current `testing` has one `testing-only` nested inside it
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |