diff options
author | Abhijit Menon-Sen <ams@wiw.org> | 2003-02-03 08:26:36 +0000 |
---|---|---|
committer | Abhijit Menon-Sen <ams@wiw.org> | 2003-02-03 08:26:36 +0000 |
commit | 6a63fb82fdd16c61ba37cb79b6a3e6dd0703ff0d (patch) | |
tree | a93ed67b617c3a83f04707d1045719fb73f93663 /ext/MIME/Base64/t | |
parent | 330e22d5036b4b1f7e7b4336c48c776a45e1f14f (diff) | |
download | perl-6a63fb82fdd16c61ba37cb79b6a3e6dd0703ff0d.tar.gz |
Integrate MIME::Base64 2.16 from CPAN. (Do we really want the
utility scripts?)
p4raw-id: //depot/perl@18642
Diffstat (limited to 'ext/MIME/Base64/t')
-rw-r--r-- | ext/MIME/Base64/t/base64.t | 18 | ||||
-rw-r--r-- | ext/MIME/Base64/t/quoted-print.t | 38 |
2 files changed, 35 insertions, 21 deletions
diff --git a/ext/MIME/Base64/t/base64.t b/ext/MIME/Base64/t/base64.t index 08bdea003b..b398131981 100644 --- a/ext/MIME/Base64/t/base64.t +++ b/ext/MIME/Base64/t/base64.t @@ -337,15 +337,15 @@ sub encodeTest } if (ord('A') != 193) { # perl versions broken on EBCDIC - # Try the old Perl versions too - if ($encoded ne MIME::Base64::old_encode_base64($plain, '')) { - print "old_encode_base64 give different result.\n"; - print "not "; - } - if ($plain ne MIME::Base64::old_decode_base64($encoded)) { - print "old_decode_base64 give different result.\n"; - print "not "; - } + # Try the old Perl versions too + if ($encoded ne MIME::Base64::old_encode_base64($plain, '')) { + print "old_encode_base64 give different result.\n"; + print "not "; + } + if ($plain ne MIME::Base64::old_decode_base64($encoded)) { + print "old_decode_base64 give different result.\n"; + print "not "; + } } print "ok $testno\n"; diff --git a/ext/MIME/Base64/t/quoted-print.t b/ext/MIME/Base64/t/quoted-print.t index 395958ee21..66427246e1 100644 --- a/ext/MIME/Base64/t/quoted-print.t +++ b/ext/MIME/Base64/t/quoted-print.t @@ -25,8 +25,8 @@ $x70 = "x" x 70; ["test \ntest\n\t \t \n" => "test=20=20\ntest\n=09=20=09=20\n"], # "=" is special an should be decoded - ["=\n" => "=3D\n"], - ["\0\xff" => "=00=FF"], + ["=30\n" => "=3D30\n"], + ["\0\xff0" => "=00=FF0"], # Very long lines should be broken (not more than 76 chars ["The Quoted-Printable encoding is intended to represent data that largly consists of octets that correspond to printable characters in the ASCII character set." => @@ -57,20 +57,34 @@ y. -- H. L. Mencken"], ["$x70!234" => "$x70!234"], ["$x70!2345" => "$x70!2345"], ["$x70!23456" => "$x70!23456"], + ["$x70!234567" => "$x70!2345=\n67"], + ["$x70!23456=" => "$x70!2345=\n6=3D"], ["$x70!23\n" => "$x70!23\n"], ["$x70!234\n" => "$x70!234\n"], ["$x70!2345\n" => "$x70!2345\n"], ["$x70!23456\n" => "$x70!23456\n"], + ["$x70!234567\n" => "$x70!2345=\n67\n"], + ["$x70!23456=\n" => "$x70!2345=\n6=3D\n"], # Not allowed to break =XX escapes using soft line break - ["$x70===xxxx" => "$x70=3D=\n=3D=3Dxxxx"], - ["$x70!===xxx" => "$x70!=3D=\n=3D=3Dxxx"], - ["$x70!!===xx" => "$x70!!=3D=\n=3D=3Dxx"], - ["$x70!!!===x" => "$x70!!!=\n=3D=3D=3Dx"], - # ^ - # 70123456| - # max - # line width + ["$x70===xxxxx" => "$x70=3D=\n=3D=3Dxxxxx"], + ["$x70!===xxxx" => "$x70!=3D=\n=3D=3Dxxxx"], + ["$x70!2===xxx" => "$x70!2=3D=\n=3D=3Dxxx"], + ["$x70!23===xx" => "$x70!23=\n=3D=3D=3Dxx"], + ["$x70!234===x" => "$x70!234=\n=3D=3D=3Dx"], + ["$x70!2=\n" => "$x70!2=3D\n"], + ["$x70!23=\n" => "$x70!23=\n=3D\n"], + ["$x70!234=\n" => "$x70!234=\n=3D\n"], + ["$x70!2345=\n" => "$x70!2345=\n=3D\n"], + ["$x70!23456=\n" => "$x70!2345=\n6=3D\n"], + # ^ + # 70123456| + # max + # line width + + # some extra special cases we have had problems with + ["$x70!2=x=x" => "$x70!2=3D=\nx=3Dx"], + ["$x70!2345$x70!2345$x70!23456\n", "$x70!2345=\n$x70!2345=\n$x70!23456\n"], ); $notests = @tests + 3; @@ -110,8 +124,8 @@ $testno++; print "ok $testno\n"; # Same test but with "\r\n" terminated lines print "not " unless decode_qp("foo \r\n\r\nfoo =\r\n\r\nfoo=20\r\n\r\n") eq - "foo\r\n\r\nfoo \r\nfoo \r\n\r\n"; + "foo\n\nfoo \nfoo \n\n"; $testno++; print "ok $testno\n"; -print "not " if $] >= 5.006 && (eval 'encode_qp("XXX \x{100}")' || $@ !~ /^The Quoted-Printable encoding is only defined for bytes/); +print "not " if $] >= 5.006 && (eval 'encode_qp("XXX \x{100}")' || !$@); $testno++; print "ok $testno\n"; |