v1.13.0
Features
- New operators:
ErrorIs
to check the data is an error and matches a wrapped error (useserrors.Is
behind the scene),First
to find the first matching item of a slice or an array then compare its content,Grep
to reduce a slice or an array before comparing its content,Last
to find the last matching item of a slice or an array then compare its content,Recv
to read from a channel and test value;
- rework of
JSON
parsing:- introduction of raw strings,
- literal
\n
,\r
&\t
accepted in strings, $^Operator(params...)
is possible,"$^Operator(params...)"
is possible,Operator
(without parenthesis) is possible,- accepts
json.RawMessage
;
- anchoring is now possible using
td.A
andtd.Anchor
, the generic versions oftd.T.A
andtd.T.Anchor
; td.Flatten
now accepts an optional function to filter and/or transform the items before flattening them;*td.T
gainsAssert
andRequire
methods, to be consistent with existingtd.Assert
andtd.Require
;- introduce
td.S
function, to produce strings without needingfmt
, shorter to write and following the same calling convention as test names (in other words auto-detectingPrintf
like format); - new
TestDeepInGotOK
config to allow to test go-testdeep operators (is forbidden by default, but useful when go-testdeep is used outside golang tests) includingtd.T.TestDeepInGotOK
method; tdhttp
package:tdhttp.TestAPI
can now test HTTP responses as a whole (CmpResponse
) as well as HTTP trailer (CmpTrailer
),tdhttp.PostForm
andtdhttp.TestAPI.PostForm
now also accepttdhttp.Q
as data.
As usual: enjoy! :)
What's changed in details
- docs(README): v1.12.0 release announce by @maxatome in #212
- fix(doc,tdhttp): typo by @Linkid in #213
- Some refactoring by @maxatome in #214
- docs: fix typo by @maxatome in #215
- Grep, First & Last operators by @maxatome in #216
- refactor: go1.16 required now, so drop support for go1.9 to go1.15 by @maxatome in #221
- feat: add ErrorIs operator by @maxatome in #220
- fix(Recv): timeout can mask expected value by @maxatome in #222
- feat(tdhttp): add TestAPI's CmpResponse & CmpTrailer by @maxatome in #219
- feat: replacing bytes.Buffer instances used only to generate strings with strings.Builder. by @ellisonleao in #224
- feat(JSON): operators possible in JSON strings by @maxatome in #217
- refactor: Replace(a, b, -1) → ReplaceAll(a, b) by @maxatome in #226
- feat: go1.20 introduces slice to array convertibility by @maxatome in #227
- feat(tdhttp): allow usage of tdhttp.Q when using PostForm helpers by @c-roussel in #228
- fix(internal/json): avoid data race by @maxatome in #229
- feat: add TestDeepInGotOK allowing to test td.TestDeep operators by @maxatome in #230
- feat(internal): add (*ctxerr.Error).ErrorWithoutColors method by @maxatome in #231
- feat: add generic functions td.Anchor and td.A, another way to anchor by @maxatome in #232
- ci: test with go1.20 by @maxatome in #233
- style: remove useless comment by @maxatome in #234
- docs: fix README typo by @maxatome in #235
- feat(JSON): accept json.RawMessage as input by @deathiop in #237
- Flatten++ by @maxatome in #236
- chore: cosmetic changes before the release by @maxatome in #238
Full Changelog: v1.12.0...v1.13.0