]> src.bluestatic.org Git - mailpopbox.git/blob - smtp/server_test.go
Add support for outbound SMTP delivery.
[mailpopbox.git] / smtp / server_test.go
1 package smtp
2
3 import (
4 "net/mail"
5 "testing"
6 )
7
8 func TestDomainForAddress(t *testing.T) {
9 cases := []struct{
10 address, domain string
11 }{
12 {"foo@bar.com", "bar.com"},
13 {"abc", ""},
14 {"abc@one.two.three.four.net", "one.two.three.four.net"},
15 }
16 for i, c := range cases {
17 actual := DomainForAddress(mail.Address{Address: c.address})
18 if actual != c.domain {
19 t.Errorf("case %d, got %q, expected %q", i, actual, c.domain)
20 }
21 }
22 }