feat(policy): add ValidWhitelistAddress
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package policy
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestValidWhitelistAddress(t *testing.T) {
|
||||
good := []string{"tk555@protonmail.com", "a.b@sub.example.co.uk", "@example.com", "@sub.example.com"}
|
||||
for _, s := range good {
|
||||
if err := ValidWhitelistAddress(s); err != nil {
|
||||
t.Errorf("ValidWhitelistAddress(%q) = %v, want nil", s, err)
|
||||
}
|
||||
}
|
||||
bad := []string{"", " ", "notanaddress", "@", "@nodot", "a@nodot", "Bob <b@x.com>", "a@b@c.com"}
|
||||
for _, s := range bad {
|
||||
if err := ValidWhitelistAddress(s); err == nil {
|
||||
t.Errorf("ValidWhitelistAddress(%q) = nil, want error", s)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user