EXPERIMENTAL. COULD BE CHANGED AT ANY TIME. Please share usage reports at https://github.com/noahtheduke/lazytest/issues
An adaption of the built-in clojure.test
framework. To mirror clojure.test
, deftest
wraps the entire test in a single test-case. testing
works the same way as clojure.test/testing
, so it does not support metadata selection like lazytest.core/describe
. thrown?
and thrown-with-msg?
must be required to be used as is
does not support clojure.test/assert-expr
.
Supported clojure.test
vars:
Example:
(ns noahtheduke.example-test
(:require
[lazytest.experimental.interfaces.clojure-test :refer [deftest are is testing]]))
(deftest deftest-test
(is true "expect works inside")
(testing "testing works"
(is (= 7 (+ 3 4)) "is works"))
(testing "are works"
(are [x y] (= x y)
2 (+ 1 1)
4 (* 2 2))))
EXPERIMENTAL. COULD BE CHANGED AT ANY TIME. Please share usage reports at https://github.com/noahtheduke/lazytest/issues An adaption of the built-in `clojure.test` framework. To mirror `clojure.test`, [[deftest]] wraps the entire test in a single test-case. [[testing]] works the same way as `clojure.test/testing`, so it does not support metadata selection like [[lazytest.core/describe]]. [[thrown?]] and [[thrown-with-msg?]] must be required to be used as [[is]] does not support `clojure.test/assert-expr`. Supported `clojure.test` vars: * [[deftest]] * [[testing]] * [[is]] * [[are]] * [[thrown?]] * [[thrown-with-msg?]] Example: ```clojure (ns noahtheduke.example-test (:require [lazytest.experimental.interfaces.clojure-test :refer [deftest are is testing]])) (deftest deftest-test (is true "expect works inside") (testing "testing works" (is (= 7 (+ 3 4)) "is works")) (testing "are works" (are [x y] (= x y) 2 (+ 1 1) 4 (* 2 2)))) ```
EXPERIMENTAL. COULD BE CHANGED AT ANY TIME. Please share usage reports at https://github.com/noahtheduke/lazytest/issues
An adaption of the Clojure library Expectations v2. To mirror how it's built for clojure.test
, defexpect
wraps the entire test in a single test-case. expecting
works the same way as clojure.test/testing
, so it does not support metadata selection like lazytest.core/describe
. expect
is implemented in lazytest.extensions.expectations/expect
. None of the utility functions from Expectations v2 are adapted here. They can be found in lazytest.extensions.expectations
.
To use just the expect
assertion from Expectations v2, please see lazytest.extensions.expectations/expect
.
Supported Expectations vars:
Example:
(ns noahtheduke.example-test
(:require
[clojure.spec.alpha :as s]
[lazytest.experimental.interfaces.expectations :refer [defexpect expecting expect]]))
(s/def ::pos pos?)
(defexpect expectations-test
(expecting "value"
(expect true))
(expecting "="
(expect 1 1))
(expecting "fn?"
(let [i 1] (expect pos? i)))
(expecting "regex"
(expect #"hello" "hello world"))
(expecting "instance?"
(expect String "hello world"))
(expecting "catch"
(expect ExceptionInfo (throw (ex-info "aw shucks" {}))))
(expecting "spec"
(expect ::pos 1)))
EXPERIMENTAL. COULD BE CHANGED AT ANY TIME. Please share usage reports at https://github.com/noahtheduke/lazytest/issues An adaption of the Clojure library [Expectations v2](https://github.com/clojure-expectations/clojure-test). To mirror how it's built for `clojure.test`, [[defexpect]] wraps the entire test in a single test-case. [[expecting]] works the same way as `clojure.test/testing`, so it does not support metadata selection like [[lazytest.core/describe]]. [[expect]] is implemented in [[lazytest.extensions.expectations/expect]]. None of the utility functions from Expectations v2 are adapted here. They can be found in [[lazytest.extensions.expectations]]. To use just the `expect` assertion from Expectations v2, please see [[lazytest.extensions.expectations/expect]]. Supported Expectations vars: * [[defexpect]] * [[expecting]] * [[expect]] * [[in]] * [[from-each]] * [[more]] * [[more-of]] * [[more->]] Example: ```clojure (ns noahtheduke.example-test (:require [clojure.spec.alpha :as s] [lazytest.experimental.interfaces.expectations :refer [defexpect expecting expect]])) (s/def ::pos pos?) (defexpect expectations-test (expecting "value" (expect true)) (expecting "=" (expect 1 1)) (expecting "fn?" (let [i 1] (expect pos? i))) (expecting "regex" (expect #"hello" "hello world")) (expecting "instance?" (expect String "hello world")) (expecting "catch" (expect ExceptionInfo (throw (ex-info "aw shucks" {})))) (expecting "spec" (expect ::pos 1))) ```
EXPERIMENTAL. COULD BE CHANGED AT ANY TIME. Please share usage reports at https://github.com/noahtheduke/lazytest/issues.
An adaption of the Midje framework. Only adapts the fact
and facts
macros. fact
acts like lazytest.core/it
for the purposes of test-cases.
Unlike Midje, facts
is not an alias for fact
, and fact
not support the (given => expected)
syntax as that's highly complex and outside the scope of this namespace.
prep-ns-suite!
must be called before facts
, as they expect :lazytest/ns-suite
to point to an existing suite.
Example:
(ns noahtheduke.example-test
(:require
[lazytest.experimental.interfaces.midje :refer [prep-ns-suite! facts fact]]))
(prep-ns-suite!)
(facts "a simple top level test"
(fact "a test case"
(expect true "expect works inside"))
(facts "a nested facts call"
(fact "this still works"
(expect true))))
EXPERIMENTAL. COULD BE CHANGED AT ANY TIME. Please share usage reports at <https://github.com/noahtheduke/lazytest/issues>. An adaption of the [Midje](https://github.com/marick/midje) framework. Only adapts the [[fact]] and [[facts]] macros. [[fact]] acts like [[lazytest.core/it]] for the purposes of test-cases. Unlike Midje, [[facts]] is not an alias for [[fact]], and [[fact]] not support the `(given => expected)` syntax as that's highly complex and outside the scope of this namespace. [[prep-ns-suite!]] must be called before [[facts]], as they expect `:lazytest/ns-suite` to point to an existing suite. Example: ```clojure (ns noahtheduke.example-test (:require [lazytest.experimental.interfaces.midje :refer [prep-ns-suite! facts fact]])) (prep-ns-suite!) (facts "a simple top level test" (fact "a test case" (expect true "expect works inside")) (facts "a nested facts call" (fact "this still works" (expect true)))) ```
EXPERIMENTAL. COULD BE CHANGED AT ANY TIME. Please share usage reports at https://github.com/noahtheduke/lazytest/issues.
An adaption of the QUnit framework. Only adapts the unnested style as the nested style can be achieved natively with lazytest.core
macros.
prep-ns-suite!
must be called before module!
or test!
, as they expect :lazytest/ns-suite
to point to an existing suite.
Example:
(ns noahtheduke.example-test
(:require
[lazytest.interfaces.qunit :refer [prep-ns-suite! module! test! assert!]]))
(prep-ns-suite!)
(module! "Group A")
(test! "foo"
(assert! (true? (pos? 1)))
(assert! (false? (pos? 0)) "Expected to be false"))
EXPERIMENTAL. COULD BE CHANGED AT ANY TIME. Please share usage reports at <https://github.com/noahtheduke/lazytest/issues>. An adaption of the [QUnit](https://qunitjs.com/) framework. Only adapts the unnested style as the nested style can be achieved natively with [[lazytest.core]] macros. [[prep-ns-suite!]] must be called before [[module!]] or [[test!]], as they expect `:lazytest/ns-suite` to point to an existing suite. Example: ```clojure (ns noahtheduke.example-test (:require [lazytest.interfaces.qunit :refer [prep-ns-suite! module! test! assert!]])) (prep-ns-suite!) (module! "Group A") (test! "foo" (assert! (true? (pos? 1))) (assert! (false? (pos? 0)) "Expected to be false")) ```
EXPERIMENTAL. COULD BE CHANGED AT ANY TIME. Please share usage reports at https://github.com/noahtheduke/lazytest/issues.
An adaption of the xUnit style of test frameworks. A fairly simple aliasing of the lazytest.core
macros:
lazytest.core/defdescribe
-> defsuite
lazytest.core/describe
-> suite
lazytest.core/it
-> test-case
lazytest.core/expect
-> assert!
Example:
(ns noahtheduke.example-test
(:require
[lazytest.experimental.interfaces.xunit :refer [defsuite suite test-case assert!]]))
(defsuite defsuite-test
(suite "defsuite works"
(assert! true "expect works inside"))
(suite "suite works"
(test-case "test-case works"
(assert! true))))
EXPERIMENTAL. COULD BE CHANGED AT ANY TIME. Please share usage reports at <https://github.com/noahtheduke/lazytest/issues>. An adaption of the [xUnit](https://en.wikipedia.org/wiki/XUnit) style of test frameworks. A fairly simple aliasing of the [[lazytest.core]] macros: * [[lazytest.core/defdescribe]] -> [[defsuite]] * [[lazytest.core/describe]] -> [[suite]] * [[lazytest.core/it]] -> [[test-case]] * [[lazytest.core/expect]] -> [[assert!]] Example: ```clojure (ns noahtheduke.example-test (:require [lazytest.experimental.interfaces.xunit :refer [defsuite suite test-case assert!]])) (defsuite defsuite-test (suite "defsuite works" (assert! true "expect works inside")) (suite "suite works" (test-case "test-case works" (assert! true)))) ```
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close