]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/msg_iter.t
update copyrights for 2021
[public-inbox.git] / t / msg_iter.t
index ac2066a2780d8d4fd7acb09a242633ae1863a183..e46d515c8ee4de99aafc8653ee542338f89648f4 100644 (file)
@@ -1,20 +1,14 @@
-# Copyright (C) 2016-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use warnings;
 use Test::More;
 use PublicInbox::TestCommon;
 use PublicInbox::Hval qw(ascii_html);
-use PublicInbox::InboxWritable;
 use_ok('PublicInbox::MsgIter');
 
 {
-       my $mime = mime_load 't/msg_iter-order.eml', sub {
-       my $parts = [ Email::MIME->create(body => "a\n"),
-                       Email::MIME->create(body => "b\n") ];
-       Email::MIME->create(parts => $parts,
-                               header_str => [ From => 'root@localhost' ]);
-       }; # mime_load sub
+       my $mime = eml_load 't/msg_iter-order.eml';
        my @parts;
        msg_iter($mime, sub {
                my ($part, $level, @ex) = @{$_[0]};
@@ -26,15 +20,7 @@ use_ok('PublicInbox::MsgIter');
 }
 
 {
-       my $mime = mime_load 't/msg_iter-nested.eml', sub {
-       my $parts = [ Email::MIME->create(body => 'a'),
-                       Email::MIME->create(body => 'b') ];
-       $parts = [ Email::MIME->create(parts => $parts,
-                               header_str => [ From => 'sub@localhost' ]),
-                       Email::MIME->create(body => 'sig') ];
-       Email::MIME->create(parts => $parts,
-                               header_str => [ From => 'root@localhost' ]);
-       }; # mime_load sub
+       my $mime = eml_load 't/msg_iter-nested.eml';
        my @parts;
        msg_iter($mime, sub {
                my ($part, $level, @ex) = @{$_[0]};
@@ -42,14 +28,12 @@ use_ok('PublicInbox::MsgIter');
                $s =~ s/\s+//s;
                push @parts, [ $s, $level, @ex ];
        });
-       is_deeply(\@parts, [ [qw(a 2 1 1)], [qw(b 2 1 2)], [qw(sig 1 2)] ],
+       is_deeply(\@parts, [ [qw(a 2 1.1)], [qw(b 2 1.2)], [qw(sig 1 2)] ],
                'nested part shows up properly');
 }
 
 {
-       my $f = 't/iso-2202-jp.eml';
-       my $mime = PublicInbox::InboxWritable::mime_from_path($f) or
-               die "open $f: $!";
+       my $mime = eml_load 't/iso-2202-jp.eml';
        my $raw = '';
        msg_iter($mime, sub {
                my ($part, $level, @ex) = @{$_[0]};
@@ -62,9 +46,7 @@ use_ok('PublicInbox::MsgIter');
 }
 
 {
-       my $f = 't/x-unknown-alpine.eml';
-       my $mime = PublicInbox::InboxWritable::mime_from_path($f) or
-               die "open $f: $!";
+       my $mime = eml_load 't/x-unknown-alpine.eml';
        my $raw = '';
        msg_iter($mime, sub {
                my ($part, $level, @ex) = @{$_[0]};