Files

20 lines
483 B
Go
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package validate
import (
"strings"
"testing"
)
func TestMailboxNameShown(t *testing.T) {
for _, ok := range []string{"Ada Lovelace", "José García-Núñez", strings.Repeat("Ana ", 20) + "Lee"} {
if xerr := MailboxNameShown(ok); xerr != nil {
t.Errorf("%q refused: %v", ok, xerr)
}
}
for _, bad := range []string{"Visit evil.example.com", "ada@example.com", "https://x.test", "Ada‮Lee"} {
if MailboxNameShown(bad) == nil {
t.Errorf("%q accepted", bad)
}
}
}