Improved error messages

This commit is contained in:
Eduard Urbach 2023-07-10 11:36:17 +02:00
parent 2b28627e58
commit 7ab2ff6627
Signed by: eduard
GPG key ID: 49226B848C78F6C8
7 changed files with 46 additions and 43 deletions

View file

@ -1,4 +1,3 @@
package assert_test
import (
@ -8,18 +7,31 @@ import (
)
func TestNil(t *testing.T) {
var nilPointer *T
var nilSlice []byte
var (
nilPointer *T
nilInterface any
nilSlice []byte
nilMap map[byte]byte
nilChannel chan byte
nilFunction func()
)
assert.Nil(t, nil)
assert.Nil(t, nilPointer)
assert.Nil(t, nilInterface)
assert.Nil(t, nilSlice)
assert.Nil(t, nilMap)
assert.Nil(t, nilChannel)
assert.Nil(t, nilFunction)
}
func TestNotNil(t *testing.T) {
assert.NotNil(t, 0)
assert.NotNil(t, "Hello")
assert.NotNil(t, []byte{})
assert.NotNil(t, T{})
assert.NotNil(t, &T{})
assert.NotNil(t, make([]byte, 0))
assert.NotNil(t, make(map[byte]byte))
assert.NotNil(t, make(chan byte))
assert.NotNil(t, TestNotNil)
}