diff options
author | Eric Wong <e@80x24.org> | 2016-06-25 07:19:10 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-06-25 09:38:31 +0000 |
commit | 18011be3dbfecb3abe4bea8cdf7f0ee7dfa2f8be (patch) | |
tree | 40738a8ad7af8423c06546c1cd78afe696d21396 /t/address.t | |
parent | 8f5c76542fe6e0b78095c3a748fd10dd01a714ef (diff) | |
download | public-inbox-18011be3dbfecb3abe4bea8cdf7f0ee7dfa2f8be.tar.gz |
We may remove from_name in the future. ...And disallow quotes in email addresses. Technically I believe they're allowed, but they're definitely uncommon and unlikely to show up in legitimate mail.
Diffstat (limited to 't/address.t')
-rw-r--r-- | t/address.t | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/t/address.t b/t/address.t new file mode 100644 index 00000000..c488a8ed --- /dev/null +++ b/t/address.t @@ -0,0 +1,21 @@ +# Copyright (C) 2016 all contributors <meta@public-inbox.org> +# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt> +use strict; +use warnings; +use Test::More; +use_ok 'PublicInbox::Address'; + +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)]); + +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, + 'name extraction works as expected'); + + +done_testing; |