]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/nntpd.t
index: account for CRLF conversion when storing bytes
[public-inbox.git] / t / nntpd.t
index 5a3a62fbec9c7c13e273d0ee37c2723759fad11c..d2f313231159cc7df01942b869fc8b82b9f07190 100644 (file)
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -7,7 +7,7 @@ use PublicInbox::TestCommon;
 use PublicInbox::Spawn qw(which);
 require_mods(qw(DBD::SQLite));
 require PublicInbox::InboxWritable;
-use Email::Simple;
+use PublicInbox::Eml;
 use IO::Socket;
 use Socket qw(IPPROTO_TCP TCP_NODELAY);
 use Net::NNTP;
@@ -53,11 +53,11 @@ $ibx = PublicInbox::Inbox->new($ibx);
        my $len;
 
        $ibx = PublicInbox::InboxWritable->new($ibx);
-       my $im = $ibx->importer;
+       my $im = $ibx->importer(0);
 
        # ensure successful message delivery
        {
-               my $mime = Email::MIME->new(<<EOF);
+               my $mime = PublicInbox::Eml->new(<<EOF);
 To: =?utf-8?Q?El=C3=A9anor?= <you\@example.com>
 From: =?utf-8?Q?El=C3=A9anor?= <me\@example.com>
 Cc: $addr
@@ -73,7 +73,10 @@ EOF
                my $list_id = $addr;
                $list_id =~ s/@/./;
                $mime->header_set('List-Id', "<$list_id>");
-               $len = length($mime->as_string);
+               my $str = $mime->as_string;
+               $str =~ s/(?<!\r)\n/\r\n/sg;
+               $len = length($str);
+               undef $str;
                $im->add($mime);
                $im->done;
                if ($version == 1) {
@@ -241,7 +244,7 @@ EOF
                ok($date <= $t1, 'valid date before stop');
        }
        if ('leafnode interop') {
-               my $for_leafnode = PublicInbox::MIME->new(<<"");
+               my $for_leafnode = PublicInbox::Eml->new(<<"");
 From: longheader\@example.com
 To: $addr
 Subject: none