about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-12-14 01:02:55 +0000
committerEric Wong <e@80x24.org>2019-12-15 19:43:33 +0000
commit01d25810ec9baf643e2a278a0fefdf857bfd3883 (patch)
tree1bfcc07f7d52a7d12c70cc8f6ee81de2fcc697b5 /t
parent2ad19256bc285e40188a9058941883979ff45c86 (diff)
downloadpublic-inbox-01d25810ec9baf643e2a278a0fefdf857bfd3883.tar.gz
Some users will set their From: headers in the form of:
"<user@example.com> (A U Thor)", where their name is in
the parenthesized comment.  Use that instead of the
email address, if available.
Diffstat (limited to 't')
-rw-r--r--t/address.t7
1 files changed, 4 insertions, 3 deletions
diff --git a/t/address.t b/t/address.t
index bea45daa..2a287102 100644
--- a/t/address.t
+++ b/t/address.t
@@ -14,8 +14,9 @@ is_deeply(['user@example.com'],
         'comment after domain accepted before >');
 
 my @names = PublicInbox::Address::names(
-        'User <e@e>, e@e, "John A. Doe" <j@d>, <x@x>');
-is_deeply(['User', 'e', 'John A. Doe', 'x'], \@names,
+        'User <e@e>, e@e, "John A. Doe" <j@d>, <x@x>, <y@x> (xyz), '.
+        'U Ser <u@x> (do not use)');
+is_deeply(\@names, ['User', 'e', 'John A. Doe', 'x', 'xyz', 'U Ser'],
         'name extraction works as expected');
 
 @names = PublicInbox::Address::names('"user@example.com" <user@example.com>');
@@ -25,7 +26,7 @@ is_deeply(['user'], \@names, 'address-as-name extraction works as expected');
 {
         my $backwards = 'u@example.com (John Q. Public)';
         @names = PublicInbox::Address::names($backwards);
-        is_deeply(\@names, ['u'], 'backwards name OK');
+        is_deeply(\@names, ['John Q. Public'], 'backwards name OK');
         my @emails = PublicInbox::Address::emails($backwards);
         is_deeply(\@emails, ['u@example.com'], 'backwards emails OK');
 }