Equal compares two objects and fails if they are not the same.
(t test.Failer, a, b T, context ...string)
| 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) { |
| 85 | t.Helper() |
| 86 | if !cmp.Equal(a, b, opts(a)...) { |
| 87 | cs := "" |
| 88 | if len(context) > 0 { |
| 89 | cs = " " + strings.Join(context, ", ") + ":" |
| 90 | } |
| 91 | t.Fatalf("found diff:%s %v\nLeft: %v\nRight: %v", cs, cmp.Diff(a, b, opts(a)...), a, b) |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | // EventuallyEqual compares repeatedly calls the fetch function until the result matches the expectation. |
| 96 | func EventuallyEqual[T any](t test.Failer, fetch func() T, expected T, retryOpts ...retry.Option) { |
searching dependent graphs…