Skip to content

Commit 5f0c913

Browse files
committed
Fix for non-spec expectations
Fixes a bug in 1.1.0 that caused all non-spec expectations to fail to compile
1 parent 116551e commit 5f0c913

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
# Version 1.1.0 -- 2019-01-08
1+
# Version 1.1.1 -- 2019-01-14
22

33
* An expectation can now use a qualified keyword spec to test conformance of the actual value. Failures are reported with the spec explanation. #2
44
* If Paul Stadig's Humane Test Output is available (on the classpath), failure reporting is automatically made compatible with it. Expectations that use data structure "equality" (the `=?` extension to `is`) will produce "humane" output for failures, showing differences. #1
55

6+
# Version 1.1.0 -- 2019-01-08
7+
8+
(broken version)
9+
610
# Initial version 1.0.1 -- 2019-01-02

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>expectations</groupId>
55
<artifactId>clojure-test</artifactId>
6-
<version>1.1.0</version>
6+
<version>1.1.1</version>
77
<name>exp-clojure-test</name>
88

99
<description>A clojure.test-compatible version of the classic Expectations testing library.</description>

src/expectations/clojure/test.clj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@
4646
(defmethod t/assert-expr '=? [msg form]
4747
;; (is (=? val-or-pred expr))
4848
(let [[_ e a] form
49-
conform? (spec? e)
50-
valid? (when conform? (resolve 'clojure.spec.alpha/valid?))
51-
explain-str? (when conform? (resolve 'clojure.spec.alpha/explain-str))]
49+
conform? (spec? e)]
5250
`(let [e# ~e
5351
a# ~a
52+
valid?# (when ~conform? (resolve 'clojure.spec.alpha/valid?))
53+
explain-str?# (when ~conform? (resolve 'clojure.spec.alpha/explain-str))
5454
r# (cond ~conform?
55-
(~valid? e# a#)
55+
(valid?# e# a#)
5656
(fn? e#)
5757
(e# a#)
5858
:else
@@ -64,7 +64,7 @@
6464
(list '~e a#)
6565
a#)})
6666
(t/do-report {:type :fail, :message (if ~conform?
67-
(~explain-str? e# a#)
67+
(explain-str?# e# a#)
6868
~msg)
6969
:diffs (if humane?#
7070
[[a# (take 2 (data/diff e# a#))]]

0 commit comments

Comments
 (0)