(match matcher)
Takes in a matcher and returns a checker that asserts that the provided value satisfies the matcher
Takes in a matcher and returns a checker that asserts that the provided value satisfies the matcher
match but using strict equals
matching behavior for maps, even nested ones.
match but using strict `equals` matching behavior for maps, even nested ones.
match where all numbers match if they are within the delta of their expected value
match where all numbers match if they are within the delta of their expected value
(match-with & args)
Validates that the provided values satisfies the matcher but uses the provided type->matcher map to redefine the default matchers used for the specified types.
By default when the system sees a number, it applies
the equals
matcher to it. So if, for example, we want to
match ints by their absolute value, we could do this:
(defn abs-value-matcher [expected]
(core/->PredMatcher
(fn [actual] (= (Math/abs expected)
(Math/abs actual)))
(str "equal to abs value of " expected)))
(match-with [int? abs-value-matcher])
NOTE: currently doesn't work in midje provided
expressions
Validates that the provided values satisfies the matcher but uses the provided type->matcher map to redefine the default matchers used for the specified types. By default when the system sees a number, it applies the `equals` matcher to it. So if, for example, we want to match ints by their absolute value, we could do this: (defn abs-value-matcher [expected] (core/->PredMatcher (fn [actual] (= (Math/abs expected) (Math/abs actual))) (str "equal to abs value of " expected))) (match-with [int? abs-value-matcher]) NOTE: currently doesn't work in midje `provided` expressions
(throws-match & args)
Takes in a matcher or a matcher and throwable subclass. Returns a checker that asserts an exception was raised and the ex-data within it satisfies the matcher
Takes in a matcher or a matcher and throwable subclass. Returns a checker that asserts an exception was raised and the ex-data within it satisfies the matcher
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close