2 # $Id: 01_mime.t,v 1.1 2005/08/17 21:46:17 don Exp $
4 use Test::More tests => 6;
11 use_ok('Debbugs::MIME');
13 # encode_headers testing
15 my $test_str = decode_utf8(<<'END');
16 Döñ Ärḿßtrøñĝ <don@donarmstrong.com>
19 my $test_str2 = decode_utf8(<<'END');
20 Döñ Ärḿßtrøñĝ <don@donarmstrong.com>
23 my $test_str3 =decode_utf8(<<'END');
28 ok(Debbugs::MIME::decode_rfc1522(q(=?iso-8859-1?Q?D=F6n_Armstr=F3ng?= <don@donarmstrong.com>)) eq
29 decode_utf8(q(Dön Armstróng <don@donarmstrong.com>)),"decode_rfc1522 decodes and converts to UTF8 properly");
33 ok(Debbugs::MIME::decode_rfc1522(Debbugs::MIME::encode_rfc1522(encode_utf8($test_str))) eq $test_str,
34 "encode_rfc1522 encodes strings that decode_rfc1522 can decode");
35 ok(Debbugs::MIME::decode_rfc1522(Debbugs::MIME::encode_rfc1522(encode_utf8($test_str2))) eq $test_str2,
36 "encode_rfc1522 encodes strings that decode_rfc1522 can decode");
37 ok(Debbugs::MIME::decode_rfc1522(Debbugs::MIME::encode_rfc1522(encode_utf8($test_str3))) eq $test_str3,
38 "encode_rfc1522 properly handles parenthesis and \"");
41 # Make sure that create_mime_message has encoded headers and doesn't enclude any 8-bit characters
43 $test_str = Encode::encode("UTF-8",$test_str);
44 ok(Debbugs::MIME::create_mime_message([Subject => $test_str,
49 ) !~ m{([\xF0-\xFF]+)},
50 "create_mime_message properly encodes 8bit messages."
53 # XXX figure out how to test parse