|
|
@ -144,6 +144,7 @@ func TestTranslations(t *testing.T) { |
|
|
|
JSONString string `validate:"json"` |
|
|
|
JSONString string `validate:"json"` |
|
|
|
LowercaseString string `validate:"lowercase"` |
|
|
|
LowercaseString string `validate:"lowercase"` |
|
|
|
UppercaseString string `validate:"uppercase"` |
|
|
|
UppercaseString string `validate:"uppercase"` |
|
|
|
|
|
|
|
Datetime string `validate:"datetime=2006-01-02"` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var test Test |
|
|
|
var test Test |
|
|
@ -195,6 +196,7 @@ func TestTranslations(t *testing.T) { |
|
|
|
|
|
|
|
|
|
|
|
test.UniqueSlice = []string{"1234", "1234"} |
|
|
|
test.UniqueSlice = []string{"1234", "1234"} |
|
|
|
test.UniqueMap = map[string]string{"key1": "1234", "key2": "1234"} |
|
|
|
test.UniqueMap = map[string]string{"key1": "1234", "key2": "1234"} |
|
|
|
|
|
|
|
test.Datetime = "2008-Feb-01" |
|
|
|
|
|
|
|
|
|
|
|
err = validate.Struct(test) |
|
|
|
err = validate.Struct(test) |
|
|
|
NotEqual(t, err, nil) |
|
|
|
NotEqual(t, err, nil) |
|
|
@ -650,6 +652,10 @@ func TestTranslations(t *testing.T) { |
|
|
|
ns: "Test.UppercaseString", |
|
|
|
ns: "Test.UppercaseString", |
|
|
|
expected: "UppercaseString must be an uppercase string", |
|
|
|
expected: "UppercaseString must be an uppercase string", |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ns: "Test.Datetime", |
|
|
|
|
|
|
|
expected: "Datetime does not match the 2006-01-02 format", |
|
|
|
|
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for _, tt := range tests { |
|
|
|
for _, tt := range tests { |
|
|
|