chore: update common utils (#1908)

This commit is contained in:
boojack
2023-07-06 22:53:38 +08:00
committed by GitHub
parent a7573d5705
commit 0e05c62a3b
30 changed files with 168 additions and 204 deletions

31
common/util/util_test.go Normal file
View File

@ -0,0 +1,31 @@
package util
import (
"testing"
)
func TestValidateEmail(t *testing.T) {
tests := []struct {
email string
want bool
}{
{
email: "t@gmail.com",
want: true,
},
{
email: "@qq.com",
want: false,
},
{
email: "1@gmail",
want: true,
},
}
for _, test := range tests {
result := ValidateEmail(test.email)
if result != test.want {
t.Errorf("Validate Email %s: got result %v, want %v.", test.email, result, test.want)
}
}
}