EqualButNotSame asserts that expected and actual objects are not the same. It recursively checks all fields to ensure that no pointers are shared. If a pointer, slice or map are nil in either object, the test fails.
(t *testing.T, expected, actual any)
| 11 | // It recursively checks all fields to ensure that no pointers are shared. |
| 12 | // If a pointer, slice or map are nil in either object, the test fails. |
| 13 | func EqualButNotSame(t *testing.T, expected, actual any) { |
| 14 | t.Helper() |
| 15 | |
| 16 | expectedVal := reflect.ValueOf(expected) |
| 17 | actualVal := reflect.ValueOf(actual) |
| 18 | |
| 19 | deepEqual(t, expectedVal, actualVal, "") |
| 20 | } |
| 21 | |
| 22 | // deepEqual recursively verifies that all values are equal but pointers are different |
| 23 | // except for the Expires field which is explicitly allowed to be shared |
nothing calls this directly
no test coverage detected