diff --git a/CHANGELOG.md b/CHANGELOG.md index fc9d3b6..b694f0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,9 @@ Only accretive/fixative changes will be made from now on. * 2.1.next in progress - * Address [#31](https://github.com/clojure-expectations/clojure-test/issues/31) by adding more examples to `more-of`. + * 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. * Address [#33](https://github.com/clojure-expectations/clojure-test/issues/33) by expanding the README introduction. + * Address [#31](https://github.com/clojure-expectations/clojure-test/issues/31) by adding more examples to `more-of`. * Update dev/test dependencies. * 2.1.188 -- 2023-10-22 diff --git a/src/expectations/clojure/test.cljc b/src/expectations/clojure/test.cljc index 11e75e0..7b77a54 100644 --- a/src/expectations/clojure/test.cljc +++ b/src/expectations/clojure/test.cljc @@ -1,4 +1,4 @@ -;; copyright (c) 2018-2023 sean corfield, all rights reserved +;; copyright (c) 2018-2024 sean corfield, all rights reserved (ns expectations.clojure.test "This namespace provides compatibility with `clojure.test` and related tooling. @@ -424,7 +424,7 @@ [e] (when (and (coll? e) (not (vector? e))) (or (and (symbol? (first e)) - (= "expect" (name (first e)))) + (str/starts-with? (name (first e)) "expect")) (some contains-expect? e)))) (defmacro defexpect diff --git a/test/expectations/clojure/test_test.cljc b/test/expectations/clojure/test_test.cljc index 0b28ed6..dd15ff7 100644 --- a/test/expectations/clojure/test_test.cljc +++ b/test/expectations/clojure/test_test.cljc @@ -1,4 +1,4 @@ -;; copyright (c) 2019-2023 sean corfield, all rights reserved +;; copyright (c) 2019-2024 sean corfield, all rights reserved (ns expectations.clojure.test-test "Test the testing framework -- this is sometimes harder than you might think! @@ -126,19 +126,19 @@ (is-not' (sut/expect {:foo 1} (in {:foo 2 :cat 4})) (not= {:foo 1} {:foo 2})) ;; TODO: need better tests here - (deftest grouping-more-more-of-from-each - (sut/expecting "numeric behavior" - (sut/expect (more-of {:keys [a b]} - even? a - odd? b) - {:a (* 2 13) :b (* 3 13)}) - (sut/expect pos? (* -3 -5))) - (sut/expecting "string behavior" - (sut/expect (more #"foo" "foobar" #(str/starts-with? % "f")) - (str "f" "oobar")) - (sut/expect #"foo" - (from-each [s ["l" "d" "bar"]] - (str "foo" s)))))) +(deftest grouping-more-more-of-from-each + (sut/expecting "numeric behavior" + (sut/expect (more-of {:keys [a b]} + even? a + odd? b) + {:a (* 2 13) :b (* 3 13)}) + (sut/expect pos? (* -3 -5))) + (sut/expecting "string behavior" + (sut/expect (more #"foo" "foobar" #(str/starts-with? % "f")) + (str "f" "oobar")) + (sut/expect #"foo" + (from-each [s ["l" "d" "bar"]] + (str "foo" s)))))) (deftest more-evals-once (let [counter (atom 1)]