diff options
author | Eric Wong <e@80x24.org> | 2019-11-14 06:41:11 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-11-15 01:09:09 +0000 |
commit | 4941f43f0fcac72ba663bc96abef19fe913becd4 (patch) | |
tree | bc97f3e3cfc80ed60a1641f9b948318a8314e6fb | |
parent | 738a8361e52158ca9d4463e342b6c55b6eceb063 (diff) | |
download | public-inbox-4941f43f0fcac72ba663bc96abef19fe913becd4.tar.gz |
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.
-rw-r--r-- | t/common.perl | 11 | ||||
-rw-r--r-- | t/feed.t | 9 |
2 files changed, 8 insertions, 12 deletions
diff --git a/t/common.perl b/t/common.perl index ccc7be46..053a935a 100644 --- a/t/common.perl +++ b/t/common.perl @@ -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', @@ -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); |