testify/assert
Hisham Akmal 118fb83466
NotSame should fail if args are not pointers #1661 (#1664)
## Summary
Reduces the confusion assosciated with NotSame that previously would
check nothing if any of the values is not a pointer. The changes made
were tested using TestSame, TestNotSame, and Test_samePointers tests,
and the changes did clear the tests.

## Changes
1. Modified samePointers to return another bool value(ok) that would
determine if the 2 values are of pointer type or not, while the returned
"same" bool value would determine if the 2 pointers are same.
2. Modified assert.NotSame to call Fail() if the 2 values are either
i)pointers pointing to the same address or ii)either/both of the values
are not pointers.
3. Modified assert.Same to call Fail() if the 2 values are either
i)pointers not pointing to the same address or ii)either/both of the
values are not pointers.
4. Modified Test_samePointers to handle the new behavior of samePointers
by checking both if the inputs are pointers (ok) and if they point to
the same object (same).

## Motivation
Ensure NotSame accurately verifies pointer sameness by handling
non-pointer inputs explicitly, improving clarity and reducing potential
misuse.

## Related issues
Closes #1661

---------

Co-authored-by: Bracken <abdawson@gmail.com>
2024-10-28 11:08:04 +00:00
..
internal/unsafetests assert: more unsafe.Pointer tests 2023-11-09 16:32:25 +01:00
yaml assert: fix typos in comments 2024-10-04 18:02:45 +03:00
assertion_compare.go Merge pull request #1580 from JohnEndson/master 2024-04-02 09:13:05 +00:00
assertion_compare_test.go Fix time.Time compare 2024-03-29 08:40:17 +03:00
assertion_format.go Review: Expand NotErrorAs func docs 2024-10-04 12:43:45 +02:00
assertion_format.go.tmpl Fix vim-go integration and other editors 2018-02-02 18:39:40 +00:00
assertion_forward.go Review: Expand NotErrorAs func docs 2024-10-04 12:43:45 +02:00
assertion_forward.go.tmpl Fix vim-go integration and other editors 2018-02-02 18:39:40 +00:00
assertion_order.go assert: drop CompareType 2024-03-20 00:47:39 +01:00
assertion_order_test.go add tests for correct msgAndArgs forwarding 2022-02-10 20:09:05 +10:00
assertions.go NotSame should fail if args are not pointers #1661 (#1664) 2024-10-28 11:08:04 +00:00
assertions_test.go NotSame should fail if args are not pointers #1661 (#1664) 2024-10-28 11:08:04 +00:00
doc.go EqualExportedValues: Handle nested pointer, slice and map fields (#1379) 2023-05-11 07:42:04 +10:00
errors.go Clean up golint warnings 2014-06-18 09:28:16 -06:00
forward_assertions.go Make _codegen its own module so that its dependencies do not pollute the root modules dependency graph 2019-12-09 10:12:49 -07:00
forward_assertions_test.go Add ErrorContains 2021-01-16 12:32:05 +11:00
http_assertions.go http_assertions: honour the msgAndArgs provided with each assertion 2024-02-23 00:16:29 +05:30
http_assertions_test.go http_assertions: assert that the msgAndArgs actually works in tests 2024-02-23 22:41:24 +05:30