30 lines
639 B
Go
30 lines
639 B
Go
// Package define ...
|
|
//
|
|
// Description : define ...
|
|
//
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
//
|
|
// Date : 2025-01-24 15:46
|
|
package define
|
|
|
|
import (
|
|
"errors"
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
"testing"
|
|
)
|
|
|
|
func TestIsErr(t *testing.T) {
|
|
Convey("传入error为nil", t, func() {
|
|
isErrRes := IsErr(nil, "")
|
|
So(isErrRes, ShouldBeFalse)
|
|
})
|
|
Convey("传入error为test类型", t, func() {
|
|
isErrRes := IsErr(errors.New("aaatestbbb"), "test")
|
|
So(isErrRes, ShouldBeTrue)
|
|
})
|
|
Convey("传入error非test类型", t, func() {
|
|
isErrRes := IsErr(errors.New("aaatecccstbbb"), "test")
|
|
So(isErrRes, ShouldBeFalse)
|
|
})
|
|
}
|