From 0ed241403f11b532726cba505cbcd9bbf68e049d Mon Sep 17 00:00:00 2001 From: aoright <102943475+aoright@users.noreply.github.com> Date: Wed, 19 Aug 2026 13:29:50 +0800 Subject: [PATCH] assert: add nil pointer test cases to TestNotSame Signed-off-by: aoright <102943475+aoright@users.noreply.github.com> --- assert/assertions_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/assert/assertions_test.go b/assert/assertions_test.go index 11642e096..6545300e6 100644 --- a/assert/assertions_test.go +++ b/assert/assertions_test.go @@ -679,6 +679,15 @@ func TestNotSame(t *testing.T) { if !NotSame(mockT, 1, 1) { t.Error("NotSame should return true; constant inputs") } + if NotSame(mockT, (*int)(nil), (*int)(nil)) { + t.Error("NotSame should return false; same nil pointers") + } + if !NotSame(mockT, (*int)(nil), ptr(1)) { + t.Error("NotSame should return true; nil and non-nil pointers") + } + if !NotSame(mockT, (*int)(nil), (*string)(nil)) { + t.Error("NotSame should return true; different nil pointer types") + } p := ptr(2) if !NotSame(mockT, p, *p) { t.Error("NotSame should return true; mixed-type inputs")