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)))
```
(defexpect n & body)Adapted from expectations.clojure.test/defexpect.
Adapted from `expectations.clojure.test/defexpect`.
(expect a)(expect e a)(expect e a msg)(expect e a msg ex? e')Adapted from expectations.clojure.test/expect.
Adapted from `expectations.clojure.test/expect`.
(expecting doc & body)Adapted from expectations.clojure.test/expecting.
Adapted from `expectations.clojure.test/expecting`.
(from-each bindings & body)Adapted from expectations.clojure.test/from-each.
Adapted from `expectations.clojure.test/from-each`.
(in coll)Adapted from expectations.clojure.test/in.
Adapted from `expectations.clojure.test/in`.
(more & expecteds)Adapted from expectations.clojure.test/more.
Adapted from `expectations.clojure.test/more`.
(more-> & expected-threaded-pairs)Adapted from expectations.clojure.test/more->.
Adapted from `expectations.clojure.test/more->`.
(more-of destructuring & expected-actual-pairs)Adapted from expectations.clojure.test/more-of.
Adapted from `expectations.clojure.test/more-of`.
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 |