All notable changes to this project will be documented in this file. This change log follows the conventions of keepachangelog.com.
- fix bug using
within-delta
nested inmatch-with
where expected value is a list
- adapt
utils/within-delta?
to accept BigDecimal asdelta
argument
- eliminate cljs warnings
- add within-delta matcher (replaces match-roughly)
- add match-with matcher #134
- also reimplemented match-with?, match-roughly? etc in terms of match-with
- the overrides map now supports predicates as keys
- deprecate
match-with?
,match-equals?
,match-roughly?
assert expressions - deprecate
match-with
,match-equals
, andmatch-roughly
midje checkers
;; With this release, do this:
(match? (matchers/match-with [map? matchers/equals] <expected>) <actual>)
;; instead of this (deprecated, but still works)
(match-with? {clojure.lang.IPersistentMap matchers/equals} <expected> <actual>)
(match-equals? <expected> <actual>)
;; and this
(match? (matchers/within-delta <delta> <expected>) <actual>)
;; or this
(is (match? (matchers/match-with [number? (matchers/within-delta <delta>)]
<expected>)
<actual>))
;; instead of this
(match-roughly? <delta> <expected> <actual>)
We removed matcher-combinators.utils/match-roughly
in 3.0.0. If you were
using it, you should use matcher-combinators.matchers/within-delta
instead. We've documented matcher-combinators.utils
as "Internal use
only." for clarification.
- fix issue matching
false
in the context of sets #124
- extend
Matcher
protocol toSymbol
in cljs #131
- add
matchers/matcher-for
#123 - use set matching logic for
java.util.Set
#125 - add
core/indicates-match?
and deprecatecore/match?
core/match?
is mostly for internal use and occasionally used to build match? fns in other libraries
matcher-combinators-2.0.0 includes a breaking change for custom implementations of the
matcher-combinators.core/Matcher
protocol:
- change the implementation of
match
to-match
(required) - add an implementation of
-matcher-for
(optional, but recommended)- should just return
this
e.g. `(-matcher-for [this] this)
- should just return
- fix double eval of
clojure.test
match-equals?
arguments
- refactor macro to align w/ Clojure docs (no behavioural change)
- Implement default equality matching for objects. If classes don't explicity
implement the
match
protocol, they now default to using equality matching.
- add
matcher-combinators.standalone/match
(test-framework independent)
- add arglist for cljtest assert expressions
Add new matching context for clojure.test:
match-roughly?
: Matches all numerics as long as they are within a given delta of the expected.
- Optionally allow omitting the first argument to
thrown-match?
:(thrown-match? {:foo 1} (bang!)
- replace
+'
with+
and-'
with-
in roughly matching - Default to
equals
matcher for array-seq
- Default to
equals
matcher for chunked-sequences
- Default to
equals
matcher for URIs
- Fix performance regression with order-agnostic matchers (
in-any-order
,embeds
,set-{embeds|equals}
)
- Fix clojurescript import issue
No such namespace: clojure.test
- Fix issue where clojure.test mismatches wouldn't report the correct line number or file
Add new matching contexts: For Midje:
match-with
: takes a class->matcher map and an expected matcher. The map defines what matcher will be used by default when a particular class instance is found.match-equals
: Allows for exact matching of datastructures by using theequals
matcher instead ofembeds
for maps.match-roughly
: Matches all numerics as long as they are within a given delta of the expected.
For clojure.test
:
match-with?
: same as the midje version abovematch-equals?
: same as the midje version above As well asmatcher-combinator.test/build-match-assert
to help build new matcher contexts
- Improve cider + cursive integration by using
:fail
, which is the standard inclojure.test
for reporting mismatches. Thanks to Arne Brasseur (@plexus) for implementation
- Provide clearer message on incorrect arg count to
match?
andthrown-match?
-
[BREAKING] When a record is in the
expected
position of the matcher, theactual
value must be a record of the same type.Previous behavior would match if the
actual
was a map with the same keys, or a record of a different type with the same keys
- matcher for asserting absence of key
- fix cljs related warning in math.combinatorics
- fix compatibility issue with shadow-cljs
- fix slow matching behavior for
in-any-order
/embeds
- declare
match?
to help avoid linters removing require
- parser support for java classes
- clojurescript support
- parser support for vars
- implement
throws-match
(midje) andthrown-match?
(clojure.test) exception handling matchers
- parser support for shorts
- parser support for byte-arrays
- parser support for LocalTime
- multiple-arity fix for standalone matching api
- api for using matching logic as a yes/no predicate, without access to mismatch info
- fix typo in spec that causes errors when spec checking is enabled
- make
in-any-order
choose smallest mismatch when same number of matchers one level down fail.
- fix for
embeds
sequence matching where some matches weren't found
- fix to get project working with cljdoc
- regexes are now interpreted as matchers
- fix issue where sequence mismatch was reported in reverse order (#39)
- fix issue matching core clojure sequence types like Repeat (#26)
- fix issue where a 'missing' was showing as a 'mismatch'
- namespace the custom
:mismatch
directive forclojure.test
reporting
- add default parser for Integer and Float
- make mismatches for sets and the
prefix
matcher more informative
- fix issue when matching in the presence of midje metaconstants
- fix issue matching empty sets
- implement default matcher parser for sets
- stop using
boolean?
which is only in clojure 1.9
- BREAKING:
- rename
equals-map
,equals-seq
, andequals-value
to all beequals
and do dispatch based on type - rename
sublist
toprefix
- rename
subset
sequence matcher to beembeds
- rename
contains-map
toembeds
and make it do dispatch based on type
- rename
- implement matchers for sets:
equals
andembeds
as well asset-equals
andset-embeds
which allow one to use sequences to match sets, skirting the issue that a set matcher of form#{odd? odd?}
will reduce to#{odd?}
.
- Adapt
in-any-order
to print diff for element ordering that leads to most direct matches - When matcher is provided with incorrect input, cause matcher to fail, but don't raise exception
- Fix issue where
in-any-order
operating over a list with several identical matchers failed - Extend
nil
to be interpreted asequals-value
by parser - Include needed dependencies outside of
:dev
profile - Make mismatch output preserve sequence type
- Interpret Double as
matcher-combinators.matchers/equals-value
in parser. - Make Midje checker fail correctly when passed a non-matcher
- Don't define
matcher-combinators.midje/matcher
as a macro; it isn't needed
- Allow inline use of
match
inside ofmidje
provided
forms
- Update parser to interpret lists as equals-seq matcher-combinators
- Fix
subset
issue where order of elements effected behavior
- Project init