@ -28,6 +28,17 @@ func TestTranslations(t *testing.T) {
LtCSFieldString string
LteCSFieldString string
RequiredIf string
RequiredUnless string
RequiredWith string
RequiredWithAll string
RequiredWithout string
RequiredWithoutAll string
ExcludedIf string
ExcludedUnless string
ExcludedWith string
ExcludedWithAll string
ExcludedWithout string
ExcludedWithoutAll string
}
type Test struct {
@ -36,6 +47,18 @@ func TestTranslations(t *testing.T) {
RequiredNumber int ` validate:"required" `
RequiredMultiple [ ] string ` validate:"required" `
RequiredIf string ` validate:"required_if=Inner.RequiredIf abcd" `
RequiredUnless string ` validate:"required_unless=Inner.RequiredUnless abcd" `
RequiredWith string ` validate:"required_with=Inner.RequiredWith" `
RequiredWithAll string ` validate:"required_with_all=Inner.RequiredWith Inner.RequiredWithAll" `
RequiredWithout string ` validate:"required_without=Inner.RequiredWithout" `
RequiredWithoutAll string ` validate:"required_without_all=Inner.RequiredWithout Inner.RequiredWithoutAll" `
ExcludedIf string ` validate:"excluded_if=Inner.ExcludedIf abcd" `
ExcludedUnless string ` validate:"excluded_unless=Inner.ExcludedUnless abcd" `
ExcludedWith string ` validate:"excluded_with=Inner.ExcludedWith" `
ExcludedWithout string ` validate:"excluded_with_all=Inner.ExcludedWithAll" `
ExcludedWithAll string ` validate:"excluded_without=Inner.ExcludedWithout" `
ExcludedWithoutAll string ` validate:"excluded_without_all=Inner.ExcludedWithoutAll" `
IsDefault string ` validate:"isdefault" `
LenString string ` validate:"len=1" `
LenNumber float64 ` validate:"len=1113.00" `
LenMultiple [ ] string ` validate:"len=7" `
@ -159,6 +182,20 @@ func TestTranslations(t *testing.T) {
test . Inner . EqCSFieldString = "1234"
test . Inner . GtCSFieldString = "1234"
test . Inner . GteCSFieldString = "1234"
test . Inner . RequiredUnless = "1234"
test . Inner . RequiredWith = "1234"
test . Inner . RequiredWithAll = "1234"
test . Inner . ExcludedIf = "abcd"
test . Inner . ExcludedUnless = "1234"
test . Inner . ExcludedWith = "1234"
test . Inner . ExcludedWithAll = "1234"
test . ExcludedIf = "1234"
test . ExcludedUnless = "1234"
test . ExcludedWith = "1234"
test . ExcludedWithAll = "1234"
test . ExcludedWithout = "1234"
test . ExcludedWithoutAll = "1234"
test . MaxString = "1234"
test . MaxNumber = 2000
@ -610,6 +647,50 @@ func TestTranslations(t *testing.T) {
ns : "Test.RequiredMultiple" ,
expected : "RequiredMultiple is a required field" ,
} ,
{
ns : "Test.RequiredUnless" ,
expected : "RequiredUnless is a required field" ,
} ,
{
ns : "Test.RequiredWith" ,
expected : "RequiredWith is a required field" ,
} ,
{
ns : "Test.RequiredWithAll" ,
expected : "RequiredWithAll is a required field" ,
} ,
{
ns : "Test.RequiredWithout" ,
expected : "RequiredWithout is a required field" ,
} ,
{
ns : "Test.RequiredWithoutAll" ,
expected : "RequiredWithoutAll is a required field" ,
} ,
{
ns : "Test.ExcludedIf" ,
expected : "ExcludedIf is an excluded field" ,
} ,
{
ns : "Test.ExcludedUnless" ,
expected : "ExcludedUnless is an excluded field" ,
} ,
{
ns : "Test.ExcludedWith" ,
expected : "ExcludedWith is an excluded field" ,
} ,
{
ns : "Test.ExcludedWithAll" ,
expected : "ExcludedWithAll is an excluded field" ,
} ,
{
ns : "Test.ExcludedWithout" ,
expected : "ExcludedWithout is an excluded field" ,
} ,
{
ns : "Test.ExcludedWithoutAll" ,
expected : "ExcludedWithoutAll is an excluded field" ,
} ,
{
ns : "Test.StrPtrMinLen" ,
expected : "StrPtrMinLen must be at least 10 characters in length" ,