1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
use Test::More;
use strict;
$^W = 1;
use Email::Address;
my @tests = (
[
[
undef,
'simple@example.com',
undef
],
'simple@example.com',
],
[
[
'John Doe',
'johndoe@example.com',
undef
],
q{"John Doe" <johndoe@example.com>},
],
[
[
q{Name With " Quote},
'nwq@example.com',
undef
],
q{"Name With \\" Quote" <nwq@example.com>},
],
[
[
q{"Name Surrounded With Quotes"},
'foobar@example.com',
undef
],
q{"Name Surrounded With Quotes" <foobar@example.com>},
],
[
[
"",
undef,
undef,
],
'',
],
);
plan tests => scalar @tests;
for (@tests) {
my $addr = Email::Address->new( @{ $_->[0] } );
is( $addr->format, $_->[1], "format: $_->[1]" );
}
|