diff --git a/v10/default_test.go b/v10/default_test.go index 7e77933..4540df0 100644 --- a/v10/default_test.go +++ b/v10/default_test.go @@ -27,6 +27,7 @@ func TestDefaultValidateRuleGenerateFunc(t *testing.T) { ParamList: nil, }) So(err, ShouldBeError) + So(define.IsErr(err, define.ErrValidatorRuleIsEmpty.Error()), ShouldBeTrue) So(res, ShouldBeEmpty) }) Convey("传入规则无参数", t, func() { @@ -43,6 +44,7 @@ func TestDefaultValidateRuleGenerateFunc(t *testing.T) { ParamList: nil, }) So(err, ShouldBeError) + So(define.IsErr(err, define.ErrValidatorRuleParamCntIsTooLess.Error()), ShouldBeTrue) So(res, ShouldEqual, "") }) Convey("传入oneof枚举值构建成功", t, func() { @@ -59,6 +61,7 @@ func TestDefaultValidateRuleGenerateFunc(t *testing.T) { ParamList: []any{}, }) So(err, ShouldNotBeNil) + So(define.IsErr(err, define.ErrValidatorRuleParamCntIsTooLess.Error()), ShouldBeTrue) So(res, ShouldBeEmpty) }) Convey("传入RequiredIf枚举值 -> 参数奇数个", t, func() { @@ -67,6 +70,7 @@ func TestDefaultValidateRuleGenerateFunc(t *testing.T) { ParamList: []any{1, 2, 3}, }) So(err, ShouldNotBeNil) + So(define.IsErr(err, define.ErrValidatorRuleParamCntIsNotEven.Error()), ShouldBeTrue) So(res, ShouldBeEmpty) }) Convey("传入RequiredIf枚举值 -> 构建成功", t, func() {