From ce4ce74c8d741677f75d2b0ef295bfe778db5b60 Mon Sep 17 00:00:00 2001 From: flycash Date: Sat, 6 Jun 2020 20:43:59 +0800 Subject: [PATCH] Fix validation test --- config/json.go | 2 +- validation/validation_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/json.go b/config/json.go index 9d12d4ad..c4ef25cd 100644 --- a/config/json.go +++ b/config/json.go @@ -98,7 +98,7 @@ func (c *JSONConfigContainer) Int(key string) (int, error) { } else if v, ok := val.(string); ok { return strconv.Atoi(v) } - return 0, errors.New("not int value") + return 0, errors.New("not valid value") } return 0, errors.New("not exist key:" + key) } diff --git a/validation/validation_test.go b/validation/validation_test.go index bae48d37..845bed67 100644 --- a/validation/validation_test.go +++ b/validation/validation_test.go @@ -381,8 +381,8 @@ func TestValid(t *testing.T) { if len(valid.Errors) != 1 { t.Fatalf("valid errors len should be 1 but got %d", len(valid.Errors)) } - if valid.Errors[0].Key != "Age.Range" { - t.Errorf("Message key should be `Name.Match` but got %s", valid.Errors[0].Key) + if valid.Errors[0].Key != "Age.Range." { + t.Errorf("Message key should be `Age.Range` but got %s", valid.Errors[0].Key) } }