]> Sergey Matveev's repositories - public-inbox.git/commitdiff
t/common: inline stream_to_string into t/feed.t
authorEric Wong <e@80x24.org>
Thu, 14 Nov 2019 06:41:11 +0000 (06:41 +0000)
committerEric Wong <e@80x24.org>
Fri, 15 Nov 2019 01:09:09 +0000 (01:09 +0000)
We only use it in one place and have favored test_psgi
in newer tests, so move it out-of-the-way to reduce startup
overhead of other *.t files.

t/common.perl
t/feed.t

index ccc7be46099aaa7708cb65126d3400b98102a87a..053a935a8df510f61e5874d3d381bd1cedeeaa46 100644 (file)
@@ -7,17 +7,6 @@ use strict;
 use warnings;
 use IO::Socket::INET;
 
-sub stream_to_string {
-       my ($res) = @_;
-       my $body = $res->[2];
-       my $str = '';
-       while (defined(my $chunk = $body->getline)) {
-               $str .= $chunk;
-       }
-       $body->close;
-       $str;
-}
-
 sub tcp_server () {
        IO::Socket::INET->new(
                LocalAddr => '127.0.0.1',
index eb1f35fb0158e6aa357b4f07cde8927040b8a300..93da37179f2ccef749458f79aee21ae1dcb7814e 100644 (file)
--- a/t/feed.t
+++ b/t/feed.t
@@ -14,7 +14,14 @@ my $have_xml_feed = eval { require XML::Feed; 1 };
 require './t/common.perl';
 
 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);