1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 18:37:05 +00:00

add new ':email' path parameter and revert the jsoniter removal

This commit is contained in:
Gerasimos (Makis) Maropoulos
2021-10-13 16:22:22 +03:00
parent a9b97e005a
commit bf54d33a3e
15 changed files with 179 additions and 101 deletions

View File

@@ -448,6 +448,42 @@ func TestUUIDEvaluatorRaw(t *testing.T) {
}
}
func TestMailEvaluatorRaw(t *testing.T) {
tests := []struct {
pass bool
input string
}{
{true, "kataras2006@hotmail.com"}, // 0
{true, "iris-go@outlook.com"}, // 1
{true, "iris-go@mail"}, // 2
{true, "kataras@k.c"}, // 3
{false, "www.kataras@"}, // 4
{false, "name"}, // 5
{false, "b-c@"}, // 6
}
for i, tt := range tests {
testEvaluatorRaw(t, Mail, tt.input, reflect.String, tt.pass, i)
}
}
func TestEmailEvaluatorRaw(t *testing.T) {
tests := []struct {
pass bool
input string
}{
{true, "kataras2006@hotmail.com"}, // 0
{true, "iris-go@outlook.com"}, // 1
{false, "iris-go@mail"}, // 2
{false, "kataras@k.c"}, // 3
{false, "www.kataras@"}, // 4
{false, "name"}, // 5
{false, "b-c@"}, // 6
}
for i, tt := range tests {
testEvaluatorRaw(t, Email, tt.input, reflect.String, tt.pass, i)
}
}
func TestConvertBuilderFunc(t *testing.T) {
fn := func(min uint64, slice []string) func(string) bool {
return func(paramValue string) bool {