From 3e98972271b4880bf40bf9c98564fce5bf1879d0 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sun, 11 Feb 2024 11:13:25 -0500 Subject: Add nil pointer check for Nil functions --- check/check_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'check/check_test.go') diff --git a/check/check_test.go b/check/check_test.go index 9c73d52..8c6087e 100644 --- a/check/check_test.go +++ b/check/check_test.go @@ -343,3 +343,14 @@ func TestCheckReturnValues(t *testing.T) { } }) } + +func TestCheckNilForNilPointer(t *testing.T) { + mockT := &cmtest.MockT{} + var value *cmtest.MockT = nil + + passed := Nil(mockT, value) + + if !passed { + t.Fatal("check.Nil should have returned true for nil pointer") + } +} -- cgit v1.2.3