From 90b301570768c53f97c8c8704da949f78efcc45b Mon Sep 17 00:00:00 2001 From: v_ljtli Date: Mon, 15 May 2023 11:26:44 +0800 Subject: [PATCH] edit test --- validator_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/validator_test.go b/validator_test.go index 26bcfbfcc..f988c026d 100644 --- a/validator_test.go +++ b/validator_test.go @@ -8,6 +8,7 @@ import ( "encoding/base64" "encoding/json" "fmt" + "math" "os" "path/filepath" "reflect" @@ -5579,10 +5580,11 @@ func TestOneOfValidation(t *testing.T) { errs := validate.Var(spec.f, spec.t) AssertError(t, errs, "", "", "", "", "oneof") } - + f := 3.14 + _, frac := math.Modf(f) PanicMatches(t, func() { - _ = validate.Var(3.14, "oneof=red green") - }, "Bad field type float64") + _ = validate.Var(f, "oneof=red green") + }, fmt.Sprintf("The float %v has a fractional part of %v.\n", f, frac)) } func TestBase64Validation(t *testing.T) {