A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cljdoc.org/d/lambdaisland/kaocha/CURRENT/doc/-clojure-test-assertion-extensions below:

Website Navigation


`clojure.test` assertion extensions — lambdaisland/kaocha 1.91.1392

clojure.test assertion extensions

\When running clojure.test based tests through Kaocha, some of the behavior is a little different. Kaocha tries to detect certain scenarios that are likely mistakes which make a test pass trivially, and turns them into errors so you can investigate and see what's up.

Kaocha will also render failures differently, and provides extra multimethods to influence how certain failures are presented.

Detecting missing assertions
(ns sample-test
  (:require [clojure.test :refer :all]))

(deftest my-test
  (= 4 5))
FAIL in sample-test/my-test (sample_test.clj:4)
Test ran without assertions. Did you forget an (is ...)?
Detecting single argument =
(ns sample-test
  (:require [clojure.test :refer :all]))

(deftest my-test
  (is (= 4) 5))
FAIL in sample-test/my-test (sample_test.clj:5)
Equality assertion expects 2 or more values to compare, but only 1 arguments given.
Expected:
  (= 4 arg2)
Actual:
  (= 4)
1 tests, 1 assertions, 1 failures.
Pretty printed diffs
(ns sample-test
  (:require [clojure.test :refer :all]))

(defn my-fn []
  {:xxx [1 2 3]
   :blue :red
   "hello" {:world :!}})

(deftest my-test
  (is (= {:xxx [1 3 4]
          "hello" {:world :?}}
         {:xxx [1 2 3]
          :blue :red
          "hello" {:world :!}})))
FAIL in sample-test/my-test (sample_test.clj:10)
Expected:
  {"hello" {:world :?}, :xxx [1 3 4]}
Actual:
  {"hello" {:world -:? +:!}, :xxx [1 +2 3 -4], +:blue :red}
1 tests, 1 assertions, 1 failures.

Can you improve this documentation? These fine people already did:
Arne Brasseur & Emlyn Corrin
Edit on GitHub


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4