X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Feml.t;h=8d131b1418eb7c510b55297ef2cbeed4632fd038;hb=256b3566e4d57a64bb349a7b896da10381a2a363;hp=b7f58ac706965b289b03e1d627a4acb7dc6f3113;hpb=e60231148eb604a379033c69e8c4494eb1753783;p=public-inbox.git diff --git a/t/eml.t b/t/eml.t index b7f58ac7..8d131b14 100644 --- a/t/eml.t +++ b/t/eml.t @@ -12,6 +12,12 @@ SKIP: { }; use_ok $_ for @classes; +sub mime_load ($) { + my ($path) = @_; + open(my $fh, '<', $path) or die "open $path: $!"; + PublicInbox::MIME->new(\(do { local $/; <$fh> })); +} + { my $eml = PublicInbox::Eml->new(\(my $str = "a: b\n\nhi\n")); is($str, "hi\n", '->new modified body like Email::Simple'); @@ -74,7 +80,7 @@ for my $cls (@classes) { $eml->header_str_set('Subject', "\x{100}"); like($eml->header_raw('Subject'), qr/utf-8\?B\?/i, 'MIME-B encoded UTF-8 Subject'); - is_deeply([$eml->header_str('Subject')], [ "\x{100}" ], + is_deeply([$eml->header('Subject')], [ "\x{100}" ], 'got wide character back'); } @@ -163,7 +169,7 @@ EOF is(scalar(@tmp), 1, 'got one part even w/o boundary'); is($tmp[0]->[0]->[0]->body, "hello world\n", 'body preserved'); is($tmp[0]->[0]->[1], 0, '$depth is zero'); - is($tmp[0]->[0]->[2], 0, '@idx is zero'); + is($tmp[0]->[0]->[2], 1, '@idx is one'); } # I guess the following only worked in PI::M because of a happy accident