Skip to content

Commit e819aeb

Browse files
committed
fix #35
Signed-off-by: Sean Corfield <[email protected]>
1 parent a25e662 commit e819aeb

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
Only accretive/fixative changes will be made from now on.
88

99
* 2.1.next in progress
10-
* Address [#31](https://github.com/clojure-expectations/clojure-test/issues/31) by adding more examples to `more-of`.
10+
* Address [#35](https://github.com/clojure-expectations/clojure-test/issues/35) by treating any symbol starting with `expect` as an Expectations macro for the 2-argument form.
1111
* Address [#33](https://github.com/clojure-expectations/clojure-test/issues/33) by expanding the README introduction.
12+
* Address [#31](https://github.com/clojure-expectations/clojure-test/issues/31) by adding more examples to `more-of`.
1213
* Update dev/test dependencies.
1314

1415
* 2.1.188 -- 2023-10-22

src/expectations/clojure/test.cljc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
;; copyright (c) 2018-2023 sean corfield, all rights reserved
1+
;; copyright (c) 2018-2024 sean corfield, all rights reserved
22

33
(ns expectations.clojure.test
44
"This namespace provides compatibility with `clojure.test` and related tooling.
@@ -424,7 +424,7 @@
424424
[e]
425425
(when (and (coll? e) (not (vector? e)))
426426
(or (and (symbol? (first e))
427-
(= "expect" (name (first e))))
427+
(str/starts-with? (name (first e)) "expect"))
428428
(some contains-expect? e))))
429429

430430
(defmacro defexpect

test/expectations/clojure/test_test.cljc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
;; copyright (c) 2019-2023 sean corfield, all rights reserved
1+
;; copyright (c) 2019-2024 sean corfield, all rights reserved
22

33
(ns expectations.clojure.test-test
44
"Test the testing framework -- this is sometimes harder than you might think!
@@ -126,19 +126,19 @@
126126
(is-not' (sut/expect {:foo 1} (in {:foo 2 :cat 4})) (not= {:foo 1} {:foo 2}))
127127

128128
;; TODO: need better tests here
129-
(deftest grouping-more-more-of-from-each
130-
(sut/expecting "numeric behavior"
131-
(sut/expect (more-of {:keys [a b]}
132-
even? a
133-
odd? b)
134-
{:a (* 2 13) :b (* 3 13)})
135-
(sut/expect pos? (* -3 -5)))
136-
(sut/expecting "string behavior"
137-
(sut/expect (more #"foo" "foobar" #(str/starts-with? % "f"))
138-
(str "f" "oobar"))
139-
(sut/expect #"foo"
140-
(from-each [s ["l" "d" "bar"]]
141-
(str "foo" s))))))
129+
(deftest grouping-more-more-of-from-each
130+
(sut/expecting "numeric behavior"
131+
(sut/expect (more-of {:keys [a b]}
132+
even? a
133+
odd? b)
134+
{:a (* 2 13) :b (* 3 13)})
135+
(sut/expect pos? (* -3 -5)))
136+
(sut/expecting "string behavior"
137+
(sut/expect (more #"foo" "foobar" #(str/starts-with? % "f"))
138+
(str "f" "oobar"))
139+
(sut/expect #"foo"
140+
(from-each [s ["l" "d" "bar"]]
141+
(str "foo" s))))))
142142

143143
(deftest more-evals-once
144144
(let [counter (atom 1)]

0 commit comments

Comments
 (0)