dotenv, parsing fix email, moved dump tracnsport to new file gz, removed unwanted var jwt, added in HS256 sign/parse
ptr, ref and deref funcs response, use fmt.Fprint(f) validate, few new funcs
This commit is contained in:
30
validate/validate_test.go
Normal file
30
validate/validate_test.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package validate
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestStruct(t *testing.T) {
|
||||
type person struct {
|
||||
FirstName string `validate:"required,max=10"`
|
||||
LastName string `validate:"required"`
|
||||
Email string `validate:"email"`
|
||||
}
|
||||
|
||||
var p *person
|
||||
t.Log("check for nil value")
|
||||
if err := Struct(p); err == nil {
|
||||
t.Fatal("nil value must report and error")
|
||||
} else {
|
||||
t.Log(err.Error())
|
||||
}
|
||||
|
||||
p = new(person)
|
||||
t.Log("validation checks")
|
||||
if err := Struct(p); err == nil {
|
||||
t.Error(err)
|
||||
} else {
|
||||
t.Log(err)
|
||||
}
|
||||
|
||||
// Structure error string
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user