You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
615 B
Go
35 lines
615 B
Go
package assert_test
|
|
|
|
import (
|
|
"errors"
|
|
"git.noahlan.cn/noahlan/ntool/ntest/assert"
|
|
"testing"
|
|
)
|
|
|
|
func TestCommon(t *testing.T) {
|
|
assert.Nil(t, nil)
|
|
assert.False(t, false)
|
|
assert.True(t, true)
|
|
}
|
|
|
|
func TestErr(t *testing.T) {
|
|
err := errors.New("this is a error")
|
|
// assert2.EqualError(t, err, "user custom message")
|
|
assert.Err(t, err, "user custom message")
|
|
assert.ErrMsg(t, err, "this is a error")
|
|
}
|
|
|
|
func TestContains(t *testing.T) {
|
|
str := "abc+123"
|
|
assert.StrContains(t, str, "123")
|
|
}
|
|
|
|
func TestEq(t *testing.T) {
|
|
str := "abc"
|
|
|
|
assert.Eq(t, "abc", str)
|
|
assert.Panics(t, func() {
|
|
panic("hh")
|
|
})
|
|
}
|