]> Sergey Matveev's repositories - public-inbox.git/blob - t/address.t
address: beef up the module with name list extaction
[public-inbox.git] / t / address.t
1 # Copyright (C) 2016 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3 use strict;
4 use warnings;
5 use Test::More;
6 use_ok 'PublicInbox::Address';
7
8 is_deeply([qw(e@example.com e@example.org)],
9         [PublicInbox::Address::emails('User <e@example.com>, e@example.org')],
10         'address extraction works as expected');
11
12 is_deeply([PublicInbox::Address::emails('"ex@example.com" <ex@example.com>')],
13         [qw(ex@example.com)]);
14
15 my @names = PublicInbox::Address::names(
16         'User <e@e>, e@e, "John A. Doe" <j@d>, <x@x>');
17 is_deeply(['User', 'e', 'John A. Doe', 'x'], \@names,
18         'name extraction works as expected');
19
20
21 done_testing;