File: 02-emailaddresses.t

package info (click to toggle)
libmoosex-types-email-perl 0.009-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 296 kB
  • sloc: perl: 226; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 595 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use strict;
use warnings;
use Test::More tests => 3;
use Test::Deep;

use MooseX::Types::Email qw/EmailAddresses/;

ok(
    EmailAddresses->check([ 'bobtfish@bobtfish.net', 'foo@bar.com' ]),
    'bobtfish@bobtfish.net and foo@bar.com are an ok list of email addresses',
);

like(
    EmailAddresses->validate([ 'foo@bar.com', 'wob' ]),
    qr/be an arrayref of valid e-mail addresses/,
    'validation fails, as "wob" is not a valid email',
);

cmp_deeply(
    EmailAddresses->coerce('foo@bar.com'),
    [ 'foo@bar.com' ],
    'a single email address can be coerced to a list of addresses',
);