diff --git a/CHANGELOG.md b/CHANGELOG.md index c339370..042aa92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ Only accretive/fixative changes will be made from now on. * 2.1.182 -- 2023-09-29 * Improved failure reporting: most failures now provide an additional message describing the failure as well as improving how the expected and actual values are displayed (primarily hiding `=?` and showing a more accurate/intuitive test form). * Update `deps.edn` to use `:main-args` (instead of `:main-opts`) for parameterized tasks in `build.clj` -- see [Running Tasks based on Aliases](https://clojure-doc.org/articles/cookbooks/cli_build_projects/) - * Drop support for Java 8. + * Drop support for Java 8 (it may continue to work but it is no longer tested). * Update dependencies to latest stable versions. * 2.0.165 -- 2023-01-31 diff --git a/doc/collections.md b/doc/collections.md index b35f2d1..ab97273 100644 --- a/doc/collections.md +++ b/doc/collections.md @@ -26,13 +26,15 @@ It's worth noting that the default output from `in` can be somewhat confusing an ;; default output FAIL in () (...:...) - within: (expect {:foo 1} (in {:bar 2})) -expected: (=? e__206__auto__ (clojure.core/select-keys a__203__auto__ (clojure.core/keys e__206__auto__))) - actual: (not (=? {:foo 1} {})) +(in {:bar 2}) + +expected: (expect {:foo 1} (in {:bar 2})) + actual: (not= {:foo 1} {}) ;; with Humane Test Output: FAIL in () (...:...) - within: (expect {:foo 1} (in {:bar 2})) +(in {:bar 2}) + expected: {:foo 1} actual: {} diff: - {:foo 1} diff --git a/doc/fixtures-focus.md b/doc/fixtures-focus.md index c49604b..1779025 100644 --- a/doc/fixtures-focus.md +++ b/doc/fixtures-focus.md @@ -156,7 +156,7 @@ Cognitect's `test-runner` also has an `:includes` option to include only tests m > clojure -X:test :includes '[:negative]' ``` -This run's _only_ tests marked as being `^:negative`. +This runs _only_ tests marked as being `^:negative`. Leiningen's approach uses an additional layer in its `project.clj` file where you specify `:test-selectors` which are labels for predicates that run on the metadata of tests to determine whether to include them or not. Run `lein test help` for details. The equivalent of the above "humane" run would be: diff --git a/doc/getting-started.md b/doc/getting-started.md index 9f4e665..a55ce1a 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -217,13 +217,13 @@ If an expectation on a Spec fails, you get the explanation as well as the standa ;; when run: FAIL in (spec-failure) (...:...) -420 - failed: (< % 100) spec: :small/value +(* 14 30) -expected: (=? :small/value (* 14 30)) - actual: (not (=? :small/value 420)) -``` +val: 420 fails spec: :small/value predicate: (< % 100) -> The `=?` operator appearing here is an Expectations extension to `clojure.test` that provides an "intelligent equality" that supports predicates and Specs, as well as regular value equality. +expected: (s/valid? :small/value (* 14 30)) + actual: (not (s/valid? :small/value 420)) +``` ## Failure Messages @@ -237,7 +237,11 @@ user=> (failure-msg) FAIL in (failure-msg) (...:...) It's uneven! -expected: (=? even? (+ 1 1 1)) +(+ 1 1 1) + +(+ 1 1 1) did not satisfy even? + +expected: (even? (+ 1 1 1)) actual: (not (even? 3)) nil @@ -250,10 +254,12 @@ user=> (spec-failure-msg) FAIL in (spec-failure) (...:...) Too big! -420 - failed: (< % 100) spec: :small/value +(* 14 30) -expected: (=? :small/value (* 14 30)) - actual: (not (=? :small/value 420)) +val: 420 fails spec: :small/value predicate: (< % 100) + +expected: (s/valid? :small/value (* 14 30)) + actual: (not (s/valid? :small/value 420)) nil ;; expecting adds its message too: @@ -269,18 +275,22 @@ user=> (another-spec-failure-msg) FAIL in (another-spec-failure-msg) (...:...) Large number should fail Too big! -420 - failed: (< % 100) spec: :small/value +(* 14 30) + +val: 420 fails spec: :small/value predicate: (< % 100) -expected: (=? :small/value (* 14 30)) - actual: (not (=? :small/value 420)) +expected: (s/valid? :small/value (* 14 30)) + actual: (not (s/valid? :small/value 420)) FAIL in (another-spec-failure-msg) (...:...) Negative number should fail Too small! --420 - failed: pos-int? spec: :small/value +(* -14 30) + +val: -420 fails spec: :small/value predicate: pos-int? -expected: (=? :small/value (* -14 30)) - actual: (not (=? :small/value -420)) +expected: (s/valid? :small/value (* -14 30)) + actual: (not (s/valid? :small/value -420)) nil ``` diff --git a/doc/side-effects.md b/doc/side-effects.md index 5bde669..97bc65c 100644 --- a/doc/side-effects.md +++ b/doc/side-effects.md @@ -55,9 +55,10 @@ Here's the output of running those two tests: user=> (my-code-test-1) FAIL in (my-code-test-1) (...:...) +(side-effects [my-pred println] (my-code 42)) -expected: (=? [[42] ["good"]] (side-effects [my-pred println] (my-code 42))) - actual: (not (=? [[42] ["good"]] [(42) ("bad")])) +expected: (= [[42] ["good"]] (side-effects [my-pred println] (my-code 42))) + actual: (not= [[42] ["good"]] [(42) ("bad")]) nil user=> (my-code-test-2) nil