Liking cljdoc? Tell your friends :D

test-plus.core


*deftest-has-only?*clj

source

*inside-testing-only?*clj

source

deftest+cljmacro

(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.
sourceraw docstring

install!clj

(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.
sourceraw docstring

original-deftestcljmacro

source

original-testingcljmacro

source

testing+cljmacro

(testing+ string & body)

Like 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
Like `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`
sourceraw docstring

testing-onlycljmacro

(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))))))
sourceraw docstring

uninstall!clj

(uninstall!)

Uninstall test-plus

Uninstall `test-plus`
sourceraw docstring

wrap-testingclj

(wrap-testing has-nested-only? f)

A 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
A `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
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close