diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-12-28 08:51:39 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-12-28 08:51:39 +0100 |
| commit | f9e22d62304f5c83fb98d2618d93ba715227048e (patch) | |
| tree | 8ac1a5d2eb78c5002a273ebbb1d4072670997d5b /pkg/email/parser_test.go | |
| parent | 7d240098d863e389e2fc6f1bc2240ea4e78a7afe (diff) | |
pkg/email: don't add <> to email when name is empty
Just unnecessary clutter.
Diffstat (limited to 'pkg/email/parser_test.go')
| -rw-r--r-- | pkg/email/parser_test.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pkg/email/parser_test.go b/pkg/email/parser_test.go index 2341fc385..ed4a76f27 100644 --- a/pkg/email/parser_test.go +++ b/pkg/email/parser_test.go @@ -81,6 +81,24 @@ func TestAddRemoveAddrContext(t *testing.T) { } } +func TestAddAddrContextEmptyName(t *testing.T) { + email := "<foo@bar.com>" + email1, err := AddAddrContext(email, "context") + if err != nil { + t.Fatal(err) + } + if want := "foo+context@bar.com"; want != email1 { + t.Fatalf("want: %q, got %q", want, email1) + } + email2, context1, err := RemoveAddrContext(email1) + if email != email2 { + t.Fatalf("want: %q, got %q", email, email2) + } + if context1 != "context" { + t.Fatalf("got context %q", context1) + } +} + func TestCanonicalEmail(t *testing.T) { canonical := "foo@bar.com" emails := []string{ |
