diff options
Diffstat (limited to 'src/pkg/net/mail/message_test.go')
-rw-r--r-- | src/pkg/net/mail/message_test.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/pkg/net/mail/message_test.go b/src/pkg/net/mail/message_test.go index 3c037f383..eb9c8cbdc 100644 --- a/src/pkg/net/mail/message_test.go +++ b/src/pkg/net/mail/message_test.go @@ -8,6 +8,7 @@ import ( "bytes" "io/ioutil" "reflect" + "strings" "testing" "time" ) @@ -116,6 +117,14 @@ func TestDateParsing(t *testing.T) { } } +func TestAddressParsingError(t *testing.T) { + const txt = "=?iso-8859-2?Q?Bogl=E1rka_Tak=E1cs?= <unknown@gmail.com>" + _, err := ParseAddress(txt) + if err == nil || !strings.Contains(err.Error(), "charset not supported") { + t.Errorf(`mail.ParseAddress(%q) err: %q, want ".*charset not supported.*"`, txt, err) + } +} + func TestAddressParsing(t *testing.T) { tests := []struct { addrsStr string @@ -277,6 +286,14 @@ func TestAddressFormatting(t *testing.T) { &Address{Name: "Böb", Address: "bob@example.com"}, `=?utf-8?q?B=C3=B6b?= <bob@example.com>`, }, + { + &Address{Name: "Bob Jane", Address: "bob@example.com"}, + `"Bob Jane" <bob@example.com>`, + }, + { + &Address{Name: "Böb Jacöb", Address: "bob@example.com"}, + `=?utf-8?q?B=C3=B6b_Jac=C3=B6b?= <bob@example.com>`, + }, } for _, test := range tests { s := test.addr.String() |