Same asserts that two pointers reference the same object. assert.Same(t, ptr1, ptr2) Both arguments must be pointer variables. Pointer variable sameness is determined based on the equality of both type and value.
(t TestingT, expected, actual interface{}, msgAndArgs ...interface{})
| 496 | // Both arguments must be pointer variables. Pointer variable sameness is |
| 497 | // determined based on the equality of both type and value. |
| 498 | func Same(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { |
| 499 | if h, ok := t.(tHelper); ok { |
| 500 | h.Helper() |
| 501 | } |
| 502 | |
| 503 | if !samePointers(expected, actual) { |
| 504 | return Fail(t, fmt.Sprintf("Not same: \n"+ |
| 505 | "expected: %p %#v\n"+ |
| 506 | "actual : %p %#v", expected, expected, actual, actual), msgAndArgs...) |
| 507 | } |
| 508 | |
| 509 | return true |
| 510 | } |
| 511 | |
| 512 | // NotSame asserts that two pointers do not reference the same object. |
| 513 | // |
searching dependent graphs…