|
|
@ -31,115 +31,129 @@ func TestTranslations(t *testing.T) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type Test struct { |
|
|
|
type Test struct { |
|
|
|
Inner Inner |
|
|
|
Inner Inner |
|
|
|
RequiredString string `validate:"required"` |
|
|
|
RequiredString string `validate:"required"` |
|
|
|
RequiredNumber int `validate:"required"` |
|
|
|
RequiredNumber int `validate:"required"` |
|
|
|
RequiredMultiple []string `validate:"required"` |
|
|
|
RequiredMultiple []string `validate:"required"` |
|
|
|
LenString string `validate:"len=1"` |
|
|
|
LenString string `validate:"len=1"` |
|
|
|
LenNumber float64 `validate:"len=1113.00"` |
|
|
|
LenNumber float64 `validate:"len=1113.00"` |
|
|
|
LenMultiple []string `validate:"len=7"` |
|
|
|
LenMultiple []string `validate:"len=7"` |
|
|
|
MinString string `validate:"min=1"` |
|
|
|
MinString string `validate:"min=1"` |
|
|
|
MinNumber float64 `validate:"min=1113.00"` |
|
|
|
MinNumber float64 `validate:"min=1113.00"` |
|
|
|
MinMultiple []string `validate:"min=7"` |
|
|
|
MinMultiple []string `validate:"min=7"` |
|
|
|
MaxString string `validate:"max=3"` |
|
|
|
MaxString string `validate:"max=3"` |
|
|
|
MaxNumber float64 `validate:"max=1113.00"` |
|
|
|
MaxNumber float64 `validate:"max=1113.00"` |
|
|
|
MaxMultiple []string `validate:"max=7"` |
|
|
|
MaxMultiple []string `validate:"max=7"` |
|
|
|
EqString string `validate:"eq=3"` |
|
|
|
EqString string `validate:"eq=3"` |
|
|
|
EqNumber float64 `validate:"eq=2.33"` |
|
|
|
EqNumber float64 `validate:"eq=2.33"` |
|
|
|
EqMultiple []string `validate:"eq=7"` |
|
|
|
EqMultiple []string `validate:"eq=7"` |
|
|
|
NeString string `validate:"ne="` |
|
|
|
NeString string `validate:"ne="` |
|
|
|
NeNumber float64 `validate:"ne=0.00"` |
|
|
|
NeNumber float64 `validate:"ne=0.00"` |
|
|
|
NeMultiple []string `validate:"ne=0"` |
|
|
|
NeMultiple []string `validate:"ne=0"` |
|
|
|
LtString string `validate:"lt=3"` |
|
|
|
LtString string `validate:"lt=3"` |
|
|
|
LtNumber float64 `validate:"lt=5.56"` |
|
|
|
LtNumber float64 `validate:"lt=5.56"` |
|
|
|
LtMultiple []string `validate:"lt=2"` |
|
|
|
LtMultiple []string `validate:"lt=2"` |
|
|
|
LtTime time.Time `validate:"lt"` |
|
|
|
LtTime time.Time `validate:"lt"` |
|
|
|
LteString string `validate:"lte=3"` |
|
|
|
LteString string `validate:"lte=3"` |
|
|
|
LteNumber float64 `validate:"lte=5.56"` |
|
|
|
LteNumber float64 `validate:"lte=5.56"` |
|
|
|
LteMultiple []string `validate:"lte=2"` |
|
|
|
LteMultiple []string `validate:"lte=2"` |
|
|
|
LteTime time.Time `validate:"lte"` |
|
|
|
LteTime time.Time `validate:"lte"` |
|
|
|
GtString string `validate:"gt=3"` |
|
|
|
GtString string `validate:"gt=3"` |
|
|
|
GtNumber float64 `validate:"gt=5.56"` |
|
|
|
GtNumber float64 `validate:"gt=5.56"` |
|
|
|
GtMultiple []string `validate:"gt=2"` |
|
|
|
GtMultiple []string `validate:"gt=2"` |
|
|
|
GtTime time.Time `validate:"gt"` |
|
|
|
GtTime time.Time `validate:"gt"` |
|
|
|
GteString string `validate:"gte=3"` |
|
|
|
GteString string `validate:"gte=3"` |
|
|
|
GteNumber float64 `validate:"gte=5.56"` |
|
|
|
GteNumber float64 `validate:"gte=5.56"` |
|
|
|
GteMultiple []string `validate:"gte=2"` |
|
|
|
GteMultiple []string `validate:"gte=2"` |
|
|
|
GteTime time.Time `validate:"gte"` |
|
|
|
GteTime time.Time `validate:"gte"` |
|
|
|
EqFieldString string `validate:"eqfield=MaxString"` |
|
|
|
EqFieldString string `validate:"eqfield=MaxString"` |
|
|
|
EqCSFieldString string `validate:"eqcsfield=Inner.EqCSFieldString"` |
|
|
|
EqCSFieldString string `validate:"eqcsfield=Inner.EqCSFieldString"` |
|
|
|
NeCSFieldString string `validate:"necsfield=Inner.NeCSFieldString"` |
|
|
|
NeCSFieldString string `validate:"necsfield=Inner.NeCSFieldString"` |
|
|
|
GtCSFieldString string `validate:"gtcsfield=Inner.GtCSFieldString"` |
|
|
|
GtCSFieldString string `validate:"gtcsfield=Inner.GtCSFieldString"` |
|
|
|
GteCSFieldString string `validate:"gtecsfield=Inner.GteCSFieldString"` |
|
|
|
GteCSFieldString string `validate:"gtecsfield=Inner.GteCSFieldString"` |
|
|
|
LtCSFieldString string `validate:"ltcsfield=Inner.LtCSFieldString"` |
|
|
|
LtCSFieldString string `validate:"ltcsfield=Inner.LtCSFieldString"` |
|
|
|
LteCSFieldString string `validate:"ltecsfield=Inner.LteCSFieldString"` |
|
|
|
LteCSFieldString string `validate:"ltecsfield=Inner.LteCSFieldString"` |
|
|
|
NeFieldString string `validate:"nefield=EqFieldString"` |
|
|
|
NeFieldString string `validate:"nefield=EqFieldString"` |
|
|
|
GtFieldString string `validate:"gtfield=MaxString"` |
|
|
|
GtFieldString string `validate:"gtfield=MaxString"` |
|
|
|
GteFieldString string `validate:"gtefield=MaxString"` |
|
|
|
GteFieldString string `validate:"gtefield=MaxString"` |
|
|
|
LtFieldString string `validate:"ltfield=MaxString"` |
|
|
|
LtFieldString string `validate:"ltfield=MaxString"` |
|
|
|
LteFieldString string `validate:"ltefield=MaxString"` |
|
|
|
LteFieldString string `validate:"ltefield=MaxString"` |
|
|
|
AlphaString string `validate:"alpha"` |
|
|
|
AlphaString string `validate:"alpha"` |
|
|
|
AlphanumString string `validate:"alphanum"` |
|
|
|
AlphanumString string `validate:"alphanum"` |
|
|
|
NumericString string `validate:"numeric"` |
|
|
|
AlphanumUnicodeString string `validate:"alphanumunicode"` |
|
|
|
NumberString string `validate:"number"` |
|
|
|
AlphaUnicodeString string `validate:"alphaunicode"` |
|
|
|
HexadecimalString string `validate:"hexadecimal"` |
|
|
|
NumericString string `validate:"numeric"` |
|
|
|
HexColorString string `validate:"hexcolor"` |
|
|
|
NumberString string `validate:"number"` |
|
|
|
RGBColorString string `validate:"rgb"` |
|
|
|
HexadecimalString string `validate:"hexadecimal"` |
|
|
|
RGBAColorString string `validate:"rgba"` |
|
|
|
HexColorString string `validate:"hexcolor"` |
|
|
|
HSLColorString string `validate:"hsl"` |
|
|
|
RGBColorString string `validate:"rgb"` |
|
|
|
HSLAColorString string `validate:"hsla"` |
|
|
|
RGBAColorString string `validate:"rgba"` |
|
|
|
Email string `validate:"email"` |
|
|
|
HSLColorString string `validate:"hsl"` |
|
|
|
URL string `validate:"url"` |
|
|
|
HSLAColorString string `validate:"hsla"` |
|
|
|
URI string `validate:"uri"` |
|
|
|
E164 string `validate:"e164"` |
|
|
|
Base64 string `validate:"base64"` |
|
|
|
Email string `validate:"email"` |
|
|
|
Contains string `validate:"contains=purpose"` |
|
|
|
URL string `validate:"url"` |
|
|
|
ContainsAny string `validate:"containsany=!@#$"` |
|
|
|
URI string `validate:"uri"` |
|
|
|
Excludes string `validate:"excludes=text"` |
|
|
|
Base64 string `validate:"base64"` |
|
|
|
ExcludesAll string `validate:"excludesall=!@#$"` |
|
|
|
Contains string `validate:"contains=purpose"` |
|
|
|
ExcludesRune string `validate:"excludesrune=☻"` |
|
|
|
ContainsAny string `validate:"containsany=!@#$"` |
|
|
|
ISBN string `validate:"isbn"` |
|
|
|
ContainsRune string `validate:"containsrune=☻"` |
|
|
|
ISBN10 string `validate:"isbn10"` |
|
|
|
Excludes string `validate:"excludes=text"` |
|
|
|
ISBN13 string `validate:"isbn13"` |
|
|
|
ExcludesAll string `validate:"excludesall=!@#$"` |
|
|
|
UUID string `validate:"uuid"` |
|
|
|
ExcludesRune string `validate:"excludesrune=☻"` |
|
|
|
UUID3 string `validate:"uuid3"` |
|
|
|
EndsWith string `validate:"endswith=end"` |
|
|
|
UUID4 string `validate:"uuid4"` |
|
|
|
StartsWith string `validate:"startswith=start"` |
|
|
|
UUID5 string `validate:"uuid5"` |
|
|
|
ISBN string `validate:"isbn"` |
|
|
|
ULID string `validate:"ulid"` |
|
|
|
ISBN10 string `validate:"isbn10"` |
|
|
|
ASCII string `validate:"ascii"` |
|
|
|
ISBN13 string `validate:"isbn13"` |
|
|
|
PrintableASCII string `validate:"printascii"` |
|
|
|
UUID string `validate:"uuid"` |
|
|
|
MultiByte string `validate:"multibyte"` |
|
|
|
UUID3 string `validate:"uuid3"` |
|
|
|
DataURI string `validate:"datauri"` |
|
|
|
UUID4 string `validate:"uuid4"` |
|
|
|
Latitude string `validate:"latitude"` |
|
|
|
UUID5 string `validate:"uuid5"` |
|
|
|
Longitude string `validate:"longitude"` |
|
|
|
ULID string `validate:"ulid"` |
|
|
|
SSN string `validate:"ssn"` |
|
|
|
ASCII string `validate:"ascii"` |
|
|
|
IP string `validate:"ip"` |
|
|
|
PrintableASCII string `validate:"printascii"` |
|
|
|
IPv4 string `validate:"ipv4"` |
|
|
|
MultiByte string `validate:"multibyte"` |
|
|
|
IPv6 string `validate:"ipv6"` |
|
|
|
DataURI string `validate:"datauri"` |
|
|
|
CIDR string `validate:"cidr"` |
|
|
|
Latitude string `validate:"latitude"` |
|
|
|
CIDRv4 string `validate:"cidrv4"` |
|
|
|
Longitude string `validate:"longitude"` |
|
|
|
CIDRv6 string `validate:"cidrv6"` |
|
|
|
SSN string `validate:"ssn"` |
|
|
|
TCPAddr string `validate:"tcp_addr"` |
|
|
|
IP string `validate:"ip"` |
|
|
|
TCPAddrv4 string `validate:"tcp4_addr"` |
|
|
|
IPv4 string `validate:"ipv4"` |
|
|
|
TCPAddrv6 string `validate:"tcp6_addr"` |
|
|
|
IPv6 string `validate:"ipv6"` |
|
|
|
UDPAddr string `validate:"udp_addr"` |
|
|
|
CIDR string `validate:"cidr"` |
|
|
|
UDPAddrv4 string `validate:"udp4_addr"` |
|
|
|
CIDRv4 string `validate:"cidrv4"` |
|
|
|
UDPAddrv6 string `validate:"udp6_addr"` |
|
|
|
CIDRv6 string `validate:"cidrv6"` |
|
|
|
IPAddr string `validate:"ip_addr"` |
|
|
|
TCPAddr string `validate:"tcp_addr"` |
|
|
|
IPAddrv4 string `validate:"ip4_addr"` |
|
|
|
TCPAddrv4 string `validate:"tcp4_addr"` |
|
|
|
IPAddrv6 string `validate:"ip6_addr"` |
|
|
|
TCPAddrv6 string `validate:"tcp6_addr"` |
|
|
|
UinxAddr string `validate:"unix_addr"` // can't fail from within Go's net package currently, but maybe in the future
|
|
|
|
UDPAddr string `validate:"udp_addr"` |
|
|
|
MAC string `validate:"mac"` |
|
|
|
UDPAddrv4 string `validate:"udp4_addr"` |
|
|
|
IsColor string `validate:"iscolor"` |
|
|
|
UDPAddrv6 string `validate:"udp6_addr"` |
|
|
|
StrPtrMinLen *string `validate:"min=10"` |
|
|
|
IPAddr string `validate:"ip_addr"` |
|
|
|
StrPtrMaxLen *string `validate:"max=1"` |
|
|
|
IPAddrv4 string `validate:"ip4_addr"` |
|
|
|
StrPtrLen *string `validate:"len=2"` |
|
|
|
IPAddrv6 string `validate:"ip6_addr"` |
|
|
|
StrPtrLt *string `validate:"lt=1"` |
|
|
|
UinxAddr string `validate:"unix_addr"` // can't fail from within Go's net package currently, but maybe in the future
|
|
|
|
StrPtrLte *string `validate:"lte=1"` |
|
|
|
MAC string `validate:"mac"` |
|
|
|
StrPtrGt *string `validate:"gt=10"` |
|
|
|
IsColor string `validate:"iscolor"` |
|
|
|
StrPtrGte *string `validate:"gte=10"` |
|
|
|
StrPtrMinLen *string `validate:"min=10"` |
|
|
|
OneOfString string `validate:"oneof=red green"` |
|
|
|
StrPtrMaxLen *string `validate:"max=1"` |
|
|
|
OneOfInt int `validate:"oneof=5 63"` |
|
|
|
StrPtrLen *string `validate:"len=2"` |
|
|
|
Datetime string `validate:"datetime=2006-01-02"` |
|
|
|
StrPtrLt *string `validate:"lt=1"` |
|
|
|
|
|
|
|
StrPtrLte *string `validate:"lte=1"` |
|
|
|
|
|
|
|
StrPtrGt *string `validate:"gt=10"` |
|
|
|
|
|
|
|
StrPtrGte *string `validate:"gte=10"` |
|
|
|
|
|
|
|
OneOfString string `validate:"oneof=red green"` |
|
|
|
|
|
|
|
OneOfInt int `validate:"oneof=5 63"` |
|
|
|
|
|
|
|
UniqueSlice []string `validate:"unique"` |
|
|
|
|
|
|
|
UniqueArray [3]string `validate:"unique"` |
|
|
|
|
|
|
|
UniqueMap map[string]string `validate:"unique"` |
|
|
|
|
|
|
|
JSONString string `validate:"json"` |
|
|
|
|
|
|
|
JWTString string `validate:"jwt"` |
|
|
|
|
|
|
|
LowercaseString string `validate:"lowercase"` |
|
|
|
|
|
|
|
UppercaseString string `validate:"uppercase"` |
|
|
|
|
|
|
|
Datetime string `validate:"datetime=2006-01-02"` |
|
|
|
|
|
|
|
BooleanString string `validate:"boolean"` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var test Test |
|
|
|
var test Test |
|
|
@ -170,6 +184,8 @@ func TestTranslations(t *testing.T) { |
|
|
|
|
|
|
|
|
|
|
|
test.AlphaString = "abc3" |
|
|
|
test.AlphaString = "abc3" |
|
|
|
test.AlphanumString = "abc3!" |
|
|
|
test.AlphanumString = "abc3!" |
|
|
|
|
|
|
|
test.AlphanumUnicodeString = "abc3啊!" |
|
|
|
|
|
|
|
test.AlphaUnicodeString = "abc3啊" |
|
|
|
test.NumericString = "12E.00" |
|
|
|
test.NumericString = "12E.00" |
|
|
|
test.NumberString = "12E" |
|
|
|
test.NumberString = "12E" |
|
|
|
|
|
|
|
|
|
|
@ -177,6 +193,9 @@ func TestTranslations(t *testing.T) { |
|
|
|
test.ExcludesAll = "This is Great!" |
|
|
|
test.ExcludesAll = "This is Great!" |
|
|
|
test.ExcludesRune = "Love it ☻" |
|
|
|
test.ExcludesRune = "Love it ☻" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test.EndsWith = "this is some test text" |
|
|
|
|
|
|
|
test.StartsWith = "this is some test text" |
|
|
|
|
|
|
|
|
|
|
|
test.ASCII = "カタカナ" |
|
|
|
test.ASCII = "カタカナ" |
|
|
|
test.PrintableASCII = "カタカナ" |
|
|
|
test.PrintableASCII = "カタカナ" |
|
|
|
|
|
|
|
|
|
|
@ -186,7 +205,16 @@ func TestTranslations(t *testing.T) { |
|
|
|
test.StrPtrMaxLen = &s |
|
|
|
test.StrPtrMaxLen = &s |
|
|
|
test.StrPtrLen = &s |
|
|
|
test.StrPtrLen = &s |
|
|
|
|
|
|
|
|
|
|
|
test.Datetime = "2008-Feb-01" |
|
|
|
test.JSONString = "{\"foo\":\"bar\",}" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test.LowercaseString = "ABCDEFG" |
|
|
|
|
|
|
|
test.UppercaseString = "abcdefg" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test.UniqueSlice = []string{"1234", "1234"} |
|
|
|
|
|
|
|
test.UniqueMap = map[string]string{"key1": "1234", "key2": "1234"} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test.Datetime = "20060102" |
|
|
|
|
|
|
|
test.BooleanString = "A" |
|
|
|
|
|
|
|
|
|
|
|
err = validate.Struct(test) |
|
|
|
err = validate.Struct(test) |
|
|
|
NotEqual(t, err, nil) |
|
|
|
NotEqual(t, err, nil) |
|
|
@ -326,6 +354,14 @@ func TestTranslations(t *testing.T) { |
|
|
|
ns: "Test.ISBN13", |
|
|
|
ns: "Test.ISBN13", |
|
|
|
expected: "ISBN13必須是一個有效的ISBN-13編號", |
|
|
|
expected: "ISBN13必須是一個有效的ISBN-13編號", |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ns: "Test.EndsWith", |
|
|
|
|
|
|
|
expected: "EndsWith必須以文本'end'結尾", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ns: "Test.StartsWith", |
|
|
|
|
|
|
|
expected: "StartsWith必須以文本'start'開頭", |
|
|
|
|
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
ns: "Test.Excludes", |
|
|
|
ns: "Test.Excludes", |
|
|
|
expected: "Excludes不能包含文字'text'", |
|
|
|
expected: "Excludes不能包含文字'text'", |
|
|
@ -338,6 +374,10 @@ func TestTranslations(t *testing.T) { |
|
|
|
ns: "Test.ExcludesRune", |
|
|
|
ns: "Test.ExcludesRune", |
|
|
|
expected: "ExcludesRune不能包含'☻'", |
|
|
|
expected: "ExcludesRune不能包含'☻'", |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ns: "Test.ContainsRune", |
|
|
|
|
|
|
|
expected: "ContainsRune必須包含字元'☻'", |
|
|
|
|
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
ns: "Test.ContainsAny", |
|
|
|
ns: "Test.ContainsAny", |
|
|
|
expected: "ContainsAny必須包含至少一個以下字元'!@#$'", |
|
|
|
expected: "ContainsAny必須包含至少一個以下字元'!@#$'", |
|
|
@ -350,6 +390,10 @@ func TestTranslations(t *testing.T) { |
|
|
|
ns: "Test.Base64", |
|
|
|
ns: "Test.Base64", |
|
|
|
expected: "Base64必須是一個有效的Base64字元串", |
|
|
|
expected: "Base64必須是一個有效的Base64字元串", |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ns: "Test.E164", |
|
|
|
|
|
|
|
expected: "E164必須是一個有效的E.164手機號", |
|
|
|
|
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
ns: "Test.Email", |
|
|
|
ns: "Test.Email", |
|
|
|
expected: "Email必須是一個有效的信箱", |
|
|
|
expected: "Email必須是一個有效的信箱", |
|
|
@ -394,6 +438,14 @@ func TestTranslations(t *testing.T) { |
|
|
|
ns: "Test.NumericString", |
|
|
|
ns: "Test.NumericString", |
|
|
|
expected: "NumericString必須是一個有效的數值", |
|
|
|
expected: "NumericString必須是一個有效的數值", |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ns: "Test.AlphaUnicodeString", |
|
|
|
|
|
|
|
expected: "AlphaUnicodeString只能包含字母和Unicode字元", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ns: "Test.AlphanumUnicodeString", |
|
|
|
|
|
|
|
expected: "AlphanumUnicodeString只能包含字母數字和Unicode字元", |
|
|
|
|
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
ns: "Test.AlphanumString", |
|
|
|
ns: "Test.AlphanumString", |
|
|
|
expected: "AlphanumString只能包含字母和數字", |
|
|
|
expected: "AlphanumString只能包含字母和數字", |
|
|
@ -622,9 +674,41 @@ func TestTranslations(t *testing.T) { |
|
|
|
ns: "Test.OneOfInt", |
|
|
|
ns: "Test.OneOfInt", |
|
|
|
expected: "OneOfInt必須是[5 63]中的一個", |
|
|
|
expected: "OneOfInt必須是[5 63]中的一個", |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ns: "Test.UniqueSlice", |
|
|
|
|
|
|
|
expected: "UniqueSlice字段內的值必須唯一", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ns: "Test.UniqueArray", |
|
|
|
|
|
|
|
expected: "UniqueArray字段內的值必須唯一", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ns: "Test.UniqueMap", |
|
|
|
|
|
|
|
expected: "UniqueMap字段內的值必須唯一", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ns: "Test.JSONString", |
|
|
|
|
|
|
|
expected: "JSONString必須是一個有效的JSON字符串", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ns: "Test.JWTString", |
|
|
|
|
|
|
|
expected: "JWTString必須是一個有效的JWT字符串", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ns: "Test.LowercaseString", |
|
|
|
|
|
|
|
expected: "LowercaseString必須是小寫字母", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ns: "Test.UppercaseString", |
|
|
|
|
|
|
|
expected: "UppercaseString必須是大寫字母", |
|
|
|
|
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
ns: "Test.Datetime", |
|
|
|
ns: "Test.Datetime", |
|
|
|
expected: "Datetime與2006-01-02格式不匹配", |
|
|
|
expected: "Datetime的格式必須是2006-01-02", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ns: "Test.BooleanString", |
|
|
|
|
|
|
|
expected: "BooleanString必須是一個有效的布爾值", |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|