add workspace, validation

This commit is contained in:
Aneurin Barker Snook
2023-10-06 11:58:24 +01:00
commit f41d6f248a
5 changed files with 98 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
package validate
import "testing"
func TestInvalidEmail(t *testing.T) {
valid := []string{
"testexample.com",
}
for _, email := range valid {
if err := Email(email); err == nil {
t.Errorf("%s is not a valid email", email)
}
}
}
func TestValidEmail(t *testing.T) {
valid := []string{
"test@example.com",
}
for _, email := range valid {
if err := Email(email); err != nil {
t.Errorf("%s is a valid email", email)
}
}
}