File: quoting.t

package info (click to toggle)
libemail-address-perl 1.895-1%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 452 kB
  • sloc: perl: 276; makefile: 9
file content (38 lines) | stat: -rw-r--r-- 845 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!perl
use strict;

use Email::Address;
use Test::More tests => 6;

my $phrase = q{jack!work};
my $email  = 'jack@work.com';

my $ea = Email::Address->new($phrase, $email);

is(
  $ea->format,
  q{"jack!work" <jack@work.com>},
  'we automatically quote a phrase with ! in it',
);

is($ea->phrase, $phrase, "the phrase method returns the right thing");

my ($ea2) = Email::Address->parse($ea->format);

is(
  $ea2->format,
  q{"jack!work" <jack@work.com>},
  'round trip format the previously parsed email',
);

is($ea2->phrase, $phrase, "the phrase method returns the right thing");

my ($ea3) = Email::Address->parse(q{jack!work <jack@work.com>});

is(
  $ea3->format,
  q{"jack!work" <jack@work.com>},
  'given an email with an unquoted !, we quote when formatting',
);

is($ea3->phrase, $phrase, "the phrase method returns the right thing");