Add missing license header to smtp/server_test.go.
[mailpopbox.git] / smtp / server_test.go
1 // mailpopbox
2 // Copyright 2020 Blue Static <https://www.bluestatic.org>
3 // This program is free software licensed under the GNU General Public License,
4 // version 3.0. The full text of the license can be found in LICENSE.txt.
5 // SPDX-License-Identifier: GPL-3.0-only
6
7 package smtp
8
9 import (
10 "net/mail"
11 "testing"
12 )
13
14 func TestDomainForAddress(t *testing.T) {
15 cases := []struct{
16 address, domain string
17 }{
18 {"foo@bar.com", "bar.com"},
19 {"abc", ""},
20 {"abc@one.two.three.four.net", "one.two.three.four.net"},
21 }
22 for i, c := range cases {
23 actual := DomainForAddress(mail.Address{Address: c.address})
24 if actual != c.domain {
25 t.Errorf("case %d, got %q, expected %q", i, actual, c.domain)
26 }
27 }
28 }