"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "t/quoted-print.t" between
MIME-Base64-3.15.tar.gz and MIME-Base64-3.16.tar.gz

About: MIME-Base64 is a base64 encoder/decoder and a quoted-printable encoder/decoder (Perl module, was part of libwww-perl package). These encoding methods are specified in RFC 2045 - MIME (Multipurpose Internet Mail Extensions).

quoted-print.t  (MIME-Base64-3.15):quoted-print.t  (MIME-Base64-3.16)
use strict;
use warnings;
BEGIN { BEGIN {
if ($ENV{PERL_CORE}) { if ($ENV{PERL_CORE}) {
chdir 't' if -d 't'; chdir 't' if -d 't';
@INC = '../lib'; @INC = '../lib';
} }
} }
use MIME::QuotedPrint; use MIME::QuotedPrint;
$x70 = "x" x 70; my $x70 = "x" x 70;
my $IsASCII = ord('A') == 65;
my $IsEBCDIC = ord('A') == 193;
$IsASCII = ord('A') == 65; my @tests;
$IsEBCDIC = ord('A') == 193;
if ($IsASCII) { if ($IsASCII) {
@tests = @tests =
( (
# plain ascii should not be encoded # plain ascii should not be encoded
["", ""], ["", ""],
["quoted printable" => ["quoted printable" =>
"quoted printable=\n"], "quoted printable=\n"],
skipping to change at line 194 skipping to change at line 199
# trailing whitespace # trailing whitespace
["foo \t ", "foo=40=05=40=\n"], ["foo \t ", "foo=40=05=40=\n"],
["foo\t \n \t", "foo=05=40\n=40=05=\n"], ["foo\t \n \t", "foo=05=40\n=40=05=\n"],
); );
} else { } else {
die sprintf "Unknown character set: ord('A') == %d\n", ord('A'); die sprintf "Unknown character set: ord('A') == %d\n", ord('A');
} }
$notests = @tests + 16; my $notests = @tests + 16;
print "1..$notests\n"; print "1..$notests\n";
$testno = 0; my $testno = 0;
for (@tests) { for (@tests) {
$testno++; $testno++;
($plain, $encoded) = @$_; my ($plain, $encoded) = @$_;
if (ord('A') == 193) { # EBCDIC 8 bit chars are different if (ord('A') == 193) { # EBCDIC 8 bit chars are different
if ($testno == 2) { $plain =~ s/\xe5/\x47/; $plain =~ s/\xe6/\x9c/g; $pl ain =~ s/\xf8/\x70/; } if ($testno == 2) { $plain =~ s/\xe5/\x47/; $plain =~ s/\xe6/\x9c/g; $pl ain =~ s/\xf8/\x70/; }
if ($testno == 7) { $plain =~ s/\xff/\xdf/; } if ($testno == 7) { $plain =~ s/\xff/\xdf/; }
} }
$x = encode_qp($plain); my $x = encode_qp($plain);
if ($x ne $encoded) { if ($x ne $encoded) {
print "Encode test failed\n"; print "Encode test failed\n";
print "Got: '$x'\n"; print "Got: '$x'\n";
print "Expected: '$encoded'\n"; print "Expected: '$encoded'\n";
print "not ok $testno\n"; print "not ok $testno\n";
next; next;
} }
$x = decode_qp($encoded); $x = decode_qp($encoded);
if ($x ne $plain) { if ($x ne $plain) {
print "Decode test failed\n"; print "Decode test failed\n";
 End of changes. 7 change blocks. 
7 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)