]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/feed.t
treewide: "require" + "use" cleanup and docs
[public-inbox.git] / t / feed.t
index 4a887b49953df6fbe22369a0e9365eca8f373b74..ec8a5a42e9ae3ee635a6f592e64e8789efd66bfb 100644 (file)
--- a/t/feed.t
+++ b/t/feed.t
@@ -5,25 +5,29 @@ 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;