aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/mail/message_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/mail/message_test.go')
-rw-r--r--src/pkg/mail/message_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/pkg/mail/message_test.go b/src/pkg/mail/message_test.go
index c3ec236816..731a748ede 100644
--- a/src/pkg/mail/message_test.go
+++ b/src/pkg/mail/message_test.go
@@ -198,3 +198,30 @@ func TestAddressParsing(t *testing.T) {
}
}
}
+
+func TestAddressFormatting(t *testing.T) {
+ tests := []struct {
+ addr *Address
+ exp string
+ }{
+ {
+ &Address{Address: "bob@example.com"},
+ "<bob@example.com>",
+ },
+ {
+ &Address{Name: "Bob", Address: "bob@example.com"},
+ `"Bob" <bob@example.com>`,
+ },
+ {
+ // note the ö (o with an umlaut)
+ &Address{Name: "Böb", Address: "bob@example.com"},
+ `=?utf-8?q?B=C3=B6b?= <bob@example.com>`,
+ },
+ }
+ for _, test := range tests {
+ s := test.addr.String()
+ if s != test.exp {
+ t.Errorf("Address%+v.String() = %v, want %v", *test.addr, s, test.exp)
+ }
+ }
+}