File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,12 +16,7 @@ func CatchMatches(r, expect any) bool {
1616 return false
1717 }
1818
19- // Special case: the symbol "any" catches everything (for go/any)
20- if sym , ok := expect .(* Symbol ); ok && sym .Name () == "any" {
21- return true
22- }
23-
24- // If expect is an error type, check if r is an instance of it
19+ // if expect is an error type, check if r is an instance of it
2520 if rErr , ok := r .(error ); ok {
2621 if expectTyp , ok := expect .(reflect.Type ); ok && expectTyp .Implements (errorType ) {
2722 expectVal := reflect .New (expectTyp ).Elem ().Interface ().(error )
@@ -31,15 +26,5 @@ func CatchMatches(r, expect any) bool {
3126 }
3227 }
3328
34- // General type check
35- if expectTyp , ok := expect .(reflect.Type ); ok {
36- return reflect .TypeOf (r ).AssignableTo (expectTyp )
37- }
38-
39- // For interface{} type (go/any), catch everything
40- if expectTyp , ok := expect .(reflect.Type ); ok && expectTyp .Kind () == reflect .Interface && expectTyp .NumMethod () == 0 {
41- return true
42- }
43-
44- return false
45- }
29+ return reflect .TypeOf (r ).AssignableTo (expect .(reflect.Type ))
30+ }
You can’t perform that action at this time.
0 commit comments