Skip to content

Commit 7130d0f

Browse files
committed
prep for 2.0.159
1 parent 6338373 commit 7130d0f

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
Only accretive/fixative changes will be made from now on.
88

9-
* 2.0.next in progress
9+
* 2.0.159 -- 2022-03-26
10+
* Fix [#28](https://github.com/clojure-expectations/clojure-test/issues/28) by recognizing qualified calls to `expect` (to suppress legacy behavior in more cases).
1011
* Update `build-clj` to v0.8.0.
1112

1213
* 2.0.157 -- 2022-01-25

src/expectations/clojure/test.cljc

+10-13
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,13 @@
407407
(macroexpand '(expect (more-of {:keys [a b c]} 1 a 2 b 3 c) {:a 1 :b 2 :c 3})))
408408

409409
(defn- contains-expect?
410-
"Given a form, return `true` if it contains any calls to the 'expect' macro."
410+
"Given a form, return `true` if it contains any calls to the 'expect' macro.
411+
412+
As of #28, we also recognize qualified 'expect' calls."
411413
[e]
412414
(when (and (coll? e) (not (vector? e)))
413-
(or (= 'expect (first e))
415+
(or (and (symbol? (first e))
416+
(= "expect" (name (first e))))
414417
(some contains-expect? e))))
415418

416419
(defmacro defexpect
@@ -419,19 +422,13 @@
419422
420423
`(defexpect name expected actual)` is a special case shorthand for
421424
`(defexpect name (expect expected actual))` provided as an easy way to migrate
422-
legacy Expectation tests to the 'clojure.test' compatibility version.
423-
424-
`(defexpect name actual)` is a special case shorthand for
425-
`(defexpect name (expect actual))` which is equivalent to
426-
`(deftest name (is actual))`"
425+
legacy Expectation tests to the 'clojure.test' compatibility version."
427426
[n & body]
428-
(if (and (<= (count body) 2)
427+
(if (and (= (count body) 2)
429428
(not (some contains-expect? body)))
430-
(if (<= (count body) 1)
431-
;; #13 match deftest behavior starting in 2.0.0
432-
`(t/deftest ~n ~@body)
433-
;; but still treat (defexpect my-name pred (expr)) as a special case
434-
`(t/deftest ~n (expect ~@body)))
429+
;; treat (defexpect my-name pred (expr)) as a special case
430+
`(t/deftest ~n (expect ~@body))
431+
;; #13 match deftest behavior starting in 2.0.0
435432
`(t/deftest ~n ~@body)))
436433

437434
(defmacro expecting

0 commit comments

Comments
 (0)