NotSame asserts that two pointers do not reference the same object. assert.NotSame(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{})
| 559 | // Both arguments must be pointer variables. Pointer variable sameness is |
| 560 | // determined based on the equality of both type and value. |
| 561 | func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { |
| 562 | if h, ok := t.(tHelper); ok { |
| 563 | h.Helper() |
| 564 | } |
| 565 | |
| 566 | same, ok := samePointers(expected, actual) |
| 567 | if !ok { |
| 568 | // fails when the arguments are not pointers |
| 569 | return !(Fail(t, "Both arguments must be pointers", msgAndArgs...)) |
| 570 | } |
| 571 | |
| 572 | if same { |
| 573 | return Fail(t, fmt.Sprintf( |
| 574 | "Expected and actual point to the same object: %p %#[1]v", |
| 575 | expected), msgAndArgs...) |
| 576 | } |
| 577 | return true |
| 578 | } |
| 579 | |
| 580 | // samePointers checks if two generic interface objects are pointers of the same |
| 581 | // type pointing to the same object. It returns two values: same indicating if |
searching dependent graphs…