]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/feed.t
treewide: run update-copyrights from gnulib for 2019
[public-inbox.git] / t / feed.t
index 4a887b49953df6fbe22369a0e9365eca8f373b74..5333d5827985419908bb1bf8a6ec782a4f5060a8 100644 (file)
--- a/t/feed.t
+++ b/t/feed.t
@@ -1,29 +1,33 @@
-# Copyright (C) 2014-2019 all contributors <meta@public-inbox.org>
+# Copyright (C) 2014-2020 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 Email::MIME;
 use PublicInbox::Feed;
-use PublicInbox::Git;
 use PublicInbox::Import;
-use PublicInbox::Config;
 use PublicInbox::Inbox;
-use File::Temp qw/tempdir/;
 my $have_xml_feed = eval { require XML::Feed; 1 };
-require './t/common.perl';
+use PublicInbox::TestCommon;
 
 sub string_feed {
-       stream_to_string(PublicInbox::Feed::generate($_[0]));
+       my $res = PublicInbox::Feed::generate($_[0]);
+       my $body = $res->[2];
+       my $str = '';
+       while (defined(my $chunk = $body->getline)) {
+               $str .= $chunk;
+       }
+       $body->close;
+       $str;
 }
 
-my $tmpdir = tempdir('pi-feed-XXXXXX', TMPDIR => 1, CLEANUP => 1);
+my ($tmpdir, $for_destroy) = tmpdir();
 my $git_dir = "$tmpdir/gittest";
 my $ibx = PublicInbox::Inbox->new({
        address => 'test@example',
        name => 'testbox',
-       mainrepo => $git_dir,
-       url => 'http://example.com/test',
+       inboxdir => $git_dir,
+       url => [ 'http://example.com/test' ],
        feedmax => 3,
 });
 my $git = $ibx->git;