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
14 func TestDomainForAddress(t *testing.T) {
16 address, domain string
18 {"foo@bar.com", "bar.com"},
20 {"abc@one.two.three.four.net", "one.two.three.four.net"},
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)