Skip to content

Commit

Permalink
2.2.0-rc1 add expecting macro
Browse files Browse the repository at this point in the history
Like `clojure.test/testing`.
  • Loading branch information
seancorfield committed Sep 9, 2017
1 parent 17e4b54 commit 4da361d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changes in version 2.2.0

Add support for `clojure.test` via the new `expectations.clojure.test` namespace and the `defexpect` macro #82.
Add support for `clojure.test` via the new `expectations.clojure.test` namespace and the `defexpect` macro #82. Add `expecting` documentation macro (like `clojure.test/testing`).

Add `approximately` predicate, to test if two floating point values are "equal" (within a given tolerance) #84.

Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject expectations "2.2.0-beta3"
(defproject expectations "2.2.0-rc1"
:description "testing framework"
:jar-name "expectations.jar"
:jar-exclusions [#"\.swp|\.swo|\.DS_Store"]
Expand Down
8 changes: 8 additions & 0 deletions src/cljc/expectations/clojure/test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,13 @@
"defexpect contains no 'expect' forms")
`(clojure.test/deftest ~n ~@forms#))))

#?(:clj
(defmacro expecting
"The Expectations version of clojure.test/testing."
[string & body]
`(binding [t/*testing-contexts* (conj t/*testing-contexts* ~string)]
~@body)))


#?(:clj
(e/disable-run-on-shutdown))
5 changes: 3 additions & 2 deletions test/cljc/clojure_test/clojure_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
0 (/ 1 0))

(defexpect grouped
(expect 42 (from-each [n [41 42 43]] n))
(expect 42 (in [41 43]))
(expecting "failures in sequence tests"
(expect 42 (from-each [n [41 42 43]] n))
(expect 42 (in [41 43])))
(expect (more number? pos?) -1)
(expect pos? -1)
(expect "Hello World!" "Hello Clojure!")
Expand Down

0 comments on commit 4da361d

Please sign in to comment.