From f50717c8158e41f3d9101460bcead3e41e8ec320 Mon Sep 17 00:00:00 2001 From: Levente Batuska Date: Sun, 27 Oct 2024 02:08:47 +0200 Subject: [PATCH] test(Assert): add new tests for separate Nil NilPtr NotNil NotNilPtr and fix broken ones --- assert/assert_test.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/assert/assert_test.go b/assert/assert_test.go index 09b1eac..fd0cf0a 100644 --- a/assert/assert_test.go +++ b/assert/assert_test.go @@ -12,22 +12,38 @@ func Test_notNil(t *testing.T) { NotNil(something) }) + Testing.AssertPanic(t, func() { + NotNilPtr(something) + }) + somethingElse := make([]int, 5) Testing.AssertNotPanic(t, func() { NotNil(&somethingElse) }) + + Testing.AssertNotPanic(t, func() { + NotNilPtr(&somethingElse) + }) } func Test_nil(t *testing.T) { var something *interface{} - Testing.AssertNotPanic(t, func() { + Testing.AssertPanic(t, func() { Nil(something) }) + Testing.AssertNotPanic(t, func() { + NilPtr(something) + }) + somethingElse := make([]int, 5) Testing.AssertPanic(t, func() { Nil(&somethingElse) }) + + Testing.AssertPanic(t, func() { + NilPtr(&somethingElse) + }) } func Test_assert(t *testing.T) {