@@ -33,8 +33,6 @@ type NoValidateInfo struct {
3333func main () {
3434 log .Println ("starting tests" )
3535
36- allTypes1Tests ()
37- allTypes2Tests ()
3836 structInPkgTests ()
3937 nestedStructTests ()
4038 cmpBetweenInnerFieldsTests ()
@@ -46,85 +44,6 @@ func main() {
4644 log .Println ("finishing tests" )
4745}
4846
49- func allTypes1Tests () {
50- var expectedMsgErrors []string
51- var errs []error
52-
53- v1 := & AllTypes1 {}
54- expectedMsgErrors = []string {
55- "FirstName is required" ,
56- "LastName is required" ,
57- "Age is required" ,
58- }
59- errs = AllTypes1Validate (v1 )
60- if ! expectedMsgErrorsOk (errs , expectedMsgErrors ) {
61- log .Fatalf ("error = %v, wantErr %v" , errs , expectedMsgErrors )
62- }
63-
64- v2 := & AllTypes1 {
65- FirstName : "First" ,
66- LastName : "Last" ,
67- Age : 18 ,
68- }
69- expectedMsgErrors = nil
70- errs = AllTypes1Validate (v2 )
71- if ! expectedMsgErrorsOk (errs , expectedMsgErrors ) {
72- log .Fatalf ("error = %v, wantErr %v" , errs , expectedMsgErrors )
73- }
74-
75- log .Println ("all_types1 tests ok" )
76- }
77-
78- func allTypes2Tests () {
79- var expectedMsgErrors []string
80- var errs []error
81-
82- v1 := & AllTypes2 {
83- FirstName : "" ,
84- LastName : "" ,
85- Age : 135 ,
86- UserName : "abc" ,
87- }
88- expectedMsgErrors = []string {
89- "FirstName is required" ,
90- "LastName is required" ,
91- "Age must be <= 130" ,
92- "UserName length must be >= 5" ,
93- }
94- errs = AllTypes2Validate (v1 )
95- if ! expectedMsgErrorsOk (errs , expectedMsgErrors ) {
96- log .Fatalf ("error = %v, wantErr %v" , errs , expectedMsgErrors )
97- }
98-
99- v2 := & AllTypes2 {
100- FirstName : "First" ,
101- LastName : "Last" ,
102- Age : 49 ,
103- UserName : "mylongusername" ,
104- }
105- expectedMsgErrors = []string {
106- "UserName length must be <= 10" ,
107- }
108- errs = AllTypes2Validate (v2 )
109- if ! expectedMsgErrorsOk (errs , expectedMsgErrors ) {
110- log .Fatalf ("error = %v, wantErr %v" , errs , expectedMsgErrors )
111- }
112-
113- v3 := & AllTypes2 {
114- FirstName : "First" ,
115- LastName : "Last" ,
116- Age : 49 ,
117- UserName : "myusername" ,
118- }
119- expectedMsgErrors = nil
120- errs = AllTypes2Validate (v3 )
121- if ! expectedMsgErrorsOk (errs , expectedMsgErrors ) {
122- log .Fatalf ("error = %v, wantErr %v" , errs , expectedMsgErrors )
123- }
124-
125- log .Println ("all_types2 tests ok" )
126- }
127-
12847func structInPkgTests () {
12948 var expectedMsgErrors []string
13049 var errs []error
0 commit comments