File: invalid.t

package info (click to toggle)
libemail-address-list-perl 0.05-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 240 kB
  • sloc: perl: 1,582; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 763 bytes parent folder | download | duplicates (5)
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
use strict; use warnings;
use Test::More tests => 4;
use_ok 'Email::Address::List';

run_test('root', [{type => 'unknown', value => 'root'}]);
run_test(
    'boo@boo, root, foo@foo',
    [
        {type => 'mailbox', value => 'boo@boo', obsolete => 0, not_ascii => 0},
        {type => 'unknown', value => 'root'},
        {type => 'mailbox', value => 'foo@foo', obsolete => 0, not_ascii => 0},
    ],
);
run_test(
    '"Doe, John" foo@foo, root',
    [
        {type => 'unknown', value => '"Doe, John" foo@foo' },
        {type => 'unknown', value => 'root'},
    ],
);

sub run_test {
    my $line = shift;
    my @list = Email::Address::List->parse($line);
    $_->{'value'} .= '' foreach grep defined $_->{'value'}, @list;
    is_deeply( \@list, shift );
}