Email-MIME-RFC2047

 view release on metacpan or  search on metacpan

t/decode.t  view on Meta::CPAN

    '=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=', 'ab',
    '=?ISO-8859-1?Q?a?=  =?ISO-8859-1?Q?b?=', 'ab',
    "=?ISO-8859-1?Q?a?=\n    =?ISO-8859-1?Q?b?=", 'ab',
    '=?ISO-8859-1?Q?a_b?=', 'a b',
    '=?ISO-8859-1?Q?a?= =?ISO-8859-2?Q?_b?=', 'a b',
);

for (my $i=0; $i<@tests; $i+=2) {
    my ($encoded, $expect) = ($tests[$i], $tests[$i+1]);

    my $decoded = $decoder->decode_phrase($encoded);
    is($decoded, $expect, "decode_phrase $encoded");
}

t/encode-decode.t  view on Meta::CPAN

    # supplementary plane
    "\x{1F44D}", '=?utf-8?Q?=f0=9f=91=8d?=', undef,
);

for (my $i=0; $i<@tests; $i+=3) {
    my ($string, $expect_text, $expect_phrase) =
        ($tests[$i], $tests[$i+1], $tests[$i+2]);
    $expect_text = $string if !defined($expect_text);
    $expect_phrase = $expect_text if !defined($expect_phrase);

    my $decoded;
    my $normalized = $string;
    $normalized =~ s/[ \t\r\n]+/ /g;
    $normalized =~ s/^[ \t\r\n]+//;
    $normalized =~ s/[ \t\r\n]+\z//;

    my $text = $encoder->encode_text($string);
    is($text, $expect_text, "encode_text $string");
    $decoded = $decoder->decode_text($text);
    is($decoded, $normalized, "decode_text $text");

    my $phrase = $encoder->encode_phrase($string);
    is($phrase, $expect_phrase, "encode_phrase $string");
    $decoded = $decoder->decode_phrase($phrase);
    is($decoded, $normalized, "decode_phrase $phrase");
}



( run in 0.485 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )