diff --git a/td/equal.go b/td/equal.go index 7a611ad2..1445fdbe 100644 --- a/td/equal.go +++ b/td/equal.go @@ -140,16 +140,9 @@ func deepValueEqual(ctx ctxerr.Context, got, expected reflect.Value) (err *ctxer expected = op } - if !got.IsValid() || !expected.IsValid() { - if got.IsValid() == expected.IsValid() { - return - } - return nilHandler(ctx, got, expected) - } - - // Check if a Smuggle hook matches got type - if handled, e := ctx.Hooks.Smuggle(&got); handled { - if e != nil { + if got.IsValid() { + // Check if a Smuggle hook matches got type + if handled, e := ctx.Hooks.Smuggle(&got); handled && e != nil { // ctx.BooleanError is always false here as hooks cannot be set globally return ctx.CollectError(&ctxerr.Error{ Message: e.Error(), @@ -159,6 +152,13 @@ func deepValueEqual(ctx ctxerr.Context, got, expected reflect.Value) (err *ctxer } } + if !got.IsValid() || !expected.IsValid() { + if got.IsValid() == expected.IsValid() { + return + } + return nilHandler(ctx, got, expected) + } + // Check if a Cmp hook matches got & expected types if handled, e := ctx.Hooks.Cmp(got, expected); handled { if e == nil { diff --git a/td/t_hooks.go b/td/t_hooks.go index e85e8679..8126ca1e 100644 --- a/td/t_hooks.go +++ b/td/t_hooks.go @@ -16,8 +16,8 @@ import ( // Each function in fns has to be a function with the following // possible signatures: // -// func (got A, expected A) bool -// func (got A, expected A) error +// func (got, expected A) bool +// func (got, expected A) error // // First arg is always got, and second is always expected. //