@@ -116,19 +116,19 @@ func isCustomEqual(a, b reflect.Value) (bool, bool) {
116116}
117117
118118func deepValueEqual (ctx ctxerr.Context , got , expected reflect.Value ) (err * ctxerr.Error ) {
119+ // "got" must not implement testDeeper
120+ if got .IsValid () && got .Type ().Implements (testDeeper ) {
121+ panic (color .Bad ("Found a TestDeep operator in got param, " +
122+ "can only use it in expected one!" ))
123+ }
124+
119125 if ! got .IsValid () || ! expected .IsValid () {
120126 if got .IsValid () == expected .IsValid () {
121127 return
122128 }
123129 return nilHandler (ctx , got , expected )
124130 }
125131
126- // "got" must not implement testDeeper
127- if got .Type ().Implements (testDeeper ) {
128- panic (color .Bad ("Found a TestDeep operator in got param, " +
129- "can only use it in expected one!" ))
130- }
131-
132132 // Check if a Smuggle hook matches got type
133133 if handled , e := ctx .Hooks .Smuggle (& got ); handled {
134134 if e != nil {
@@ -308,19 +308,6 @@ func deepValueEqual(ctx ctxerr.Context, got, expected reflect.Value) (err *ctxer
308308 return
309309
310310 case reflect .Interface :
311- if got .IsNil () || expected .IsNil () {
312- if got .IsNil () == expected .IsNil () {
313- return
314- }
315- if ctx .BooleanError {
316- return ctxerr .BooleanError
317- }
318- return ctx .CollectError (& ctxerr.Error {
319- Message : "nil interface" ,
320- Got : isNilStr (got .IsNil ()),
321- Expected : isNilStr (expected .IsNil ()),
322- })
323- }
324311 return deepValueEqual (ctx , got .Elem (), expected .Elem ())
325312
326313 case reflect .Ptr :
0 commit comments