mirror of
https://github.com/mjl-/mox.git
synced 2025-07-10 09:54:40 +03:00
mox!
This commit is contained in:
23
smtpserver/parse_test.go
Normal file
23
smtpserver/parse_test.go
Normal file
@ -0,0 +1,23 @@
|
||||
package smtpserver
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/mjl-/mox/dns"
|
||||
"github.com/mjl-/mox/smtp"
|
||||
)
|
||||
|
||||
func tcompare(t *testing.T, got, exp any) {
|
||||
t.Helper()
|
||||
if !reflect.DeepEqual(got, exp) {
|
||||
t.Fatalf("got %v, expected %v", got, exp)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParse(t *testing.T) {
|
||||
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"}}})
|
||||
|
||||
tcompare(t, newParser("e+3Dmc2@example.com", false, nil).xtext(), "e=mc2@example.com")
|
||||
tcompare(t, newParser("", false, nil).xtext(), "")
|
||||
}
|
Reference in New Issue
Block a user