test(Assert): add new tests for separate Nil NilPtr NotNil NotNilPtr and fix broken ones

This commit is contained in:
2024-10-27 02:08:47 +02:00
parent bfca1b5de0
commit f50717c815

View File

@@ -12,22 +12,38 @@ func Test_notNil(t *testing.T) {
NotNil(something) NotNil(something)
}) })
Testing.AssertPanic(t, func() {
NotNilPtr(something)
})
somethingElse := make([]int, 5) somethingElse := make([]int, 5)
Testing.AssertNotPanic(t, func() { Testing.AssertNotPanic(t, func() {
NotNil(&somethingElse) NotNil(&somethingElse)
}) })
Testing.AssertNotPanic(t, func() {
NotNilPtr(&somethingElse)
})
} }
func Test_nil(t *testing.T) { func Test_nil(t *testing.T) {
var something *interface{} var something *interface{}
Testing.AssertNotPanic(t, func() { Testing.AssertPanic(t, func() {
Nil(something) Nil(something)
}) })
Testing.AssertNotPanic(t, func() {
NilPtr(something)
})
somethingElse := make([]int, 5) somethingElse := make([]int, 5)
Testing.AssertPanic(t, func() { Testing.AssertPanic(t, func() {
Nil(&somethingElse) Nil(&somethingElse)
}) })
Testing.AssertPanic(t, func() {
NilPtr(&somethingElse)
})
} }
func Test_assert(t *testing.T) { func Test_assert(t *testing.T) {