Compare compares two objects and returns and error if they are not the same.
(a, b T)
| 74 | |
| 75 | // Compare compares two objects and returns and error if they are not the same. |
| 76 | func Compare[T any](a, b T) error { |
| 77 | if !cmp.Equal(a, b, opts(a)...) { |
| 78 | return fmt.Errorf("found diff: %v\nLeft: %v\nRight: %v", cmp.Diff(a, b, opts(a)...), a, b) |
| 79 | } |
| 80 | return nil |
| 81 | } |
| 82 | |
| 83 | // Equal compares two objects and fails if they are not the same. |
| 84 | func Equal[T any](t test.Failer, a, b T, context ...string) { |
searching dependent graphs…