1package smtpserver
2
3import (
4 "reflect"
5 "testing"
6
7 "github.com/mjl-/mox/dns"
8 "github.com/mjl-/mox/smtp"
9)
10
11func tcompare(t *testing.T, got, exp any) {
12 t.Helper()
13 if !reflect.DeepEqual(got, exp) {
14 t.Fatalf("got %v, expected %v", got, exp)
15 }
16}
17
18func TestParse(t *testing.T) {
19 tcompare(t, newParser("<@hosta.int,@jkl.org:userc@d.bar.org>", false, nil).xpath(), smtp.Path{Localpart: "userc", IPDomain: dns.IPDomain{Domain: dns.Domain{ASCII: "d.bar.org"}}})
20
21 tcompare(t, newParser("e+3Dmc2@example.com", false, nil).xtext(), "e=mc2@example.com")
22 tcompare(t, newParser("", false, nil).xtext(), "")
23}
24