]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/address.t
public-inbox 1.1.0-pre1
[public-inbox.git] / t / address.t
index 287fcfa05406672ed25df82e6c11f83f2766dc7c..eced5c4632cdea1e86990ac7e594e61acf75c6ab 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2016 all contributors <meta@public-inbox.org>
+# Copyright (C) 2016-2018 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use warnings;
@@ -9,8 +9,9 @@ is_deeply([qw(e@example.com e@example.org)],
        [PublicInbox::Address::emails('User <e@example.com>, e@example.org')],
        'address extraction works as expected');
 
-is_deeply([PublicInbox::Address::emails('"ex@example.com" <ex@example.com>')],
-       [qw(ex@example.com)]);
+is_deeply(['user@example.com'],
+       [PublicInbox::Address::emails('<user@example.com (Comment)>')],
+       'comment after domain accepted before >');
 
 my @names = PublicInbox::Address::names(
        'User <e@e>, e@e, "John A. Doe" <j@d>, <x@x>');
@@ -29,4 +30,8 @@ is_deeply(['user'], \@names, 'address-as-name extraction works as expected');
        is_deeply(\@emails, ['u@example.com'], 'backwards emails OK');
 }
 
+
+@names = PublicInbox::Address::names('"Quote Unneeded" <user@example.com>');
+is_deeply(['Quote Unneeded'], \@names, 'extra quotes dropped');
+
 done_testing;