38 lines
698 B
Go
Raw Permalink Normal View History

2023-07-05 13:46:19 +00:00
package assert_test
import (
"testing"
"git.akyoto.dev/go/assert"
)
func TestNil(t *testing.T) {
2023-07-10 09:36:17 +00:00
var (
nilPointer *T
nilInterface any
nilSlice []byte
nilMap map[byte]byte
nilChannel chan byte
nilFunction func()
)
2023-07-05 13:46:19 +00:00
assert.Nil(t, nil)
assert.Nil(t, nilPointer)
2023-07-10 09:36:17 +00:00
assert.Nil(t, nilInterface)
2023-07-05 13:46:19 +00:00
assert.Nil(t, nilSlice)
2023-07-10 09:36:17 +00:00
assert.Nil(t, nilMap)
assert.Nil(t, nilChannel)
assert.Nil(t, nilFunction)
2023-07-05 13:46:19 +00:00
}
func TestNotNil(t *testing.T) {
assert.NotNil(t, 0)
assert.NotNil(t, "Hello")
assert.NotNil(t, T{})
assert.NotNil(t, &T{})
2023-07-10 09:36:17 +00:00
assert.NotNil(t, make([]byte, 0))
assert.NotNil(t, make(map[byte]byte))
assert.NotNil(t, make(chan byte))
assert.NotNil(t, TestNotNil)
2023-07-05 13:46:19 +00:00
}